[comp.unix.questions] Make and '#'

jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) (05/08/91)

In a Makefile I need to define a Makro to a string containing the '#'-sign,
which is the comment-sign for make:
FCFLAGS = ... -W0,-inline,#,-type ...

Since '#' is the comment-sign, the '#' and all following stuff is suppressed
by make. I tried everything I know about quoting (on shell-level), nothing 
worked. Is there any way to put '#' into my macro? (If of interest, I'm
using Apollo Domain/OS 10.3)

Thanks,
	Lutz Jaenicke
--
Lutz Jaenicke 				jaenicke@w414zrz.ee.tu-berlin.de 
Institut fuer Elektrische Maschinen	jaenicke@emapollo.ee.tu-berlin.de
Technische Universitaet Berlin		Tel. (004930)314-24552
Einsteinufer 11, D-1000 Berlin 10 	Fax. (004930)314-21133 

weimer@garden.ssd.kodak.com (Gary Weimer (253-7796)) (05/08/91)

In article <470@mailgzrz.tu-berlin.de>,
jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) writes:
|> 
|> In a Makefile I need to define a Makro to a string containing the '#'-sign,
|> which is the comment-sign for make:
|> FCFLAGS = ... -W0,-inline,#,-type ...
|> 
|> Since '#' is the comment-sign, the '#' and all following stuff is suppressed
|> by make. I tried everything I know about quoting (on shell-level), nothing 
|> worked. Is there any way to put '#' into my macro? (If of interest, I'm
|> using Apollo Domain/OS 10.3)

FCFLAGS = ... -W0,-inline,\#,-type ...

works in SunOS

weimer@ssd.kodak.com ( Gary Weimer )

jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) (05/08/91)

