Allow use of the ${MAKE_SHELL} variable to specify alternate shells for
make(1) to use. Setting it to "sh" and "ksh" are the only values which work right ATM; I wouldn't expect "csh" to get you far ;)
This commit is contained in:
parent
9b96968623
commit
c7322223b9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64739
@ -12,4 +12,20 @@ SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
|
||||
lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c
|
||||
.PATH: ${.CURDIR}/lst.lib
|
||||
|
||||
# Set the shell which make(1) uses. Bourne is the default, but a decent
|
||||
# Korn shell works fine, and much faster. Using the C shell for this
|
||||
# will almost certainly break everything, but it's Unix tradition to
|
||||
# allow you to shoot yourself in the foot if you want to :-)
|
||||
|
||||
MAKE_SHELL?= sh
|
||||
.if ${MAKE_SHELL} == "csh"
|
||||
CFLAGS+= -DDEFSHELL=0
|
||||
.elif ${MAKE_SHELL} == "sh"
|
||||
CFLAGS+= -DDEFSHELL=1
|
||||
.elif ${MAKE_SHELL} == "ksh"
|
||||
CFLAGS+= -DDEFSHELL=2
|
||||
.else
|
||||
.error "MAKE_SHELL must be set to one of \"csh\", \"sh\" or \"ksh\"."
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -39,8 +39,6 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define DEFSHELL 1 /* Bourne shell */
|
||||
|
||||
/*
|
||||
* DEFMAXJOBS
|
||||
* DEFMAXLOCAL
|
||||
|
@ -187,6 +187,16 @@ static Shell shells[] = {
|
||||
FALSE, "echo \"%s\"\n", "sh -c '%s || exit 0'\n",
|
||||
#endif
|
||||
"v", "e",
|
||||
},
|
||||
/*
|
||||
* KSH description. The Korn shell has a superset of
|
||||
* the Bourne shell's functionality.
|
||||
*/
|
||||
{
|
||||
"ksh",
|
||||
TRUE, "set -", "set -v", "set -", 5,
|
||||
TRUE, "set -e", "set +e",
|
||||
"v", "e",
|
||||
},
|
||||
/*
|
||||
* UNKNOWN.
|
||||
|
@ -478,6 +478,13 @@ main(argc, argv)
|
||||
/* avoid faults on read-only strings */
|
||||
static char syspath[] = _PATH_DEFSYSPATH;
|
||||
|
||||
#if DEFSHELL == 2
|
||||
/*
|
||||
* Turn off ENV to make ksh happier.
|
||||
*/
|
||||
unsetenv("ENV");
|
||||
#endif
|
||||
|
||||
#ifdef RLIMIT_NOFILE
|
||||
/*
|
||||
* get rid of resource limit on file descriptors
|
||||
@ -1000,7 +1007,13 @@ Cmd_Exec(cmd, err)
|
||||
(void) dup2(fds[1], 1);
|
||||
(void) close(fds[1]);
|
||||
|
||||
#if DEFSHELL == 1
|
||||
(void) execv("/bin/sh", args);
|
||||
#elif DEFSHELL == 2
|
||||
(void) execv("/bin/ksh", args);
|
||||
#else
|
||||
#error "DEFSHELL must be 1 or 2."
|
||||
#endif
|
||||
_exit(1);
|
||||
/*NOTREACHED*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user