bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Defining new targets with eval during secondary expansion?


From: Brian Vandenberg
Subject: Re: Defining new targets with eval during secondary expansion?
Date: Mon, 13 Mar 2017 10:04:34 -0600

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 address@hidden
endef

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


-brian

reply via email to

[Prev in Thread] Current Thread [Next in Thread]