Dear Bert
Thank you for the pointer!
I read somewhere on Stackoverflow that VPATH may be used for targets as
well.. can't find the link now.
Anyway, I've just tried to apply what I understood from below article,
but I'm still getting the same error.
What I've changed in the Makefile:
- I've added $(addprefix) to include the out/ path in the target file
name
- I've added out/ in the pattern rule, even if I suspect it's not
necessary
- I've removed the full paths in the pandoc command
$ cat Makefile
VPATH = \
$CURDIR/src
.PHONY: all book test
all: book
out/%.pdf: %.md
pandoc -f markdown -o $@ $<;
# Find the PDF files to be built
book: $(addprefix out/, $(addsuffix .pdf, $(notdir $(basename
$(wildcard src/*.md)))))
# Check target list
test:
echo "$(addprefix out/, $(addsuffix .pdf, $(notdir $(basename
$(wildcard src/*.md)))))"
Il giorno gio 29 mar 2018 alle 10:01, Bert Wesarg
<"bert.wesarg"@googlemail.com> ha scritto:
Dear Frederico,
I just read (again) this:
http://make.mad-scientist.net/papers/how-not-to-use-vpath/
you should do this too.
Best,
Bert
On Thu, Mar 29, 2018 at 9:21 AM, Federico Bruni <f...@inventati.org>
wrote:
Hi
I'm having problem with a simple Makefile which uses a pattern rule
to
generate PDF files from markdown files.
What I'm doing wrong?
[makefile-tests]$ tree .
.
|-- Makefile
|-- out
`-- src
|-- bar.md
`-- foo.md
2 directories, 3 files
[makefile-tests]$
[makefile-tests]$ cat Makefile
VPATH = \
$CURDIR/src \
$CURDIR/out
all: book
%.pdf: %.md
pandoc -f markdown -o $(CURDIR)/out/$@ $(CURDIR)/src/$<;
# Find the PDF files to be built
book: $(addsuffix .pdf, $(notdir $(basename $(wildcard src/*.md))))
# Check target list
test:
echo "$(addsuffix .pdf, $(notdir $(basename $(wildcard
src/*.md))))"
[makefile-tests]$
[makefile-tests]$ make
make: *** No rule to make target 'bar.pdf', needed by 'book'. Stop.
[makefile-tests]$
_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make
_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make