help-make
[Top][All Lists]
Advanced

[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: Sam Steingold
Subject: Re: how to create a single rule to build a directory as necessary
Date: Tue, 22 Sep 2009 18:20:49 -0400
User-agent: Thunderbird 2.0.0.22 (X11/20090625)

Paul Smith wrote:
On Tue, 2009-09-22 at 13:19 -0400, Sam Steingold wrote:

Do I need to explicitly type

gllib/foo gllib/bar : config.status
        mkdir -p gllib; cd gllib; make

You still have to consider prerequisites.  Is it true that the one and
only reason gllib/foo or gllib/bar might need to be rebuilt is because
of a change to config.status?

OK, you got me.

what I _actually_ really need is this:
if config.status is newer, gllib should be removed and rebuilt from scratch.
otherwise the usual PHONY/cd+make is good enough.

so,
I have this:
---------------------------------------------------
.PHONY : gllib

gllib:
        mkdir -p $@
        if test ! -f $@/Makefile; then sh config.status $@/Makefile depfiles; fi
        cd $@ && $(MAKE) CFLAGS="$(SUBDIR_CFLAGS)"
---------------------------------------------------
alas, when config.status has been changed, gllib must be removed before make will do its job properly.

so, what should I do?

one thing that just occurred to me - maybe I should modify the config.status rule to read:

config.status : configure
        $(RM) config.cache
 >new>    rm -rf gllib
        sh config.status --recheck

does this look right?





reply via email to

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