0
votes

I have a makefile to create HTML publication lists for different authors out of one BibTex file. The export is done using bibtex2html and works like a charm. But I'm stuck at the rule naming. I want to have the makefile as generic as possible to only adapt the results list when a new colleague starts or someone finishes his PhD.

The workflow is the following:

  1. bib.bib is given
  2. Extract the publications from all authors in results into seperate files: `bib2bib -c 'author : "$*"' bib.bib'
  3. Now there are files for every author, e.g. bib-Author1.bib, bib-Author2.bib, ...
  4. Convert the files to html: bibtex2html -d -r -o [email protected] [email protected]
  5. Now there are file called bib-Author1.html, bib-Author2.html, ....

Here is the current makefile I'm stuck with:

objects = bib-*.bib
results = Author1 Author2

.PHONY : clean cleanall all $(results)
.INTERMEDIATE : bib-*.bib

all : $(results)

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

bib-%.bib :
  TMPDIR=. bib2bib -c 'author : "$*"' bib.bib

bib-%.html : %.html : %.bib
  TMPDIR=. bibtex2html -d -r -o [email protected] [email protected]

#Left the clean and cleanall targets out to shorten the code snippet

Right now I call this makefile with a simple make, which executes the all target. This calls the $(result) target, which calls the bib-%.html target for every author in result. And here comes the problem: When called, make stops with the error mixed implicit and static pattern rules.

What I wanted to do here is take the rule name with the static pattern %.html and have this converted to the prerequisite %.bib. But apparently, I'm doing something wrong. Any help appreciated.

1
Just a hunch: what does make -rR say?reinierpost
You can not have a pattern character (%) in all three parts of a static pattern rule. It is not entirely clear to me what you are trying to achieve with the static pattern rule. Could you expand a bit by giving an example of some filenames you are looking to apply this static rule to?Reinier Torenbeek
@ReinierTorenbeek Thanks for your reply. I have the following workflow: bib.bib is given. Extract the publications of one author from bib.bib with bib2bib -c 'author : "Authorname"' bib.bibinto a file called bib-Authorname.bib. Use this file as input for bibtex2html to have it converted into html using bibtex2html -o bib-Authorname.html bib-Authorname.bibPVitt

1 Answers

3
votes

There are several things that are wrong -- or at least odd -- in this makefile. Your question is not entirely clear, so some guesswork will be necessary.

First, try rules with simple diagnostic commands, in order to get the sequence right. I think this is what you want:

bib-%.bib :
    @echo trying to build $@

bib-%.html : bib-%.bib
    @echo trying to build $@ after $<

Then finish one rule and verify that it does what you want:

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

bib-%.html : bib-%.bib
    @echo trying to build $@ after $<

Then the other. Your use of automatic variables in the html rule is strange, and I suspect that this is closer to what you intend:

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

bib-%.html : bib-%.bib
    TMPDIR=. bibtex2html-1.96-osx-x86_64/bibtex2html -d -r --nodoc --nobibsource --no-header --no-footer -o $@ $<