Gui*_*i13 13 logic conditional makefile verbose
我想在我的makefile中启用详细编译,但我无法弄清楚如何创建一个条件OR.
让我解释一下:我希望能够通过设置或指定一个详细的编译.我想保持可用,因为我们有一些使用它的脚本(并且使用其他makefile只知道)V=1 VERBOSE=1VERBOSE=1VERBOSE
所以结果必须是这两个命令是相同的:
make all VERBOSE=1 # pain to write
make all V=1
Run Code Online (Sandbox Code Playgroud)
现在,我的makefile今天看起来像这样:
ifdef VERBOSE
[issue compilation commands with verbose mode]
endif
Run Code Online (Sandbox Code Playgroud)
我想要实现的是接近C中的预处理器:
if defined(VERBOSE) || defined(V)
[issue compilation commands with verbose mode]
endif
Run Code Online (Sandbox Code Playgroud)
你知道怎么做吗?
小智 13
我喜欢这个:
ifneq "$(or $(LINUX_TARGET),$(OSX_TARGET))" ""
endif
Run Code Online (Sandbox Code Playgroud)
类似于$(条带方法,但使用更直观的$(或关键字)
小智 5
VERBOSE := $(or $(VERBOSE),$(V))
Run Code Online (Sandbox Code Playgroud)
...然后...
ifeq ($(VERBOSE),1)
#Conditional stuff
endif
Run Code Online (Sandbox Code Playgroud)