Date: Sun, 22 Sep 2013 17:37:51 -0600 From: Ian Lepore <ian@FreeBSD.org> To: Glen Barber <gjb@FreeBSD.org> Cc: FreeBSD Hackers <freebsd-hackers@FreeBSD.org>, freebsd-current <freebsd-current@FreeBSD.org> Subject: Re: The right way to invoke sh from a freebsd makefile? Message-ID: <1379893071.1197.119.camel@revolution.hippie.lan> In-Reply-To: <20130922232710.GD2336@glenbarber.us> References: <1379891905.1197.115.camel@revolution.hippie.lan> <20130922232710.GD2336@glenbarber.us>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2013-09-22 at 19:27 -0400, Glen Barber wrote: > On Sun, Sep 22, 2013 at 05:18:25PM -0600, 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). > > > > I think BUILDENV_SHELL is what you are looking for. For this specific > case, I think instead of '#!/bin/sh', maybe '#!/usr/bin/env sh' may be > preferable. > > Glen > No, BUILDENV_SHELL is a special thing... it's used when you "make buildenv" to chroot into a cross-build environment to work interactively. I added that long ago because I can't live in a csh shell (I mean, I can't do anything, I'm totally lost), and I wanted a way to have "make buildenv" put me right into bash (of course, you have to have bash in the chroot). The flavor of hashbang to use shouldn't matter, since what I'm after here is launching the shell to run the script without using the hashbang mechanism. -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1379893071.1197.119.camel>