The right way to invoke sh from a freebsd makefile?
Bryan Drewery
bdrewery at FreeBSD.org
Sun Sep 22 23:25:51 UTC 2013
On 9/22/2013 6:18 PM, Ian Lepore wrote:
> What's the right way to launch the bourne shell from a makefile? I had
> assumed the ${SHELL} variable would be set to "the right" copy
> of /bin/sh (like maybe the one in tmp or legacy at various stages). It
> appears that that's not the case, and ${SHELL} is whatever comes from
> the environment, which can lead to using csh or bash or whatever.
>
> I see some of our makefiles use just a bare "sh" which seems reasonable
> to me, but I don't want to glitch this in src/include/Makefile again.
> The goal is to run a script in src/include/Makefile by launching sh with
> the script name (as opposed to launching the script and letting the #!
> do its thing, which doesn't work if the source dir is mounted noexec).
>
> -- Ian
>
Grepping the Makefiles in the tree, 'sh' is the very common. I see
around 157 users of this pattern. 13 use /bin/sh directly. Also consider
that it is highly likely, if not required, that a /bin/sh will exist.
Calling 'sh' specifically is definitely more proper than ${SHELL} since
it is an sh script.
--
Regards,
Bryan Drewery
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20130922/94cc83b5/attachment.sig>
More information about the freebsd-hackers
mailing list