Make & .cshrc

Nick Crossley nick at ccicpg.UUCP
Tue Sep 20 03:41:31 AEST 1988


In article <68801 at sun.uucp> guy at gorodish.Sun.COM (Guy Harris) writes:
>Fine.  Plenty of other people don't like it, because it causes makefiles to
>exhibit incorrect behavior when invoked by users with shells other than the
>Bourne shell.  There is, admittedly, a workaround/fix for this - namely,
>putting "SHELL=/bin/sh" at the beginning of all your makefiles - but it's still
>kind of impolite to require people to change their makefiles in this fashion,
>especially if you don't tell them they have to do this.
>
This is not necessay, because SysV make also imports all environment variables
as make variables.  Thus one can write :-

	make SHELL=/bin/sh ...
or	SHELL=/bin/sh make

for one-off makes, and 'alias Make=<one of the above>' for other occasions.
The -e flag to make (environment values override local settings) can also be
useful.

>Now, maybe you rate your convenience above the convenience of those other
>people.  I suspect those other people would rate things differently, and in
>general "don't gratuitously break things" is considered a good rule.
This is a valid argument against any change, but since the 'fix' is so trivial,
I do not consider it overwhelming in this case.

>I tend to doubt that there are many Makefiles or shell scripts that absolutely
>*NEED* ksh.  There are many that might be more *convenient* to write using
>"ksh", but I suspect they can all be done without Korn shell features.
>
>I suggest you learn to do your development without using those features in your
>scripts.  I use the Korn shell as my shell, but I make a point of *not* using
>Korn shell features in scripts and the like, because I have no idea whether
>somebody else will have the Korn shell available to them.

If I were to do this, why should I use the Korn shell at all?  Why should we
ever change and enhance anything?  Of course I *can* do anything with sh, but
some things are *much* easier to write using ksh.  My reasons for using ksh
are not just the interactive features (command editing and history, etc.); I
switched from sh to ksh partly because of the improved script facilities,
arithmetic and bug fixes in features like functions.

The one point I would agree on is that it is sometimes unfortunate that the
environment value used is just 'SHELL', as that also affects the shell launched
by vi, etc.  I would like for that always to be ksh, but for make to use sh
sometimes.  Currently I use a Make alias as above, but a better solution would
be for make to look for the environment variable 'MAKESHELL', and default to
'SHELL' (or /bin/sh if you insist) if that did not exist.  In fact the latter
solution should satisfy both of us, should it not?

-- 

<<< standard disclaimers >>>
Nick Crossley, CCI, 9801 Muirlands, Irvine, CA 92718-2521, USA
Tel. (714) 458-7282,  uucp: ...!uunet!ccicpg!nick



More information about the Comp.unix.wizards mailing list