[Top][All Lists]

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

Re: Space after continuation char "\ " causes "commands commence before

From: Paul D. Smith
Subject: Re: Space after continuation char "\ " causes "commands commence before first target" error
Date: Thu, 8 Mar 2001 07:24:27 -0500

%% Stephen McInerney <address@hidden> writes:

  sm> Hi Paul,

  sm> [Yes I was thinking you code warriors could do without an example...]

  sm> How's this:

  sm> make fails ambiguously if the Makefile has non-tab whitespace after a
  sm> multiline variable definition that gets expanded to the target of a
  sm> rule:

  >> Sorry, I can't parse that (I just got back from vacation and my brain is
  >> not yet working again).  Can you send an example?

  sm> MULTILINE_TARGET  = foo   \
  sm>                   bar     \*** any non-tab whitespace here causes problem 
  sm>                   baz

Ah.  What you mean is, make doesn't accept a backslash line continuation
if there's whitespace after the backslash.

That's correct; the GNU make manual makes clear that the line
continuation is the combination of the two characters backslash and
newline right next to each other.  In your example the whitespace after
the backslash means that that is _NOT_ a line continuation character.
This means that the next line (containing " baz") is not a continuation
of the previous one, but rather an entirely new line... and that line is
a syntax error as it makes no sense.

Note that the type of whitespace does not (should not) matter.  It could
be spaces, tabs, whatever.

You should get an editor which can be configured to automatically remove
trailing whitespace, such as Emacs, then you won't have this problem.

  sm> Makefile:12: *** commands commence before first target.  Stop.
  sm> (The error number varies between 12,13,14 or even 28 (tabstop) error)

  sm> It should pinpoint the error (with line number).

  >> Umm... the "12" is not an error number, it's a line number in the
  >> makefile where make detected the error.

  sm> Ahh! I don't think this is adequately documented.
  sm> Would it be possible to change to the more intuitive standard syntax:
  sm>   [Makefile,12]: *** ...

Heh.  "Intuitive standard syntax" to whom? :)  On what platform are you

That doesn't look intuitive to me (or, at any rate, not moreso than the
syntax make is using), and it's _certainly_ not standard.  The syntax
used by all GNU tools, including the C compiler, etc. for errors and
warnings is "<filename>:<lineno>:".

Also, if you examine the GNU make manual section on error messages
you'll see that this format is described, although there is no explicit

 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]