0
的美容规则通常我们有这样的一个Makefile为冗长
%.o:%.c
$(cc) $(flags) -o [email protected] -c $<
当标志的量是巨大的,我感觉好多了写这个不是
%.o:%.c
$(info $(cc): $< --> [email protected])
@$(cc) $(flags) -o [email protected] -c $<
但是它可以是有用的有时会看到一切。所以我定义的变量为:
[email protected]
%.o:%.c
$(info $(cc): $< --> [email protected])
$(at)$(cc) $(flags) -o [email protected] -c $<
我的问题是如何正确,轻松设置或命令行取消设置$(at)
。我看到了两个解决方案:
$ make verbose all
$ make verbose=1 all
随着第一个解决方案,我会做这个
ifeq (,$(filter verbose,$(MAKECMDGOALS)))
[email protected]
dummy:=$(filter-out verbose,$(MAKECMDGOALS)))
endif
随着第二我可以这样做
ifeq (,$(filter 1,$(verbose)))
[email protected]
endif
是这两种解决方案可以接受或者我可以做的更好?
非常好,这就是我一直在寻找的。谢谢。 – nowox