In article <1991May7.202818.10562@ssd.kodak.com> weimer@ssd.kodak.com writes:
>In article <470@mailgzrz.tu-berlin.de>,
>jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) writes:
>|> 
>|> In a Makefile I need to define a Makro:
>|> FCFLAGS = ... -W0,-inline,#,-type ...
>|> (I'm using Apollo Domain/OS 10.3)
>
>FCFLAGS = ... -W0,-inline,\#,-type ...
>works in SunOS

I've tried before I posted, doesn't work on my Apollo :-(
(BTW, your hint is right, I tested it on a SUN)

Nevertheless thank you for your hint and I'll stay waiting new ideas
	Lutz Jaenicke
--
Lutz Jaenicke 				jaenicke@w414zrz.ee.tu-berlin.de 
Institut fuer Elektrische Maschinen	jaenicke@emapollo.ee.tu-berlin.de
Technische Universitaet Berlin		Tel. (004930)314-24552
Einsteinufer 11, D-1000 Berlin 10 	Fax. (004930)314-21133 

darcy@druid.uucp (D'Arcy J.M. Cain) (05/08/91)

In article <472@mailgzrz.tu-berlin.de> Lutz Jaenicke writes:
>In article <1991May7.202818.10562@ssd.kodak.com> weimer@ssd.kodak.com writes:
>>FCFLAGS = ... -W0,-inline,\#,-type ...
>I've tried before I posted, doesn't work on my Apollo :-(

Is it possible the problem is further down?  I tried:

TEST = 1 2 3 \# 4 5 6
test:
	echo $(TEST)

which ran the command:
	echo 1 2 3 # 4 5 6

Which displayed:
1 2 3

However the following:
TEST = 1 2 3 \\\# 4 5 6
test:
	echo $(TEST)

which ran the command:
	echo 1 2 3 \# 4 5 6

displayed:
1 2 3 # 4 5 6

Perhaps this is what you need.

With a name like mine you learn about quoting.  :-)

-- 
D'Arcy J.M. Cain (darcy@druid)     |
D'Arcy Cain Consulting             |   There's no government
Toronto, Ontario, Canada           |   like no government!
+1 416 424 2871                    |

hnridder@cs.ruu.nl (Ernst de Ridder) (05/08/91)

In <470@mailgzrz.tu-berlin.de> jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) writes:


>In a Makefile I need to define a Makro to a string containing the '#'-sign,
>which is the comment-sign for make:
>FCFLAGS = ... -W0,-inline,#,-type ...
>
>Since '#' is the comment-sign, the '#' and all following stuff is suppressed
If in a makefile: "FCFLAGS = ... -W0,-inline,\#,-type ..." should work

>by make. I tried everything I know about quoting (on shell-level), nothing 
In a shell, try: "FCFLAGS = ... -W0,-inline,\\\#,-type ..."
(This ends up in the environment as ....\#....)

Hope to have helped,
	Ernst
-- 
popa
iret

Qualitas qualitatem inducit.  Semper ego qualitatem.
-------------------------------------------------------------------------------
Ernst de Ridder                     (student) | Email: hnridder@cs.ruu.nl
Dept. of Computer Science, Utrecht University | Fido: Ernst de.Ridder
UUCP: !mcsun!hp4nl!ruuinf!praxis!hnridder     |       2:284/203.6
-------------------------------------------------------------------------------

-- 
popa
iret

Qualitas qualitatem inducit.  Semper ego qualitatem.

jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) (05/09/91)

In article <1991May08.142055.12744@cs.ruu.nl> hnridder@cs.ruu.nl (Ernst de Ridder) writes:
>>In a Makefile I need to define a Makro to a string containing the '#'-sign,
>>which is the comment-sign for make:
>>FCFLAGS = ... -W0,-inline,#,-type ...
>>
>If in a makefile: "FCFLAGS = ... -W0,-inline,\#,-type ..." should work
Sorry, it doesn't (at least not for Apollo Domain/OS 10.3). The thing I get
is a macro named "FCFLAGS (you're right, the " is included into the
macro's name), but the # is truncated again.

	Lutz Jaenicke
--
Lutz Jaenicke 				jaenicke@w414zrz.ee.tu-berlin.de 
Institut fuer Elektrische Maschinen	jaenicke@emapollo.ee.tu-berlin.de
Technische Universitaet Berlin		Tel. (004930)314-24552
Einsteinufer 11, D-1000 Berlin 10 	Fax. (004930)314-21133 

ksb@nostromo.cc.purdue.edu (Kevin Braunsdorf) (05/09/91)

I've needed # in shell commands in make before.  I had to use tr(1) to
get them...  here is an example from an old Makefile....

OLDCODE= ${CC} ${CFLAGS} -E $$file |\
	 sed -n -e `echo '/^@/p' |tr "@" "\043"` |\
	 sed -e 's/^.[ 0-9]*"\(.*\)" *$$/\1/' -e '/\/usr\/include/d'


Note that 
	$ echo '/^@/p' | tr "@" "\043"
outputs
	/^#/p

which is the string I need to pass sed -e...  (yes, I know one sed would do).


--
"Anything I could have said I felt, somehow, you already knew..."
kayessbee, Kevin Braunsdorf, ksb@cc.purdue.edu, pur-ee!ksb, purdue!ksb

heiko@uwesa.hanse.de (Heiko Weber jun.) (05/09/91)

jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) writes:


>In a Makefile I need to define a Makro to a string containing the '#'-sign,
>which is the comment-sign for make:
>FCFLAGS = ... -W0,-inline,#,-type ...

>Since '#' is the comment-sign, the '#' and all following stuff is suppressed
>by make. I tried everything I know about quoting (on shell-level), nothing
>worked. Is there any way to put '#' into my macro? (If of interest, I'm
>using Apollo Domain/OS 10.3)

Put '#' into a file (foo.bar in the example), and change the line above to

FOOBAR=`cat foo.bar`
FCFLAGS = ... -W0,-inline,$(FOOBAR),-type ...

on Esix, it works.

Heiko
--
| Heiko Weber jun. | heiko@uwesa.hanse.de | private unix site |
+------------------+----------------------+-------------------+
| D-2151 Sauensiek | Loehe 3 | Germany | voice: 049-4169-1366 |

guy@auspex.auspex.com (Guy Harris) (05/10/91)

>FCFLAGS = ... -W0,-inline,\#,-type ...
>
>works in SunOS

Works in SunOS 4.x, and in pre-4.x SunOS with the "SunPro make", anyway.
In 4.x, "/usr/old/make", which is basically an S5R2-vintage "make",
doesn't handle it, which means AT&T-derived "make"s (the V7-flavored one
in BSD, and the ones in S5, and the ones in most other UNIXes) probably
don't handle it, but Sun's newer "make" ("remotely from S5", as
the comment on the SCCS header lines in the source says; there's not
much AT&T code left, if any) does.

