help-make
[Top][All Lists]
Advanced

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

Using .PHONY to suppress rebuilds of included makefile fragments


From: J.T. Conklin
Subject: Using .PHONY to suppress rebuilds of included makefile fragments
Date: Tue, 25 May 2010 13:35:47 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, berkeley-unix)

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.

Thanks in advance,

     --jtc

-- 
J.T. Conklin



reply via email to

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