获取 Makefile 规则的文件扩展名
Get the filename extension of a Makefile rule
如果我有以下规则
myfile.ext:
...
# `extname $@` or something
如何从规则主体中引用扩展名(ext
在本例中)?
$(suffix)
函数可以满足您的需求。
$(suffix names…)
Extracts the suffix of each file name in names. If the file name contains a period, the suffix is everything starting with the last period. Otherwise, the suffix is the empty string. This frequently means that the result will be empty when names is not, and if names contains multiple file names, the result may contain fewer file names.
For example,
$(suffix src/foo.c src-1.0/bar.c hacks)
produces the result ‘.c .c’.
如果我有以下规则
myfile.ext:
...
# `extname $@` or something
如何从规则主体中引用扩展名(ext
在本例中)?
$(suffix)
函数可以满足您的需求。
$(suffix names…)
Extracts the suffix of each file name in names. If the file name contains a period, the suffix is everything starting with the last period. Otherwise, the suffix is the empty string. This frequently means that the result will be empty when names is not, and if names contains multiple file names, the result may contain fewer file names.
For example,
$(suffix src/foo.c src-1.0/bar.c hacks)
produces the result ‘.c .c’.