日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

GNU make manual 翻译( 一百六十)

發布時間:2023/12/9 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 GNU make manual 翻译( 一百六十) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

繼續翻譯

The only restriction on this sort of use of nested variable
references is that they cannot specify part of the name of a function
to be called. This is because the test for a recognized function name
is done before the expansion of nested references. For example,

ifdef do_sort
func := sort
else
func := strip
endif

bar := a d b g q c

foo := $($(func) $(bar))

attempts to give `foo' the value of the variable `sort a d b g q c' or
`strip a d b g q c', rather than giving `a d b g q c' as the argument
to either the `sort' or the `strip' function. This restriction could
be removed in the future if that change is shown to be a good idea.

You can also use computed variable names in the left-hand side of a
variable assignment, or in a `define' directive, as in:

dir = foo
$(dir)_sources := $(wildcard $(dir)/*.c)
define $(dir)_print =
lpr $($(dir)_sources)
endef

This example defines the variables `dir', `foo_sources', and
`foo_print'.

Note that "nested variable references" are quite different from
recursively expanded variables (*note The Two Flavors of Variables:
Flavors.), though both are used together in complex ways when doing
makefile programming.

?

對于這種對嵌套式變量參照使用的唯一的限制是他們不能指定一個要調用的函數名稱的部分。這是因為對一個被認識的函數名稱的測試已經在嵌套參照之前完成了。例如,

ifdef do_sort

  func := sort
else
  func := strip
endif

bar := a d b g q c

foo := $($(func) $(bar))

試圖給出 `foo' 變量值為 `sort a d b g q c' 或?`strip a d b g q c', 而不是給出`a d b g q c' 作為?`sort' 或者 `strip' 函數的參數。如果未來考慮到改變此限制會更好,也許未來會進行改變。

你可以在一個變量賦值或define指令的左邊得左邊使用被計算的變量名,就像是這樣:

dir = foo

$(dir)_sources := $(wildcard $(dir)/*.c)
define $(dir)_print =
lpr $($(dir)_sources)
endef

這個例子定義了變量 `dir', `foo_sources', 和`foo_print'。

要注意這個 "嵌套變量參照" 是和 遞歸式擴展變量很不一樣的。(*note The Two Flavors of Variables: Flavors.) 盡管它們都在 makefile 編程時以復雜的方式進行使用。?

這里我插入一句,

dir = foo

$(dir)_sources := $(wildcard $(dir)/*.c)

相當于 把 ?foo目錄下的 所有的.c 文件名 獲得后,賦值為 foo_sources

后文待續

轉載于:https://www.cnblogs.com/gaojian/archive/2012/10/04/2711261.html

總結

以上是生活随笔為你收集整理的GNU make manual 翻译( 一百六十)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。