Make & .cshrc

Guy Harris guy at gorodish.Sun.COM
Tue Sep 13 09:36:12 AEST 1988


> >The SunOS "make" always uses the Bourne shell to execute commands.
> 
> If there are no shell metacharacters, the command is invoked directly
> and no shell is involved.

I knew that, but it's a minor detail, so I left it out of the discussion.
Unless your shell is quite strange, commands involving no shell metacharacters
should work the same way regardless of whether "make" runs them directly or
whether they're run under the Bourne, C, Korn, ... shell (modulo bizarro and
probably undesirable interactions with the way the shell sets the command's
environment up, and thinks like that).

> An interesting question is are there C shell metacharacters that are
> not Bourne shell metacharacters?

How about "{" and "}", as in "rm {foo,bar,bletch}.c"?

This isn't the only problem; the Bourne and C shells have different syntaxes
for some operations.  For instance, if you want to run the command "foo" with
both its standard output and standard error redirected to "bar", it's

	foo >bar 2>&1

in the Bourne shell, but

	foo >&bar

in the C shell.  In addition, some Makefiles include shell conditional
constructs, and the syntax for those is quite different between the Bourne and
C shells.

> Seems like make should always call the shell if it's specified to be
> something other than /bin/sh or /bin/csh.

"make" should always call "/bin/sh" regardless of what SHELL says; otherwise,
you run the risk of Makefiles working for person A (whose login shell is the
Bourne shell) and failing for person B (whose login shell is the C shell) - or,
for that matter, succeeding for person A (whose login shell is the Korn shell)
and failing for person B (whose login shell is the Bourne shell), since the
Korn shell is a superset of the Bourne shell.  Users with shells that are "none
of the above" can also find that other people's Makefiles blow up.



More information about the Comp.unix.wizards mailing list