How can I change the value of a variable based on one of the targets in Makefile? Something link this:
target:开发者_开发问答
DEFINES += -DDEPLOY
If your make is GNU make, target-specific variable might meet the purpose. 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...
精彩评论