jeff@onion.rain.com (Jeff Beadles) (05/10/91)

jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) writes:
> 
> In a Makefile I need to define a Makro:
> FCFLAGS = ... -W0,-inline,#,-type ...
> (I'm using Apollo Domain/OS 10.3)

Trash the version of make, and use GNU make.  It works much better than the
Apollo version of make.  Sources should be available wherever fine GNU
software is available.

(If you do decide to use it, please let me know.  There's one bug that I'm
aware of that will drive you nuts! :-)

	-Jeff
-- 
Jeff Beadles		jeff@onion.rain.com

jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) (05/10/91)

In article <1991May8.131613.10640@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes:
>However the following:
>TEST = 1 2 3 \\\# 4 5 6
>test:
>	echo $(TEST)
>which ran the command:
>	echo 1 2 3 \# 4 5 6
>displayed:
>1 2 3 # 4 5 6
Not useable on Apollo: make -p shows, that TEST is truncated to 1 2 3 \\\
before anything usefull is done. The only thing working is Kevin Braunsdorf's
(ksb@nostromo.cc.purdue.edu) `echo "@" | tr "@" "\043"` in his article 
<12073@mentor.cc.purdue.edu>.

Thanks to all who replied.

>With a name like mine you learn about quoting.  :-)
>D'Arcy J.M. Cain (darcy@druid) 
Indeed! BTW, if you want to see my name written correct, use LaTex:
	Lutz J\"anicke
--
Lutz Jaenicke 				jaenicke@w414zrz.ee.tu-berlin.de 
Institut fuer Elektrische Maschinen	jaenicke@emapollo.ee.tu-berlin.de
Technische Universitaet Berlin		Tel. (004930)314-24552
Einsteinufer 11, D-1000 Berlin 10 	Fax. (004930)314-21133 

gsf@ulysses.att.com (Glenn S. Fowler) (05/10/91)

In article <7729@auspex.auspex.com> guy@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@ulysses.att.com

andre@targon.UUCP (Andre van Dalen) (05/14/91)

In article <470@mailgzrz.tu-berlin.de> jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) writes:
  >
  >In a Makefile I need to define a Makro to a string containing the '#'-sign,
  >which is the comment-sign for make:
  >FCFLAGS = ... -W0,-inline,#,-type ...
  >
  >Since '#' is the comment-sign, the '#' and all following stuff is suppressed
  >by make. I tried everything I know about quoting (on shell-level), nothing
  >worked. Is there any way to put '#' into my macro? (If of interest, I'm
  >using Apollo Domain/OS 10.3)

For me works
FCFLAGS=... -W0,-inline,$(H),-type

together with the command line

make H=\# all

-- 
The mail|    AAA         DDDD  It's not the kill, but the thrill of the chase.
demon...|   AA AAvv   vvDD  DD        Ketchup is a vegetable.
hits!.@&|  AAAAAAAvv vvDD  DD                    {nixbur|nixtor}!adalen.via
--more--| AAA   AAAvvvDDDDDD    Andre van Dalen, uunet!hp4nl!targon!andre