PVitt
PVitt

Reputation: 11760

Rule name as part of prerequisites

I have a Makefile to extract the publications for several authors from a BibTex-File and transpose them into a HTML page. I tried to create the Makefile as generic as possible, but now I'm stuck.

Here is what I have at the moment:

objects = sts-bib-*.bib
results = Author1 Author2

.PHONY : clean cleanall all $(results)

all : $(results)

$(results) : [email protected]

bib-%.bib :
  TMPDIR=. bibtex2html-1.96-osx-x86_64/bib2bib -c 'author : "$*"' -s '$$date' source.bib

bib-%.html : bib-%.bib
  TMPDIR=. bibtex2html-1.96-osx-x86_64/bibtex2html -d -r --nodoc --nobibsource --no-header --no-footer -o [email protected] [email protected]

clean :
  -rm $(objects)

When I run this, make tells me that there is nothing to be done for all. If I run it for a dedicated user, e.g. make Author1, it also tells me that for Author1 nothing is to be done. Did I do something wrong with the dependencies of the target? I also tried $(results) : bib-%.html and % : bib-%.html, all with the same result.

I think the problem lies in the dependency of the target %(result). I want something like Using make target name in generated prerequisite, but with the complete target name. So I tried % : % : sts-bib-%.html, what results in mixed implicit and static pattern rules.

Where is my mistake?

Upvotes: 1

Views: 71

Answers (1)

Etan Reisner
Etan Reisner

Reputation: 80941

The static pattern rule is

<list of targets> : <pattern to extract stem from target> : <prereqs>

so you need to use:

$(results) : % : bib-%.html

instead of $(results) : [email protected].

Upvotes: 1

Related Questions