make bug

Bradley White bww at k.gp.cs.cmu.edu
Mon Jan 9 07:06:55 AEST 1989


In article <488 at targon.UUCP>, andre at 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 at cs.cmu.edu>         +1-412-268-3060
CMU Computer Science Department  40 26'33"N 79 56'48"W
-- 



More information about the Comp.bugs.sys5 mailing list