a Make question

Tim Radzykewycz radzy at calma.UUCP
Thu Oct 31 02:17:36 AEST 1985


In article <1596 at uwmacc.UUCP> jwp at uwmacc.UUCP (Jeffrey W Percival) writes:
>Here's a simple makefile:
>	DIRS = d1 d2 d3 d4 d5
>	depend: ; (for dir in $(DIRS); do (cd $dir; make depend); done)
>The problem with this is that 'make' is interpreting the $d as a null
>string, so the 'cd' command sees an argument of "ir".  I tried
>escaping the $ preceding dir, to no avail.

To get a '$' char down to the shell that actually executes the
commands, simply double it:
	DIRS = d1 d2 d3 d4 d5
    depend: ; (for dir in $(DIRS); do (cd $$dir; make depend); done)
					  ^^
This prevents make from seeing it as a variable, and it does the
right thing.
-- 
Tim (radzy) Radzykewycz, The Incredible Radical Cabbage
	calma!radzy at ucbvax.ARPA
	{ucbvax,sun,csd-gould}!calma!radzy



More information about the Comp.unix mailing list