Trailing backslashes in Makefile

Alexandre Oliva oliva at
Thu Dec 3 15:05:56 GMT 1998

On Dec  3, 1998, "Michael H. Warfield" <mhw at> wrote:

> Alexandre Oliva enscribed thusly:

>> The problem is when a line ended with a backslash is followed by a
>> blank line.  This breaks various make programs :-(

> 	The problem there is that the blank line becomes part of the
> "continued" line (the \) and you are then no longer left with the
> prerequisit blank separator line between it and the next...

Huh?  IMO, there's nothing wrong with the following Makefile snippet,
but various make programs disagree:

FOO = whatever \

# note the blank lines above
BAR = something else

Broken makes will just go berzerk when presented a Makefile containing
a trailing backslash followed by a blank line, no matter how many
blank lines you have.  They will end up printing random error messages 
in unrelated lines.  This kind of Makefile program is very annoying
and hard to find :-(

> I'm actually surprised that gnu make accepts this since it implies
> that either they have 1) special case code for a continuation line
> followed by a terminating blank line

Although it's unrelated with the bug we were discussing, there's no
requirement that a set of commands is followed by a blank line.  The
sequence of commands can be broken by a line containing another
dependency, as long as it does not start with a TAB.

Alexandre Oliva  aoliva@{}
Universidade Estadual de Campinas, SP, Brasil

More information about the samba-technical mailing list