Xref: utzoo comp.bugs.sys5:742 comp.unix.wizards:13965 Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!iuvax!rutgers!rochester!pt.cs.cmu.edu!k.gp.cs.cmu.edu!bww From: bww@k.gp.cs.cmu.edu (Bradley White) Newsgroups: comp.bugs.sys5,comp.unix.wizards Subject: Re: make bug Summary: make substitutions Message-ID: <3984@pt.cs.cmu.edu> Date: 8 Jan 89 21:06:55 GMT References: <502@Aragorn.dde.uucp> <904@philmds.UUCP> <488@targon.UUCP> Organization: Carnegie-Mellon University, CS/RI Lines: 66 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 +1-412-268-3060 CMU Computer Science Department 40 26'33"N 79 56'48"W --