[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Makefile and VPATH
From: |
Paul Smith |
Subject: |
Re: Makefile and VPATH |
Date: |
Sun, 25 Jan 2015 23:19:32 -0500 |
On Mon, 2015-01-26 at 04:15 +0100, Odne Helleb� wrote:
> I've narrowed my problem down to this makefile:
>
> VPATH = folder
> > all : test
> >
> > test : foo
> > echo $<
> >
> > foo :
> > touch folder/foo
> >
> (with formatting here http://sprunge.us/ifWI )
> doing make twice will echo foo and then folder/foo, but I was hoping that
> it would be possible to get make to expand rule 3 first so that rule 2
> always give folder/foo
That's not how VPATH works. How should make guess that this is what you
want to happen?
It turns out that VPATH is only useful for finding _source files_ (that
is, files that exist before make starts), not files that are created by
make as the result of running rules.
It might be helpful to read this:
http://make.mad-scientist.net/papers/how-not-to-use-vpath/