Problem with make

Guy Harris guy at auspex.auspex.com
Sat Sep 30 08:08:50 AEST 1989


 >|  I'm having a problem using a 'for' statement with 'make'.  Consider
 >|  the following trivial makefile:
 >|  
 >|  test:
 >|  	for i in 1 2 3 4; do echo "hello"; done
 >
 >  I tried this on three SysV machines and it worked on all of them. You
 >are doing something other than what you think you are, because this
 >flies on Xenix, Stellar, and Unicos.

What he's doing is using the C shell as his login shell, and using a
"make" that imports the SHELL environment variable as the "make"
variable SHELL and uses the latter to select which shell should be used
to run commands that can't be run directly by "make".

If it works for you, either 1) you're using a Bourne-compatible shell as
your login shell, 2) have a "make" that doesn't use import the SHELL
environment variable or doesn't use it to select which shell to use to
run commands, or 3) stuck

	SHELL=/bin/sh

or something like that at the front of the Makefile.  (In SunOS, "make"
imports SHELL, along with other environment variables, but doesn't use
it to select the shell to run - it always uses "/bin/sh" - while in BSD,
"make" neither imports environment variables nor uses SHELL to select
which shell to run.  I can't speak for Xenix, Stellix, nor Unicos.)

Not all users can necessarily do 1) or 2), or would want to.  However,
most authors of Makefiles can do 3), and I'd suggest that they do so, if
they want to make sure their Makefiles run on as many systems as
possible when run by as many users as possible.



More information about the Comp.unix.questions mailing list