parsing commands in a makefile

John Clyne clyne at redcloud.ucar.edu
Sat Oct 21 10:43:43 AEST 1989


Sorry if this has been beat to death before, but here goes anyway. 
I have a makefile that I want to use a sed command as a rule. I need to 
do an sed append. The syntax for this with sed is something like:

	% sed -e "/patten/a\
	text to append" < in_file > out_file

The newline after the 'a' must be passed to sed. On the shell command line 
this is easy. You just escape the newline with a '\'. The problem is 
in a makefile all rules must be contained on a single line. If you try
something like the following in a makefile:

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?

thanks much - jc


 
	John Clyne 	(clyne at ncar.ucar.edu)
	c/o
	National Center for Atmospheric Research
	P.O. Box 3000
	Boulder, Colorado 80307
	(303) 497-1236

	
		%%% Its a small world. But I wouldn't want to paint it %%%
						S. Wright
		%%%						       %%%



More information about the Comp.unix.questions mailing list