help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: auto-dep cannot possibly work?


From: David Boyce
Subject: Re: auto-dep cannot possibly work?
Date: Sun, 15 Nov 2009 08:24:50 -0500

On Sat, Nov 14, 2009 at 11:48 PM, Mark Galeck (CW) <address@hidden> wrote:
>
>>I think your conclusions are a little strong here.
>
> Well yes, I am a perfectionist :)  if a tool has a bug, even the smallest 
> one, that cannot be fixed withing the realm of that tool, then I say it is a 
> flawed tool.

I've been surprised that nobody has mentioned the straightforward and
elegant solution, and figured there must be something wrong with it.
But I just gave it a little try and it seems to work as expected:

.PHONY: all clean

all: foo

CFLAGS := -O2 -g -Dfoo -Dbar -Iinc1 -Iinc2 -W -Wall

incdeps := $(patsubst -I%,%,$(filter -I%,$(CFLAGS)))

foo: $(incdeps)
        @echo remaking $@ because of $? in "'$(incdeps)'"
        touch $@

clean: ; rm foo

In other words, generate an additional dependency on the DIRECTORIES
in the search path. This works exactly as desired (I think): it
triggers a rebuild whenever a file is added to or deleted from a
directory on the path, but does nothing when the existing files are
modified. Try "touch inc2/foo" for instance.

-David Boyce




reply via email to

[Prev in Thread] Current Thread [Next in Thread]