diff options
author | green <green@FreeBSD.org> | 2000-08-16 23:31:43 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2000-08-16 23:31:43 +0000 |
commit | dc14c5e4fd05e3b9cfa3c48ed029ab111dd48329 (patch) | |
tree | cc0e62b51ed1e79e231d912ec8759b2cd884047f /usr.bin | |
parent | d5af96afa040e66ed2df0eeeb0dc4ec7349132cc (diff) | |
download | FreeBSD-src-dc14c5e4fd05e3b9cfa3c48ed029ab111dd48329.zip FreeBSD-src-dc14c5e4fd05e3b9cfa3c48ed029ab111dd48329.tar.gz |
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 ;)
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/Makefile | 16 | ||||
-rw-r--r-- | usr.bin/make/config.h | 2 | ||||
-rw-r--r-- | usr.bin/make/job.c | 10 | ||||
-rw-r--r-- | usr.bin/make/main.c | 13 |
4 files changed, 39 insertions, 2 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile index da2c13d..7ef58f8 100644 --- a/usr.bin/make/Makefile +++ b/usr.bin/make/Makefile @@ -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> diff --git a/usr.bin/make/config.h b/usr.bin/make/config.h index 9d97eb5..1bf6e9f 100644 --- a/usr.bin/make/config.h +++ b/usr.bin/make/config.h @@ -39,8 +39,6 @@ * $FreeBSD$ */ -#define DEFSHELL 1 /* Bourne shell */ - /* * DEFMAXJOBS * DEFMAXLOCAL diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index f553768..213bed0 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -189,6 +189,16 @@ static Shell shells[] = { "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. */ { diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 9530a0e..2694eed 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -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*/ |