0
Makefile的模板是如下有Makefile中很難理解$$$$(DIR $$$$ @):使用eval
# cc compile template, generate rule for dep, obj: (file, cc[, flags, dir])
define cc_template
$$(call todep,$(1),$(4)): $(1) | $$$$(dir [email protected])
@$(2) -I$$(dir $(1)) $(3) -MM $$< -MT "$$(patsubst %.d,%.o,[email protected]) [email protected]"> [email protected]
$$(call toobj,$(1),$(4)): $(1) | $$$$(dir [email protected])
@echo + cc $$<
$(V)$(2) -I$$(dir $(1)) $(3) -c $$< -o [email protected]
ALLOBJS += $$(call toobj,$(1),$(4))
endef
# compile file: (#files, cc[, flags, dir])
define do_cc_compile
$$(foreach f,$(1),$$(eval $$(call cc_template,$$(f),$(2),$(3),$(4))))
endef
我知道的eval將擴大兩倍,所以我們應該用另一種$
。但是我們爲什麼要在這裏使用$$$$(dir [email protected])
?我試圖理解這一點,但我失敗了。