Trying to write a simple makefile to compile Markdown files to HTML with Pandoc. I don't want to have to add all the prerequisite .md files explicitly to the makefile, so I've tried to use a pattern rule along with a wildcard prerequisite:
all: www/*.html
www/%.html: src/%.md
pandoc -f markdown -t html $< > $@
This is close, but only processes prerequisite .md files for which an .html target file already exists and is out of date. New .md files which don't already have an .html file get ignored (so if all the non-new files are built, I get make: Nothing to be done for 'all'.)
What's the concept I'm missing? I'm not sure how to tell make to run on both the changed AND new .md files in src/ and apply the pattern rule to each.
*.htmlis being treated as anything that currently matches the pattern, not as a wildcard. I'm not a Makefile expert by any stretch, but you'll probably want to look into variable substitution (something that's always eluded me). Try this to start: gnu.org/software/make/manual/html_node/Substitution-Refs.html - Stephen Newell*.htmlfiles and run, it actually creates a file calledwww/*.htmlout of one of the prerequisites...definitely not treating the wildcard the way I expected. - user574835783