SysV make (was YAPQ (yet another prompt question))

Chris Torek chris at mimsy.UUCP
Sat Aug 12 06:07:11 AEST 1989


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

In article <2354 at auspex.auspex.com> guy at 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 at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list