[comp.unix.questions] SysV make

chris@mimsy.UUCP (Chris Torek) (08/12/89)

>>If you do use the SHELL trick, remember to set your SHELL variable back after
>>running make ....

In article <2354@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes:
>Or set it in the Makefile instead, and save yourself (and anybody else
>running "make" with that Makefile) the trouble of remembering to set it
>before running "make" and set it back after doing so.

Or better yet, rip the bogosity out of make in the first place.  It is
(somewhat) all right for make to use ${SHELL} as the shell to run
commands in the makefile, but it is then *not* all right for it to
arbitrarily import $SHELL from the environment.  J. Random User's login
shell has very little to do with the shell that should be used to run
make recipies.

If you are stuck with the SysV make and its bogus import (either because
you have no source code, or for some reason cannot modify it), you can
write your own `make' shell script that runs the real `make' but with
SHELL=/bin/sh:

	: import dependencies from .depend if appropriate
	: just like 4.3BSD-tahoe
	if [ -f .depend ]; then
		if [ -f makefile ]; then
			f="-f makefile -f .depend"
		else
			f="-f Makefile -f .depend"
		fi
		for i do
			case "$i" in -f*) f=;; esac
		done
	else
		f=
	fi

	SHELL=/bin/sh; export SHELL
	: ${MACHINE=`machine`}		# optional
	exec /bin/make $f ${1+"$@"}
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

guy@auspex.auspex.com (Guy Harris) (08/13/89)

>Or better yet, rip the bogosity out of make in the first place.

Nice idea if you have source, but plenty of people are stuck with a
"make" that has the bogosity in question, and if you intend to have your
Makefile used outside your site it's best to assume that the people in
question are likely to be stuck with it, and program defensively by
setting SHELL in the Makefile.