[英]Variables based on targets in Makefile
when creating a Makefile, im trying to figure out how(if) i can change a variable based on the target. 在创建Makefile时,我试图弄清楚如何(如果)我可以根据目标更改变量。
So something likes this: 所以喜欢这样的东西:
VER = $(if target=release then 1.0.0 elseif target=nightly then 20110411)
nightly:
@@echo ${VER} >> version.txt
release:
@@echo ${VER} >> version.txt
If your make
is GNU make, Target-Specific Variable is allowed. 如果您的
make
是GNU make,则允许使用特定于目标的变量 。
For example, in your question's case, the following definitions will meet the purpose: 例如,在您的问题中,以下定义将满足以下目的:
nightly: VER = 20110411
release: VER = 1.0.0
nightly:
@echo ${VER}
release:
@echo ${VER}
Hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.