help-make
[Top][All Lists]
Advanced

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

Re: Dependency checked for existance but not timestamp


From: John Graham-Cumming
Subject: Re: Dependency checked for existance but not timestamp
Date: Fri, 04 Feb 2005 16:02:42 -0500

On Fri, 2005-02-04 at 15:22, Torc Online wrote:
> =================================================
> all: testdir/testfile
>        @echo Done
> 
> # Any file not covered by other rules is just copied.
> %: $(@F)
>        @mkdir -p $(@D)
>        cp -f $(@f) $@

Problems:

1. $(@F) expands to an empty string in the rule that you are defining
because $(@F) is invalid in the prerequisite list.   What you want is
$$(@F).

2. In the rule body you have a $(@f) in the cp command, that needs to be
$(@F): note that capital F.

3: Your match-anything rule is using a single-colon which means it is
non-terminal and hence GNU Make may spend a lot of time searching for
ways to make its prerequisite.  Would be better to use a double-colon so
that GNU Make doesn't have to search for how to make $$(@F).

4. Even if you change to $$(@F) it doesn't do what you want because
$$(@F) is going to be the filename of % which isn't what you mean.

So you really need to rewrite this completely.  I think the best way is
going to be something like this:

    all: testdir/testfile
        @echo Done

    testdir/%: %
        @mkdir -p $(@D)
        cp -f $< $@

Of course that does meant that you are going to need to have a rule for
each subdirectory.

John.
-- 
John Graham-Cumming

Home: http://www.jgc.org/
Work: http://www.electric-cloud.com/
POPFile: http://getpopfile.org/






reply via email to

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