Having trouble understanding $$$$(dir $$$$@) in Makefile using eval -
the makefile template follows:
# cc compile template, generate rule dep, obj: (file, cc[, flags, dir]) define cc_template $$(call todep,$(1),$(4)): $(1) | $$$$(dir $$$$@) @$(2) -i$$(dir $(1)) $(3) -mm $$< -mt "$$(patsubst %.d,%.o,$$@) $$@"> $$@ $$(call toobj,$(1),$(4)): $(1) | $$$$(dir $$$$@) @echo + cc $$< $(v)$(2) -i$$(dir $(1)) $(3) -c $$< -o $$@ 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
i know eval expand twice, should use $
. why should use $$$$(dir $$$$@)
here? have tried understand this, failed.
when make parses file, expands. if sees $$
expands $
. $$$$
expand $$
(two dollars). eval, once applied want expand once more $
. need 4 dollars (note $$$
expand $
followed expansion of $(
, or whatever next character happens be, likley result in error)
Comments
Post a Comment