[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Giving pattern rules with implicit prerequisites priority
From: |
Peter Johnson |
Subject: |
Giving pattern rules with implicit prerequisites priority |
Date: |
Tue, 2 Jun 2009 18:38:55 -0700 |
Hi,
I am using GNU Make to run simulations. The target always ends with
".log". Simulations depend on files with a ".v" suffix, but there is
no rule (generally) to know what .v files are required for any given
simulation. So I have something like the following...
force:
%.log: force
${simulation_action}
test1.log: file1.v file2.v
test2.log: file1.v file3.v
Now, sometimes there is a relationship between a stem on the .v file
and the test name. So I may have a rule like this (and place it before
the %.log rule above)...
special_%.log: special_%.v force ; ${simulation_action}
special_%.v: special.v
${special_build_action}
Now my problem is this. If I want to make special_20.log and
special_20.v doesn't already exist, make will instead choose to use
the %.log rule even though it may come later in the file since it
doesn't have implicit prerequisites (see the last sentence 10.5.1 of
the documentation). Is there some way to give priority to the special
rule even though it may require building implicit prerequisites?
What I need is a way to tell the %.log rule that it must have some .v
file as a dependency although I don't know what the name of the .v
file may be.
The best solution I could find was this...
%.implicit:
touch $@
%.log: %.implicit
${simulation_action}
${RM} $(filter %.implicit,$^)
This then demotes the %.log target to also depending on an implicit
rule, so the order determines the rule precedence.
Is there a better way? Specifically one that doesn't depend on rule
ordering?
Thanks,
-Pete
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Giving pattern rules with implicit prerequisites priority,
Peter Johnson <=