GNU make manual 翻译( 一百五十九)
繼續翻譯
A computed variable name need not consist entirely of a single variable reference. It can contain several variable references, as well as some invariant text. For example,a_dirs := dira dirb1_dirs := dir1 dir2a_files := filea fileb1_files := file1 file2ifeq "$(use_a)" "yes"a1 := aelsea1 := 1endififeq "$(use_dirs)" "yes"df := dirselsedf := filesendifdirs := $($(a1)_$(df))will give `dirs' the same value as `a_dirs', `1_dirs', `a_files' or `1_files' depending on the settings of `use_a' and `use_dirs'. Computed variable names can also be used in substitution references:a_objects := a.o b.o c.o1_objects := 1.o 2.o 3.osources := $($(a1)_objects:.o=.c)defines `sources' as either `a.c b.c c.c' or `1.c 2.c 3.c', depending on the value of `a1'.一個被計算的變量名不需要有一個單獨的變量參照組成。它可以包含幾個變量參照,也可以包含靜態文本。例如,
a_dirs := dira dirb
1_dirs := dir1 dir2
a_files := filea fileb
1_files := file1 file2
ifeq "$(use_a)" "yes"
a1 := a
else
a1 := 1
endif
ifeq "$(use_dirs)" "yes"
df := dirs
else
df := files
endif
dirs := $($(a1)_$(df))
將要給出 `dirs' 的值為 `a_dirs', `1_dirs', `a_files' 或者
`1_files' ,這取決于 `use_a' 或者 `use_dirs'.
被計算的變量名字也可以用在替換參照中:
a_objects := a.o b.o c.o
1_objects := 1.o 2.o 3.o
sources := $($(a1)_objects:.o=.c)
定義 `sources' 為 `a.c b.c c.c' 或者 `1.c 2.c 3.c', 取決于`a1'的值。
后文待續
轉載于:https://www.cnblogs.com/gaojian/archive/2012/10/04/2711255.html
總結
以上是生活随笔為你收集整理的GNU make manual 翻译( 一百五十九)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Delphi中DLL或Package窗体
- 下一篇: Linux下设计并发队列