我有一个由“gmake -f Makefile foo”执行的Makefile,如下所示。
foo:
#set var = 1
@$(MAKE) bar var=1
bar:
#hello.mk is included
@echo “success”
ifeq ($(var), 1)
include test\hello.mk
endif
我想将此转换为顺序流,就像下面的内容一样,因为它具有较少的开销,并且不需要退回到此Makefile中。
foo:
$(eval var=1)
@$(bar)
define bar
include test\hello.mk #this doesn’t work
@echo “success”
endef
我不能在函数或目标中包含一个include语句,那么如何解决这个问题以使这个Makefile顺序而不进行make调用?
答案 0 :(得分:0)
简短回答:你不能这样做。
你想用不同的makefile制作'foo'和'bar',如果没有对Make的递归调用你就不能这样做。
如果您可以对hello.mk
可以执行的操作设置一些限制,您可以将其转换为一次。