bug-make
[Top][All Lists]
Advanced

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

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


From: Stephen McInerney
Subject: Re: Space after continuation char "\ " causes "commands commence before first target" error
Date: Thu, 08 Mar 2001 10:40:00 -0800

"Paul D. Smith" wrote:
> 
>   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:
> 
>   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.

Paul -

the point of my query was not 'why is this so'? but 'why is the error
message so vague?' How about 'trailing whitespace on line <nn> invalid
after the '\' continuation character'
I honestly recommend it - would sace lots of headscratching.

> 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
> running?

Just a common practice with UNIX HW CAD tools, linters, Verilog.
"12" looks like the error number to me and many other people.

If you look at DejaNews you will see half the known universe wrongly
believes this too :)

> 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
> example.

I guess we need an example then?

Thanks
Stephen



reply via email to

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