Next: , Previous: , Up: Portable Make   [Contents][Index]

12.4 Backslash-Newline Before Empty Lines

A bug in Bash 2.03 can cause problems if a Make rule contains a backslash-newline followed by line that expands to nothing. For example, on Solaris 8:

SHELL = /bin/bash
	touch foo \


/bin/bash -c 'touch foo \

which fails with a syntax error, due to the Bash bug. To avoid this problem, avoid nullable macros in the last line of a multi-line command.

On some versions of HP-UX, make reads multiple newlines following a backslash, continuing to the next non-empty line. For example,

FOO = one \

BAR = two

        : FOO is "$(FOO)"
        : BAR is "$(BAR)"

shows FOO equal to one BAR = two. Other implementations sensibly let a backslash continue only to the immediately following line.