[Top][All Lists]

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

Re: how to create a single rule to build a directory as necessary

From: Derek Clegg
Subject: Re: how to create a single rule to build a directory as necessary
Date: Tue, 22 Sep 2009 11:29:26 -0700

I always use order-only prerequisites for directories. For example,

bar/foo.o: foo.c | bar
        cc -o $@ -c $<

        mkdir -p $@

Works for me.

On Sep 22, 2009, at 11:17 AM, Kristof Provost wrote:

On 2009-09-22 11:44:21 (-0400), Sam Steingold <address@hidden> wrote:
Kristof Provost wrote:
[Dead links]
Hmm, it looks like CM crossroads reworked their website.
You can now find the 'Ask Mr. Make' column here:

I, too, am struggling with rebuilding a directory.
it appears that the rule:

gllib: config.status
        mkdir -p gllib; cd gllib; make

is wrong because the script "mkdir ..." is always executed, regardless of
whether config.status has changed or not.
So, what is the right way to handle this?

I can't really tell why the gllib rule is always executed. If the
config.status file is older than the gllib directory it shouldn't be.
The '$?' variable might help you debug this problem. It contains the names of all
the prerequisites that are newer than the target.


Help-make mailing list

reply via email to

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