Makes sense. Thanks ..

From: John Graham-Cumming <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: sharan basappa <[EMAIL PROTECTED]>
CC: [email protected]
Subject: Re: trouble cleaning the right files ..
Date: Mon, 18 Jun 2007 13:30:13 +0200

-----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-----

_________________________________________________________________
Voice your questions and our experts will answer them http://content.msn.co.in/Lifestyle/AskExpert/Default01.htm



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to