[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Prerequisites in subdirectories
From: |
Philip Guenther |
Subject: |
Re: Prerequisites in subdirectories |
Date: |
Wed, 21 Aug 2013 02:50:49 -0700 |
On Tue, Aug 20, 2013 at 6:05 PM, Ahmet Gökçe <address@hidden> wrote:
> I use some tools which create outputs on subdirectories. If I want to use
> the created files in subsequent rules, I must run make for the second time
> that these prerequisites can be found.
>
> Example:
> second: first
> @ls $<
>
> first: | dir
> @touch dir/$@
>
To quote http://make.paulandlesley.org/rules.html
Every non-.PHONY rule must update a file with the exact name of its
target.
Make sure every command script touches the file "$@"-- not "../$@", or
"$(notdir $@)", but
exactly address@hidden That way you and GNU make always agree.
That rule in your makefile violates the above guidance and the odd results
you're experiencing are *exactly* caused by it. Go read that page, as well
as http://make.paulandlesley.org/vpath.html for thoughts on how to solve
your overall problem.
Philip Guenther