Make and '#'

Glenn S. Fowler gsf at ulysses.att.com
Fri May 10 22:15:12 AEST 1991


In article <7729 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
>>FCFLAGS = ... -W0,-inline,\#,-type ...
>>works in SunOS
>Works in SunOS 4.x, and in pre-4.x SunOS with the "SunPro make", anyway.

in short -- how to get '\n' and '#' in (old) make actions
some fun
the following shell script works for some of the v7 makes and sunos4.0
$(sharp) expands to # and $(newline) expands to newline
you can then use $(newline) for actions with here documents and case statements
this is implementation dependent and non-portable since it takes advantage of
different cmd line vs. makefile assignment parsing

----- mymake ----
#!/bin/sh
/bin/make "$@" null='' sharp='$(null)#' newline='$(null)
'

----- here.mk -----
here :
	cat <<!$(newline)\
	$(sharp)hello world$(newline)\
	!

----- try it -----
$ omake -f here.mk
cat <<!\
 hello world\
!
cat: hello: No such file or directory
cat: world!: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `here'
$ omake -n -f here.mk null='' sharp='$(null)#' newline='$(null)
'
cat <<!
\
# hello world
\
!
# hello world

Glenn Fowler    (908)-582-2195    AT&T Bell Laboratories, Murray Hill, NJ
uucp: {att,ucbvax}!ulysses!gsf              internet: gsf at ulysses.att.com



More information about the Comp.unix.questions mailing list