help-make
[Top][All Lists]
Advanced

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

Re: trouble cleaning the right files ..


From: John Graham-Cumming
Subject: Re: trouble cleaning the right files ..
Date: Mon, 18 Jun 2007 13:30:13 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

sharan basappa wrote:
> Each module make appends its clean target to clean variable as :
> clean     += clean_dir1 .. so eventually clean_all looks like
> clean_all : clean_dir1 clean_dir2
> 
> clean_dir1 (for example) rule is :
> 
> clean_dir1 :
>        \rm $(local_objs)

Here's how I'd handle that:

1. I'd drop the 'clean' variable completely.

2. When I'm defining clean_dir1 I'd add

    clean: clean_dir1

So that whenever the clean target is requested clean_dir1 is run.

3. To handle grabbing of local_objs you can either do a target-specific
variable as Phillip has suggested, or you could grab the state of
local_objs using a := and save it:

    clean_dir1_local_objs := $(local_objs)
    clean_dir1: ; rm $(clean_dir1_local_objs)

4. You can dispense with the clean_dir1 targets completely by using a ::
rule for clean.  Each Makefile could just have the following that grabs
the local_objs variable and adds commands to the clean target.

    clean_dir1_local_objs := $(local_objs)
    clean:: ; rm $(clean_dir1_local_objs)

John.



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGdmzELphrp73n/hARAtgdAJ40QmXPjaGns7aT6zDs3XM8Z3XrpwCg2kMd
FKbsK8ItoUuvedBxuqrCs2I=
=sM17
-----END PGP SIGNATURE-----




reply via email to

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