"make" SHELL variable

dvadura at watdaisy.UUCP dvadura at watdaisy.UUCP
Mon Feb 16 10:22:30 AEST 1987


The question of what shell is used inside make only becomes a problem during
those command sequences inside the makefile that are essentially shell
scripts.  Writing such command sequences makes your makefile non-portable to
anything but machines containing compatible shells.  There is however a side
issue to all this.  Most shells provide some form of redirection and
pipelining if the OS supports it.  It is in these instances that it would be
advantageous to have make read the SHELL variable or MAKE_SHELL variable
(what you really call it makes little difference) from the environment.
Since make can then use the proper shell based on host machine/os combination.

I propose, and have implemented the following rules for a version of make
that is soon to be released.  This make is an attempt at unifying those
features of most use found in unix make, adding some features not
found in any unix make, fixing bugs/annoyances found in unix make, and
making the code usable on a wide variety of machines.  (so far this includes
vax family, MS-DOS boxen, amiga, and soon Sun, Sys V, etc. )  Thus the point
of SHELL is important here.

So here are the rules in order of priority (highest to lowest):

1. if you do not mention SHELL anywhere make will use the default compiled
   in shell.  (eg.  unix == /bin/sh, DOS == command.com, etc ...)

2. if you mention SHELL in command line or in makefile then that is the SHELL
   that is used.  unless you say SHELL=  in this case the default shell is
   used.

3. if you say -a or -e, (-e == read environment strings) and SHELL is defined
   in the environment, (-a == look for shell in environment, -e superceeds -a)
   then that value of SHELL is used provided SHELL is NOT mentioned anywhere
   that rule 2 applies.

This way SHELL found in environment strings can only be used if SHELL is not
mentioned anywhere else, and you must specifically request for it to be used.
-- 
--------------------------------------------------------------------------------
Dennis Vadura, Computer Science Dept., University of Waterloo
UUCP:  {ihnp4|allegra|utzoo|utcsri}!watmath!watdaisy!dvadura
================================================================================



More information about the Comp.unix.wizards mailing list