help-make
[Top][All Lists]
Advanced

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

Re: Using .PHONY to suppress rebuilds of included makefile fragments


From: Greg Chicares
Subject: Re: Using .PHONY to suppress rebuilds of included makefile fragments
Date: Tue, 25 May 2010 21:49:44 +0000
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

On 2010-05-25 20:35Z, J.T. Conklin wrote:
> A co-worker started adding .PHONY: targets for each included makefile
> fragment.  For example, changing:
> 
>    include Foo.mk
> 
> to:
> 
>    .PHONY: Foo.mk
>    include Foo.mk
> 
> arguing that this suppresses gmake from attempting to regenerate
> Foo.mk using dozens of implicit rules, and therefore improving
> performance.
> 
> I've never seen .PHONY used in this way, but from the gmake -d output
> I see it indeed does what he claims.  Are there any reason why not to
> use .PHONY this way?  Is there a better idiom to use to avoid rebuilds
> of Makefile fragments.

I feel a little squeamish about that because the 'make' manual says:
  "A phony target is one that is not really the name of a file."
but 'Foo.mk' really is the name of a file. Here's how I do it:

include $(src_dir)/whatever.make
$(src_dir)/whatever.make:: ;

and the rationale is in this message:

http://lists.gnu.org/archive/html/help-make/2006-03/msg00008.html



reply via email to

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