>
> This is a bit nicer but there's still some duplication. What I'd like to do
> is replace the argument on the right hand side with $(dir $@). With
> secondary
> expansion enabled I could write something like this:
>
>   mktargetdir = $(eval $(call mkdir_template,$(dir $@))) $(dir $@)
>
>   .SECONDEXPANSION:
>
>   build/foo/bar/baz/mytarget: | $$(mktargetdir)
>
> Then I can just write the path for each target and all the duplication is
> gone.
> But this doesn't work and I get the error above about prerequisites in
> recipes.
>

What if you changed the way you specify your targets, eg:


ASDF = $(foreach x, ${1}, $(eval $(call ${0}_, ${1}, $(dirname ${1})))) ${1}
define ASDF_ =
${1} :| ${2}
${2} : ; mkdir -p ${@}
endef

$(call build/foo/bar/baz/mytarget) : other dependencies for mytarget
...


-brian
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to