somenxavier
somenxavier

Reputation: 1567

Make ignores existing rule

I have this simply GNU Make file:

# Bibliografia
BIBLIO = referencies/biblio.bib
CSL = referencies/acm-mod.csl
TMPATOM = plantilles/entorn.pandoc.atom.html

# Variables
PANDOC_MD_ATOM = pandoc --webtex --smart --from=markdown+auto_identifiers+table_captions+simple_tables+pipe_tables+strikeout+tex_math_dollars+raw_html+footnotes+inline_notes+citations+implicit_figures --to=html5 --bibliography=$(BIBLIO) --csl=$(CSL) --filter pandoc-citeproc --metadata link-citations=true --template=$(TMPATOM)

ERB = erb -T 1

# Què processar
MARKDOWN_YAML_ATOM=$(shell ruby ./select.rb 'atom')
MARKDOWN_ATOM=$(MARKDOWN_YAML_ATOM:.md=.md.atom.html)

all: $(MARKDOWN_ATOM)

%.md.atom.html: %.md %.md.meta $(TMPATOM)
    $(ERB) $< | $(PANDOC_MD_ATOM) -V filename=$< $<.meta -o $@

When I run make I get the following error:

make: *** No rule to make target 'blog/Aitor-theorem.md.atom.html', needed by 'all'.  Stop

but clearly it is a rule for files .md.atom.html.

Upvotes: 0

Views: 247

Answers (1)

MadScientist
MadScientist

Reputation: 101081

When make wants to build a target blog/Aitor-theorem.md.atom.html and there's no explicit rule for that, it will look for a rule to match that target.

When it looks at your pattern rule it will match with a stem (the part that matches the %) of Aitor-theorem and a directory prefix of blog/. So, when it constructs the patterns for the prerequisites it will use those same values for the stem and directory; that is, make will check to see if the targets blog/Aitor-theorem.md and blog/Aitor-theorem.md.meta (and of course plantilles/entorn.pandoc.atom.html) either already exist or can be made by using other pattern rules.

The error you're seeing means that make couldn't figure out how to build one or more of those prerequisites. When that happens, make can't use this pattern rule (it doesn't match) so it will go looking for a different pattern rule to use. If there is no other pattern rule, then it will give this error "No rule to make target", because there is no matching rule.

Since you haven't told us what the actual files you have available and expect to be used are named, we can't advise you further.

You can run make -d to see a complete trace of all the steps make invokes to try to build your target (there's a lot of output so redirect it to a file or something).

Upvotes: 1

Related Questions