I can't seem to force make
to use a more specific rule. I'm working with version 3.81, which is supposed to use the first rule it comes to, but this doesn't seem to work when the more specific rule has a dependency that must be constructed with another rule. Here's the basic picture:
#rule for the dependency of the more specific rule
%.bbl: %.tex *.bib
<build the .bbl file>
#more specific rule
some_prefix%.pdf: some_prefix%.tex some_prefix%.bbl
<build the .pdf>
#general rule
%.pdf: %.tex
<build the .pdf>
So basically I want make
to build the pdf with the .bbl
file if it matches some_prefix
, otherwise use the more general rule. Unfortunately, unless I remove the dependency on the .bbl
file, the second rule never gets called.
I seem to be able to get it working by adding a hack to the general rule:
%.pdf: %.tex %.hack
<make the pdf with a more general rule>
%.hack: %.tex
touch $@
This seems to work, and the .hack
files are deleted automatically, but as the name implies, this is a terrible hack. It seems like there must be some better way to force the use of the specific rule.
How can I force make to use the more specific rule? Putting it first doesn't seem to help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…