我有一个简单的gnu makefile:
ifdef $(DEBUGGING)
CFLAGS = -g -O0 -Wall
else
CFLAGS = -O3 -Wall
endif
test:
@echo DEBUGGING is $(DEBUGGING)
@echo $(CFLAGS)
当我像这样调用它时,我看到DEBUGGING被设置为true,但是ifdef $DEBUGGING
似乎是false:
$ DEBUGGING=true make test
DEBUGGING is true
-O3 -Wall
我希望CFLAGS设置为"-g - 0 -Wall"。我错过了什么?
您在ifdef
中使用NAME变量:
ifdef DEBUGGING
给ifdef
的值首先展开,结果作为变量名