Update: GNU Make 3.81, Ubuntu 12.04
I have a set of markdown files that I want to compile to (say) html files, so this is my rule:
%.html: %.md
pandoc $< -o $@
So make foo.html
would convert foo.md
into foo.html
.
However, there are spaces in the source markdown filenames and I do not have the ability to control these, that is I can't change a setting to remove the spaces.
This means if I make foo\ bar.html
, I get
make: *** No rule to make target `foo bar.html'. Stop.
How can I write a generic rule %.html: %.md
where the prerequisite filename has spaces?
I can get around it by using:
foo\ bar.html: foo\ bar.md
pandoc $< -o $@
But then I must manually write out this rule for every such source file that I have, when I'd rather use the %
construct. Is my only hope to do some sort of $(foreach f,$(get list of *.md files),$(eval $(call function_to_generate_rule)))
?
%.html: %.md
markdown $< > $@
, I cannot get themake
error about not finding the target. Which version of make are you using? – binkimake
to do inference properly, the source filefoo bar.md
has to either exist or be something thatmake
knows how to build, right? – binkifoo bar.md
does exist. GNU make 3.81. I can reproduce this. – mathematical.coffee