Using wildcard in GNU Make pattern rule

The GNU Make function wildcard takes a shell globbing pattern and expands it to the files matching that pattern. The pattern %.refer does not contain any shell globbing patterns.

You probably want something like

%.pdf: %.mom %.refer
        pdfmom -e -k < $< > $@

%.pdf: %.mom
        pdfmom -e -k < $< > $@

The first target will be invoked for making PDF files when there's a .mom and a .refer file available for the base name of the document. The second target will be invoked when there isn't a .refer file available.

The order of these targets is important.

Tags:

Gnu Make

Make