bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: make won't warn me if the other identical target only contains comme


From: Paul D. Smith
Subject: Re: make won't warn me if the other identical target only contains comments
Date: 29 Apr 2002 17:55:39 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

%% address@hidden (Dan Jacobson) writes:

  dj> aa:
  dj> # if there are any other aa's in this Makefile,
  dj> # make will at least mention it, right?

No.  You misunderstand what's going on.

This doesn't define a rule, it merely defines a target.  This can
be extremely useful in a number of situations.

Just like you can say:

  aa: bb cc dd ee ff
  aa: gg hh ii jj
  aa:
        @echo build $@ from $^

Make only cares if there is more than one _command script_ for a given
target; you can define as many independent prerequisite lines as you
like.

  dj> #then way at the bottom of the makefile
  dj> aa:
  dj>   rm everything
  dj> # make won't warn me if the other aa only contains comments.

The _ONLY_ lines in a makefile which can be part of a command script are
those that begin with a TAB character.  Similarly, _EVERY_ line in a
makefile that begins with a TAB, regardless of its content, is a command
script (there is a special exception for variable set lines that begin
with a TAB, necessary--as so many make hacks are--because of broken
Imake setups :-/).

Some people think that the command script lasts up to the first blank
line or something, but that is not true.

So, those comment lines you have in your makefile are simply make
comments, they are not command scripts, and there is no reason for make
to be upset that you've added comments to your makefiles.

Now, if you put a TAB before the comment character, making them into
command script lines, you'd see very different behavior...

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