parsing commands in a makefile

Maarten Litmaath maart at cs.vu.nl
Sat Oct 21 16:33:41 AEST 1989


clyne at redcloud.ucar.edu (John Clyne) writes:
\...
\target:
\	sed -e "/pattern/a\
\	text to append" < in_file > out_file
\
\What sed gets passed is "/pattern/atext to append" Is there any way around 
\this? i.e how can I pass a new line to a command that is part of a make rule?

Why don't you put the sed script into a file of its own?

	target:
		sed -f script.sed < in_file > out_file

Else you could set an environment variable, to be used in the Makefile:

	$ NL='
	'
	$ export NL
	$ cat Makefile
	SHELL	= /bin/sh
	target:
		sed -e '/pattern/a\$(NL)text to append' ...
	$
-- 
A symbolic link is a POINTER to a file, | Maarten Litmaath @ VU Amsterdam:
 a hard link is the file system's GOTO. | maart at cs.vu.nl, mcsun!botter!maart



More information about the Comp.unix.questions mailing list