Thread View: comp.bugs.sys5
14 messages
14 total messages
Started by Claus Tondering
Fri, 30 Dec 1988 14:01
make bug
Author: Claus Tondering
Date: Fri, 30 Dec 1988 14:01
Date: Fri, 30 Dec 1988 14:01
29 lines
1013 bytes
1013 bytes
Consider the following makefile: ALPHA = foo BETA = $(ALPHA) bar all: echo $(BETA) Running make with this makefile will result in the execution of the command "echo foo bar", which is OK. Now, consider the following makefile: ALPHA = foo BETA = $(ALPHA) bar all: echo $(BETA:bar=hello) Running make with this makefile will result in the execution of the command "echo $(ALPHA) hello", which is certainly not what I would expect. Why is ALPHA not substituted in the last example? Bug or feature? -- Claus Tondering Dansk Data Elektronik A/S, Herlev, Denmark E-mail: ct@dde.dk or ...!uunet!mcvax!dkuug!dde!ct
Re: make bug
Author: Leo de Wit
Date: Sun, 01 Jan 1989 08:20
Date: Sun, 01 Jan 1989 08:20
21 lines
1088 bytes
1088 bytes
In article <502@Aragorn.dde.uucp> ct@dde.uucp (Claus Tondering) writes:
[first example omitted ...]
|Now, consider the following makefile:
|
|ALPHA = foo
|BETA = $(ALPHA) bar
|
|all:
| echo $(BETA:bar=hello)
|
|Running make with this makefile will result in the execution of the
|command "echo $(ALPHA) hello", which is certainly not what I would
|expect.
|
|Why is ALPHA not substituted in the last example? Bug or feature?
What would you expect? "$(BETA:bar=hello)" is certainly not Make syntax.
Make doesn't know about sh or csh variable substitution, if that was
your intention.
Leo.
Re: make bug
Author: Stephen J. Friedl
Date: Mon, 02 Jan 1989 05:03
Date: Mon, 02 Jan 1989 05:03
20 lines
1073 bytes
1073 bytes
In article <904@philmds.UUCP>, leo@philmds.UUCP (Leo de Wit) writes:
> What would you expect? "$(BETA:bar=hello)" is certainly not Make syntax.
> Make doesn't know about sh or csh variable substitution, if that was
> your intention.
New versions of make (augmake?) *do* allow this kind of
substitution. You can do:
SRC = $(OBJS:.o=.c)
and it effectively does 's/\.o/.c/g' on each word in ${OBJS}.
It's very handy...
Steve
--
Stephen J. Friedl 3B2-kind-of-guy friedl@vsi.com
V-Systems, Inc. I speak for me only attmail!vsi!friedl
Santa Ana, CA USA +1 714 545 6442 {backbones}!vsi!friedl
-------Nancy Reagan on Usenix in San Diego: "Just say *go*"-------
Re: make bug
Author: andre
Date: Mon, 02 Jan 1989 10:25
Date: Mon, 02 Jan 1989 10:25
59 lines
2393 bytes
2393 bytes
In article <904@philmds.UUCP> leo@philmds.UUCP (Leo de Wit) writes: }In article <502@Aragorn.dde.uucp> ct@dde.uucp (Claus Tondering) writes: } [first example omitted ...] }|Now, consider the following makefile: }| }|ALPHA = foo }|BETA = $(ALPHA) bar }| }|all: }| echo $(BETA:bar=hello) }| }|Running make with this makefile will result in the execution of the }|command "echo $(ALPHA) hello", which is certainly not what I would }|expect. }| }|Why is ALPHA not substituted in the last example? Bug or feature? }What would you expect? "$(BETA:bar=hello)" is certainly not Make syntax. }Make doesn't know about sh or csh variable substitution, if that was }your intention. > Leo. The $(VAR:foo=bar) notation is perfectly normal make syntax. It means while expanding VAR, substitute foo by bar. This is mostly used as SRC=a.c b.c c.c OBJ=$(SRC:.c=.o) Back to the original question, Yes it is a bug. What I think that happenes is the following. To save space make does not expand variables when they are assinged to one another. When a variable is needed, expansion occurs. The trouble is that when a substitution is detected, further expansion is not checked for as is done for normal expansion. The same problem occurs in the public domain make that was posted a while back. The substitution funstion was not glad with what it had done and left the $VAR occurences that were still in the string. I suspect that the standard make has the same problem. Hope this helps. One thing to ponder, should make be able to handle this? STR=h w HI=hello TEXT=STR H=h HELLO=$HI all: echo $($($TEXT:w=world):$H=$HELLO) And the result of this is: echo :h=hELLO) -- ~----~ |m AAA DDDD It's not the kill, but the thrill of the chase. ~|d1|~@-- AA AAvv vvDD DD Segment registers are for worms. ~----~ & AAAAAAAvv vvDD DD ~~~~~~ -- AAA AAAvvvDDDDDD Andre van Dalen, uunet!mcvax!targon!andre
Re: make bug
Author: Chris Torek
Date: Mon, 02 Jan 1989 23:51
Date: Mon, 02 Jan 1989 23:51
48 lines
1822 bytes
1822 bytes
In article <987@vsi.COM> friedl@vsi.COM (Stephen J. Friedl) writes:
> New versions of make (augmake?) *do* allow this kind of
>substitution. You can do:
>
>SRC = $(OBJS:.o=.c)
>
>and it effectively does 's/\.o/.c/g' on each word in ${OBJS}.
>
> It's very handy...
Indeed. Since 4BSD still has a boring old make, I use a script
wrapped around `sed' to do the job:
OBJS= ...
SRCS= `chgsuf .o .c` ${OBJS}
lint: ${SRCS}
lint ${LINTFL} ${SRCS}
The addsuf and chgsuf scripts (in /usr/local/bin) are trivial.
(Note that these break if the new suffix contains an `&'. Sorry :-) )
#! /bin/sh
#
# addsuf - add suffix to each argument
# assumes no embedded spaces in arguments
case $# in 0) echo "usage: addsuf suffix files" 1>&2; exit 1;; esac
suf="$1"
shift
echo ${1+"$@"} | sed -e "s/ /$suf /g" -e "s/$/$suf/"
#! /bin/sh
#
# chgsuf - change suffix in each argument
# assumes no embedded spaces in arguments
# oldsuf is a string, not an R.E.
case $# in 0|1) echo "usage: chgsuf oldsuf newsuf files" 1>&2; exit 1;; esac
sed="sed -e s/[/.^[\*]/\\\\&/g"
oldsuf="`echo \"$1\" | $sed`"
newsuf="`echo \"$2\" | $sed`"
shift; shift
echo ${1+"$@"} | sed -e "s/$oldsuf /$newsuf /g" -e "s/$oldsuf$/$newsuf/"
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
Re^2: make bug
Author: Claus Tondering
Date: Wed, 04 Jan 1989 07:49
Date: Wed, 04 Jan 1989 07:49
8 lines
642 bytes
642 bytes
leo@philmds.UUCP (Leo de Wit) writes: >What would you expect? "$(BETA:bar=hello)" is certainly not Make syntax. Yes it is! At least according to my System V manuals! -- Claus Tondering Dansk Data Elektronik A/S, Herlev, Denmark E-mail: ct@dde.dk or ...!uunet!mcvax!dkuug!dde!ct
Re: make bug
Author: T. William Wells
Date: Thu, 05 Jan 1989 12:19
Date: Thu, 05 Jan 1989 12:19
24 lines
1274 bytes
1274 bytes
In article <502@Aragorn.dde.uucp> ct@dde.uucp (Claus Tondering) writes:
: ALPHA = foo
: BETA = $(ALPHA) bar
:
: all:
: echo $(BETA:bar=hello)
:
: Running make with this makefile will result in the execution of the
: command "echo $(ALPHA) hello", which is certainly not what I would
: expect.
:
: Why is ALPHA not substituted in the last example? Bug or feature?
Brain damage. Someone is doing the substitution before the expansion.
This is clearly wrong. Not only that, but it works on my Sun and I
believe that it worked on the VAX we used to have, the latter
definitely not Berkeley based. However, it definitely fails on my
Microport system; I got bit by this just the other day. I know where
I can get a PD make; if it is any good I'm going to toss the one I
have. Grrrrr......
---
Bill
{ uunet!proxftl | novavax } !twwells!bill
Re: make bug
Author: William E. Davidsen Jr
Date: Fri, 06 Jan 1989 13:15
Date: Fri, 06 Jan 1989 13:15
6 lines
638 bytes
638 bytes
I have that thing called 'cake,' but I never took the time to get it
working. Is that the one you mean?
--
bill davidsen (wedu@ge-crd.arpa)
{uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me
Re: make bug
Author: Guy Harris
Date: Fri, 06 Jan 1989 17:52
Date: Fri, 06 Jan 1989 17:52
17 lines
1336 bytes
1336 bytes
>Brain damage. Someone is doing the substitution before the expansion. >This is clearly wrong. Not only that, but it works on my Sun and I >believe that it worked on the VAX we used to have, the latter >definitely not Berkeley based. However, it definitely fails on my >Microport system; I got bit by this just the other day. I tried this under SunOS 4.0; the standard "make", which (as the comments on the SCCS ID lines say) is "Remotely from S5", does what seems to be considered the Right Thing, but "/usr/old/make" (which is basically the S5R2 "make") doesn't. My guess is that all flavors of the S5 "make" (it didn't change much between S5 releases, as I remember) don't Do The Right Thing, and that in the process of doing the "SunPro 'make'", which is the standard make in SunOS 4.0 and can be installed as "make" in 3.5 (and maybe 3.4), this was fixed. I seem to remember, in fact, that this *was* one of the things changed, in order to increase "make"s flexibility.
Re: make bug
Author: Brandon S. Allbery
Date: Sat, 07 Jan 1989 16:31
Date: Sat, 07 Jan 1989 16:31
36 lines
1961 bytes
1961 bytes
As quoted from <904@philmds.UUCP> by leo@philmds.UUCP (Leo de Wit):
+---------------
| In article <502@Aragorn.dde.uucp> ct@dde.uucp (Claus Tondering) writes:
| +---------------
| |ALPHA = foo
| |BETA = $(ALPHA) bar
| |
| |all:
| | echo $(BETA:bar=hello)
| |
| |Running make with this makefile will result in the execution of the
| |command "echo $(ALPHA) hello", which is certainly not what I would
| |expect.
| |
| |Why is ALPHA not substituted in the last example? Bug or feature?
|
| What would you expect? "$(BETA:bar=hello)" is certainly not Make syntax.
| Make doesn't know about sh or csh variable substitution, if that was
| your intention.
+---------------
Beg pardon, but did you examine the Newsgroups: line? The System III/System
V (and, I believe, recent SunOS) "make", sometimes called "augmake", *does*
support this. It's fairly limited, however; it only substitutes at the end
of words, and there are no wildcards.
I have noticed that *some* recursive substitutions fail; I don't know why.
It doesn't seem to matter whether substitutions are involved or not. (I had
the biggest problem with imported environment variables.)
++Brandon
--
Brandon S. Allbery, comp.sources.misc moderator and one admin of ncoast PA UN*X
uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu
ncoast is registering as "ncoast.org" -- watch for the official announcement!
Send comp.sources.misc submissions to comp-sources-misc@<backbone>.
Re: make bug
Author: T. William Wells
Date: Sun, 08 Jan 1989 06:16
Date: Sun, 08 Jan 1989 06:16
15 lines
923 bytes
923 bytes
In article <12890@steinmetz.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes:
: I have that thing called 'cake,' but I never took the time to get it
: working. Is that the one you mean?
I presume you're talking to me?
No, I don't mean cake. That's a completely different beast.
I've seen several versions of make out there. Sometime when I have a
few spare hours I'm going to snarf some of them and see which, if
any, are any good.
---
Bill
{ uunet!proxftl | novavax } !twwells!bill
Re: make bug
Author: Bradley White
Date: Sun, 08 Jan 1989 21:06
Date: Sun, 08 Jan 1989 21:06
67 lines
2107 bytes
2107 bytes
In article <488@targon.UUCP>, andre@targon.UUCP (andre) writes: > One thing to ponder, should make be able to handle this? > > STR=h w > HI=hello > TEXT=STR > H=h > HELLO=$HI > > all: > echo $($($TEXT:w=world):$H=$HELLO) > > And the result of this is: > echo :h=hELLO) > Changing the last line to read echo $($TEXT:w=world):$H=$HELLO) as I think you intended, the CMU CS version of make says: % make -n echo :h=hELLO) Of course, this isn't very interesting: $T is null, $(EXT) is null, (so the substitution doesn't apply), and that concatenated with the string ":h=hELLO)" simply gives that string. Something slightly more challenging is: echo $($(TEXT):w=$(HELLO)) % make -n echo h hI And something a lot more challenging (the syntax should hopefully be self-explanatory): PROGS = foo bar OFILES = $(PROGS/*/$(&_OFILES?$(&_OFILES):&.o)) foo_OFILES = foo1.o foo2.o all: echo $(OFILES) % make -n echo foo1.o foo2.o bar.o Using such powerful translations has allowed us to create a fully parameterized set of rules, that is included by every Makefile in the system, and that provides the standard target names "all", "install", "clean", and "lint". For example, here is our Makefile for /bin/sh: IDIR = /bin/ PROGRAMS = sh OFILES = setbrk.o builtin.o blok.o stak.o cmd.o\ fault.o main.o word.o string.o name.o args.o\ xec.o service.o error.o io.o print.o macro.o\ expand.o ctype.o msg.o include ../../Makefile-common -- Bradley White <bww@cs.cmu.edu> +1-412-268-3060 CMU Computer Science Department 40 26'33"N 79 56'48"W --
Re: make bug
Author: Kent Forschmiedt
Date: Tue, 10 Jan 1989 23:13
Date: Tue, 10 Jan 1989 23:13
18 lines
1007 bytes
1007 bytes
|| In article <502@Aragorn.dde.uucp> ct@dde.uucp (Claus Tondering) writes: || +--------------- || |ALPHA = foo || |BETA = $(ALPHA) bar || | || |all: || | echo $(BETA:bar=hello) || | || |Running make with this makefile will result in the execution of the || |command "echo $(ALPHA) hello", which is certainly not what I would || |expect. The make in Motorola's V/68 R2V2.3 exhibits this bug. It is almost certainly unmodified, directly from AT&T's SVR2 tape. -- kent@happym.wa.com, tikal!camco!happym!kent, Happy Man Corp 206-282-9598
Re: make bug
Author: William E. Davidsen Jr
Date: Thu, 12 Jan 1989 13:28
Date: Thu, 12 Jan 1989 13:28
11 lines
853 bytes
853 bytes
In article <304@twwells.uucp> bill@twwells.UUCP (T. William Wells) writes:
| I've seen several versions of make out there. Sometime when I have a
| few spare hours I'm going to snarf some of them and see which, if
| any, are any good.
If you ever find time let us know.
--
bill davidsen (wedu@ge-crd.arpa)
{uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads