help-make
[Top][All Lists]
Advanced

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

Re: 2-part question involving empty commands and double-colon rules


From: Paul D. Smith
Subject: Re: 2-part question involving empty commands and double-colon rules
Date: Wed, 16 Jun 2004 01:22:08 -0400

%% "Robert P. J. Day" <address@hidden> writes:

  rpjd> target: ;

  rpjd> if "target" is *not* the name of a file but just the name of an action
  rpjd> of some kind, then one might just as well use .PHONY.

Yes.

  rpjd> and what would it mean if "target" *was* the name of a file?
  rpjd> with no pre-reqs and no command, what would this mean, if
  rpjd> anything?  what processing could it possibly do?

None.  But as the manual says, it keeps make from trying to match it
with an implicit rule.  That implicit rule search takes some amount of
processing, after all.

  rpjd> and for part two, related to my earlier posting, there is a makefile 
  rpjd> "main.mk" that is expected to be included by just about every other 
  rpjd> makefile in my project.  as it was handed to me, this main.mk file 
  rpjd> contains in it the following two lines:

  rpjd> makefile : ;
  rpjd> %.mk:: ;

  rpjd> i'm not sure what the value of these two rules are.

As above.  They keep the makefiles from being matched via implicit rule
search.  Remember make tries to rebuild all its makefiles first (see the
section "How Makefiles are Remade" in the GNU make manual).  The above
rules tell make to not bother.

You can see the difference by enabling debugging: try it first with
those lines commented out, then uncomment them and run it again.  Notice
all the up-front processing make does on your makefiles before it ever
starts on your normal targets.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]