[英]Change a variable based on a target in Makefile
How can I change the value of a variable based on one of the targets in Makefile? 如何根据Makefile中的某个目标更改变量的值? Something link this: 东西链接这个:
target:
DEFINES += -DDEPLOY
If your make is GNU make, target-specific variable might meet the purpose. 如果你的make是GNU make,那么特定于目标的变量可能符合目的。 This facility allows almost the same notation as in the question like the following: 此工具允许与以下问题中的几乎相同的表示法:
target: DEFINES += -DDEPLOY
ifeq ($(MAKECMDGOALS),target)
DEFINES += DDEPLOY
endif
Maybe something like: 也许是这样的:
target:
DEFINES="${DEFINES} -DDEPLOY"
and on the compiler invocation line: 并在编译器调用行上:
gcc -c blablabla ... ${DEFINES}
Not sure if it work, don't know if it is compatible with every shell... 不确定它是否有效,不知道它是否与每个shell兼容......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.