help-make
[Top][All Lists]
Advanced

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

Re: Wording in GNU Make manual regarding phony targets


From: Johan Bezem
Subject: Re: Wording in GNU Make manual regarding phony targets
Date: Wed, 21 Dec 2005 22:10:18 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)

Dave Hylands wrote:
Hi Johan,
... and using 'recursive make', I use the same FORCE target to enforce 
recursion like in:

.PHONY: FORCE $(subdirs) clean

clean: FORCE
<tab>{Commands to clean this level...}

Just declaring clean to be PHONY should be sufficient. phony targets
are always rebuilt. There isn't anything wrong with the way you did
it.

Yes, just to execute the 'clean' target that would have been sufficient. But ...

FORCE : $(subdirs)

Is this a typo? I could understand

$(subdirs) : FORCE

but not the other way around.

... I need to execute my recursive make.
I have declared my subdirectory names to be .PHONY targets, so they get 
executed as soon as they are given as targets. But I want them executed on 
targets like 'all' or 'clean'. Now, the $(subdirs) I illustrated in my previous 
post is some simplification, since I use one make-include to produce either 
-just objects -executables -static libraries -dynamic libraries or -nothing 
from the set of sources in every single directory, depending on a 
directory-specific makefile.
 $(subdirs):
 <tab>$(MAKE) --directory=$@ ...
This executes make in the indicated directory/ies (also simplified), and (no 
parallel make here till now, it might present some extra challenges) only 
continues when the directory (-tree) is completely processed.
Because of the simplification, I use the .PHONY target 'FORCE' to "collect" 
everything necessary for recursive descent (depth-first), like $(subdirs) as a simplified 
example, and make every general target dependent on FORCE.
Maybe I could have saved one level of indirection, but it makes my makefile 
more readable at the least.
It works for me, but if you'd find some error or inefficiency, I'd be thankful 
for any hints.

FWIW,

Johan
--
JB Enterprises - Johan Bezem         Tel:   +49 172 5463210
Software Architect - Project Manager Fax:   +49 172 50 5463210
Realtime / Embedded Consultant       Email: address@hidden
Design - Development - Test - QA     Web:   http://www.bezem.de






reply via email to

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