Reputation: 1029
In my project, there are two kinds of files, both created using the same commands, but with prerequisites:
%.blvp: lab_bd.act %.ext
%.slvp: lab_syn.act %.ext
%.blvp %.slvp:
$(eval x := $(basename $@))
act2lvp $< $x
lvp -sDEv $x.ext $x.prs && touch $@
The only difference is that .blvp
files use lab_bd.act
and .slvp
use lab_syn.act
. Whichever file this is is meant to be the first argument to act2lvp
.
However, the prerequisites from above do not get carried down into the rule (i.e., act2lvp $x
is evaluated; $^
is apparently empty.
$ make xyz.slvp
act2lvp xyz
Usage: /usr/local/cad/bin/act2lvp <actfile> <processname>
makefile:17: recipe for target 'xyz.slvp' failed
make: *** [xyz.slvp] Error 1
How can I get the prerequisites to be carried down from above? Alternatively, would you suggest an alternative approach for this circumstance?
Upvotes: 0
Views: 145
Reputation: 99172
Pattern rules don't combine that way, but you can get the same effect with a pattern-specific variable:
%.blvp: ACT=lab_bd.act
%.slvp: ACT=lab_syn.act
%.blvp %.slvp : %.ext
$(eval x := $(basename $@))
act2lvp $(ACT) $x
lvp -sDEv $x.ext $x.prs && touch $@
P.S. you can save yourself some trouble with the automatic variable $*
:
%.blvp %.slvp : %.ext
act2lvp $(ACT) $*
lvp -sDEv $*.ext $*.prs && touch $@
EDIT: I overlooked the task of rebuilding the *.act files. We can add $(ACT)
as a prerequisite if we use Secondary expansion:
.SECONDEXPANSION:
%.blvp %.slvp : %.ext $$(ACT)
act2lvp $(ACT) $*
lvp -sDEv $*.ext $*.prs && touch $@
Upvotes: 1