diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog index 424cfe20cd8a..c15589c284ad 100644 --- a/contrib/bmake/ChangeLog +++ b/contrib/bmake/ChangeLog @@ -1,3 +1,10 @@ +2017-07-20 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170720 + Merge with NetBSD make, pick up + o compat.c: pass SIGINT etc onto child and wait for it to exit + before we self-terminate. + 2017-07-11 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20170711 diff --git a/contrib/bmake/Makefile b/contrib/bmake/Makefile index 8cfe8b488f9f..f0b94966ab07 100644 --- a/contrib/bmake/Makefile +++ b/contrib/bmake/Makefile @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.94 2017/07/15 18:22:14 sjg Exp $ +# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20170711 +_MAKE_VERSION= 20170720 PROG= bmake diff --git a/contrib/bmake/compat.c b/contrib/bmake/compat.c index 3e16fffdb102..0fa4569df072 100644 --- a/contrib/bmake/compat.c +++ b/contrib/bmake/compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $ */ +/* $NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"); +__RCSID("$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -118,6 +118,8 @@ __RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"); static GNode *curTarg = NULL; static GNode *ENDNode; static void CompatInterrupt(int); +static pid_t compatChild; +static int compatSigno; /* * CompatDeleteTarget -- delete a failed, interrupted, or otherwise @@ -176,8 +178,17 @@ CompatInterrupt(int signo) } if (signo == SIGQUIT) _exit(signo); - bmake_signal(signo, SIG_DFL); - kill(myPid, signo); + /* + * If there is a child running, pass the signal on + * we will exist after it has exited. + */ + compatSigno = signo; + if (compatChild > 0) { + KILLPG(compatChild, signo); + } else { + bmake_signal(signo, SIG_DFL); + kill(myPid, signo); + } } /*- @@ -370,7 +381,7 @@ CompatRunCommand(void *cmdp, void *gnp) /* * Fork and execute the single command. If the fork fails, we abort. */ - cpid = vFork(); + compatChild = cpid = vFork(); if (cpid < 0) { Fatal("Could not fork"); } @@ -483,7 +494,12 @@ CompatRunCommand(void *cmdp, void *gnp) } } free(cmdStart); - + compatChild = 0; + if (compatSigno) { + bmake_signal(compatSigno, SIG_DFL); + kill(myPid, compatSigno); + } + return (status); } diff --git a/contrib/bmake/job.c b/contrib/bmake/job.c index f52a626c01a1..96f24702e879 100644 --- a/contrib/bmake/job.c +++ b/contrib/bmake/job.c @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $ */ +/* $NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"); +__RCSID("$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -364,11 +364,6 @@ static Job childExitJob; /* child exit pseudo-job */ (void)fprintf(fp, TARG_FMT, targPrefix, gn->name) static sigset_t caught_signals; /* Set of signals we handle */ -#if defined(SYSV) -#define KILLPG(pid, sig) kill(-(pid), (sig)) -#else -#define KILLPG(pid, sig) killpg((pid), (sig)) -#endif static void JobChildSig(int); static void JobContinueSig(int); diff --git a/contrib/bmake/make.h b/contrib/bmake/make.h index d029db655e1b..54b655f810c2 100644 --- a/contrib/bmake/make.h +++ b/contrib/bmake/make.h @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.102 2016/12/07 15:00:46 christos Exp $ */ +/* $NetBSD: make.h,v 1.103 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -543,4 +543,10 @@ int cached_stat(const char *, void *); #define PATH_MAX MAXPATHLEN #endif +#if defined(SYSV) +#define KILLPG(pid, sig) kill(-(pid), (sig)) +#else +#define KILLPG(pid, sig) killpg((pid), (sig)) +#endif + #endif /* _MAKE_H_ */ diff --git a/contrib/bmake/nonints.h b/contrib/bmake/nonints.h index 170ea7f7c39e..550537d93014 100644 --- a/contrib/bmake/nonints.h +++ b/contrib/bmake/nonints.h @@ -143,6 +143,11 @@ int Str_Match(const char *, const char *); char *Str_SYSVMatch(const char *, const char *, int *len); void Str_SYSVSubst(Buffer *, char *, char *, int); +#ifndef HAVE_STRLCPY +/* strlcpy.c */ +size_t strlcpy(char *, const char *, size_t); +#endif + /* suff.c */ void Suff_ClearSuffixes(void); Boolean Suff_IsTransform(char *); diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile index f10c12fc2393..98122f84eaed 100644 --- a/usr.bin/bmake/Makefile +++ b/usr.bin/bmake/Makefile @@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $Id: Makefile,v 1.94 2017/07/15 18:22:14 sjg Exp $ +# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20170711 +_MAKE_VERSION= 20170720 PROG?= ${.CURDIR:T} diff --git a/usr.bin/bmake/Makefile.inc b/usr.bin/bmake/Makefile.inc index 4fa3cf7b5e1d..918a3ab335eb 100644 --- a/usr.bin/bmake/Makefile.inc +++ b/usr.bin/bmake/Makefile.inc @@ -24,3 +24,9 @@ SUBDIR+= tests WARNS=3 CFLAGS+= -DNO_PWD_OVERRIDE + +.if make(after-import) +# use our preferred value +DEFAULT_SYS_PATH= .../share/mk:/usr/share/mk +.export DEFAULT_SYS_PATH +.endif