autoconf: Newlines in Make Rules

1 
1 12.12 Newlines in Make Rules
1 ============================
1 
1 In shell scripts, newlines can be used inside string literals.  But in
1 the shell statements of `Makefile' rules, this is not possible: A
1 newline not preceded by a backslash is a separator between shell
1 statements.  Whereas a newline that is preceded by a backslash becomes
1 part of the shell statement according to POSIX, but gets replaced,
1 together with the backslash that precedes it, by a space in GNU `make'
1 3.80 and older.  So, how can a newline be used in a string literal?
1 
1    The trick is to set up a shell variable that contains a newline:
1 
1      nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"
1 
1    For example, in order to create a multiline `sed' expression that
1 inserts a blank line after every line of a file, this code can be used:
1 
1      nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
1      sed -e "s/\$$/\\$${nl}/" < input > output
1