[Top][All Lists]

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

Re: .PHONY targets and prerequisite checking

From: Paul D. Smith
Subject: Re: .PHONY targets and prerequisite checking
Date: Thu, 27 Jul 2006 13:42:23 -0400

%% Anoneironaut <address@hidden> writes:

  a> toplevel: main.o $(MODULES) $(MODULE_LIBS) 

  a> .PHONY: $(MODULES) 

  a> how can I avoid setting "foo" and "bar" to be phony?

Assuming "foo" and "bar" are directories, then you can't do this.  Even
if you avoid having them phony it won't work correctly since directory
timestamps are updated when files are added, removed, or renamed.

There are various ways to solve this.  One is to use order-only
prerequisites, like this:

  toplevel: main.o $(MODULE_LIBS) | $(MODULES)

This ensures that the $(MODULES) targets are built before "toplevel",
but that toplevel won't be rebuilt because of them.

See the GNU make manual for more info.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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