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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -