[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: No rule to make target
From: |
thutt |
Subject: |
Re: No rule to make target |
Date: |
Thu, 29 Mar 2018 11:20:24 -0700 |
Federico Bruni writes:
>
>
> Il giorno gio 29 mar 2018 alle 18:18, address@hidden ha scritto:
> > Federico Bruni writes:
> > >
> > >
> > > Il giorno gio 29 mar 2018 alle 15:56, Paul Smith <address@hidden>
> > ha
> > > scritto:
> > > > On Thu, 2018-03-29 at 14:09 +0200, Federico Bruni wrote:
> > > >> VPATH = \
> > > >> $CURDIR/src
> > > >
> > > > This is wrong. This expands the make variable $C and appends the
> > > > string "URDIR/src". Since C is not set (most likely) you'll get:
> > > >
> > > > VPATH = URDIR/src
> > > >
> > > > which doesn't exist, so this is a no-op.
> > > >
> > > > You meant:
> > > >
> > > > VPATH = $(CURDIR)/src
> > >
> > > Yes, indeed, it's an oversight.
> >
> > Here's one way that VPATH can be used, with your original directory
> > structure. The example is a bit convoluted. A recursive Make
> > invocation is done to make the working directory be the 'out'
> > directory. The VPATH allows the sources to be found in the 'src'
> > directory:
> >
> > export ROOT ?= $(shell pwd)
> > VPATH = $(ROOT)/src
> > MD = $(wildcard $(ROOT)/src/*.md)
> > PDF = $(addsuffix .pdf, $(notdir $(basename $(MD))))
> >
> > %.pdf: %.md
> > echo pandoc -f markdown -o $@ $<; \
> > touch $@;
> >
> > all:
> > $(MAKE) -C $(ROOT)/out -f $(ROOT)/$(lastword
> > $(MAKEFILE_LIST)) book
> >
> > book: $(PDF)
> >
>
> This works, thank you!
>
> I see that here you use pwd because Make enters the out directory, so
> $(CURDIR) is not the best choice.
>
My preference would be to not use 'shell' to set ROOT. I did that
for example purposes. If I was doing this for myself or for my
employer, I would require ROOT to be set before the Makefile was
executed. One concrete reason for being that setting ROOT using
'pwd' will not work properly if one does:
cd /tmp;
make -f ~/source/pdf-project/Makefile
thutt
--
Answering "How do we solve this problem?" should not create more problems.