bug-make
[Top][All Lists]
Advanced

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

Re: Make phony target problem.


From: Erwin Waterlander
Subject: Re: Make phony target problem.
Date: Mon, 10 Jan 2005 09:09:30 +0100
User-agent: Mozilla Thunderbird 0.9 (Windows/20041103)

Paul D. Smith wrote:
%% Erwin Waterlander <address@hidden> writes:

  ew> I tried a very simple example from the GNU make manual section 4.6
  ew> about phony targets. It does not seem to work as described. The
  ew> targets are not remade when I run make a second time. See
  ew> attachement.

You've only declared the target "all" to be phony.  So only "all" itself
will be remade every time.

Targets that all depends on, like prog1 and prog2, are not declared
phony so they use make's normal build avoidance rules and are not built
unless they're deemed out of date.

  
Hi,

Then the manual is wrong. My example is exactly like the example in section 4.6. See:
http://www.gnu.org/software/make/manual/html_chapter/make_4.html#SEC41

Here I quote the manual:

``

Phony targets can have prerequisites. When one directory contains multiple programs, it is most convenient to describe all of the programs in one makefile `./Makefile'. Since the target remade by default will be the first one in the makefile, it is common to make this a phony target named `all' and give it, as prerequisites, all the individual programs. For example:

 
all : prog1 prog2 prog3
.PHONY : all

prog1 : prog1.o utils.o
        cc -o prog1 prog1.o utils.o

prog2 : prog2.o
        cc -o prog2 prog2.o

prog3 : prog3.o sort.o utils.o
        cc -o prog3 prog3.o sort.o utils.o
      

Now you can say just `make' to remake all three programs, or specify as arguments the ones to remake (as in `make prog1 prog3').

''
-- 
Erwin Waterlander   address@hidden   Building WDB 160
Philips Research Laboratories        Silicon Hive   Prof. Holstlaan  4
+31-40-27 45371 fax: 38869 seri: address@hidden   5656 AA  Eindhoven
www: http://www.siliconhive.com/                    The Netherlands

reply via email to

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