summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2000-06-30 23:26:25 +0000
committerespie <espie@openbsd.org>2000-06-30 23:26:25 +0000
commitc41b5adb9879a34ea05491aaf923a29e01e942a8 (patch)
tree6f0735fc2df4a3d5ef8fad7b6326ad2abf18e0db
parentOops, put back this call to spltty(). When our timeout expires and we poll the (diff)
downloadwireguard-openbsd-c41b5adb9879a34ea05491aaf923a29e01e942a8.tar.xz
wireguard-openbsd-c41b5adb9879a34ea05491aaf923a29e01e942a8.zip
Recognize `+cmd' as a command that should always be executed, even in
make -n mode. Currently works only in sequential make mode. In parallel make mode, it's just a no-op. Useful to debug recursive Makefiles, and part of POSIX.
-rw-r--r--usr.bin/make/compat.c22
-rw-r--r--usr.bin/make/job.c14
-rw-r--r--usr.bin/make/make.127
3 files changed, 38 insertions, 25 deletions
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index ddbd32816dd..2df969be983 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat.c,v 1.31 2000/06/23 16:21:43 espie Exp $ */
+/* $OpenBSD: compat.c,v 1.32 2000/06/30 23:26:25 espie Exp $ */
/* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: compat.c,v 1.31 2000/06/23 16:21:43 espie Exp $";
+static char rcsid[] = "$OpenBSD: compat.c,v 1.32 2000/06/30 23:26:25 espie Exp $";
#endif
#endif /* not lint */
@@ -206,7 +206,8 @@ CompatRunCommand (cmdp, gnp)
char *cmdStart; /* Start of expanded command */
char *cp, *bp = NULL;
Boolean silent, /* Don't print command */
- errCheck; /* Check errors */
+ errCheck, /* Check errors */
+ doExecute; /* Execute the command */
int reason; /* Reason for child's death */
int status; /* Description of child's death */
int cpid; /* Child actually found */
@@ -231,6 +232,7 @@ CompatRunCommand (cmdp, gnp)
#endif
silent = gn->type & OP_SILENT;
errCheck = !(gn->type & OP_IGNORE);
+ doExecute = !noExecute;
cmdNode = Lst_Member(&gn->commands, cmd);
cmdStart = Var_Subst(cmd, &gn->context, FALSE);
@@ -259,13 +261,15 @@ CompatRunCommand (cmdp, gnp)
return 1;
}
- while ((*cmd == '@') || (*cmd == '-')) {
- if (*cmd == '@') {
+ for (;; cmd++) {
+ if (*cmd == '@')
silent = TRUE;
- } else {
+ else if (*cmd == '-')
errCheck = FALSE;
- }
- cmd++;
+ else if (*cmd == '+')
+ doExecute = TRUE;
+ else
+ break;
}
while (isspace((unsigned char)*cmd))
@@ -293,7 +297,7 @@ CompatRunCommand (cmdp, gnp)
* If we're not supposed to execute any commands, this is as far as
* we go...
*/
- if (noExecute)
+ if (!doExecute)
return 1;
if (*cp != '\0') {
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 13f0c59ce4a..f91d2bde0bb 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: job.c,v 1.33 2000/06/23 16:41:53 espie Exp $ */
+/* $OpenBSD: job.c,v 1.34 2000/06/30 23:26:25 espie Exp $ */
/* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: job.c,v 1.33 2000/06/23 16:41:53 espie Exp $";
+static char rcsid[] = "$OpenBSD: job.c,v 1.34 2000/06/30 23:26:25 espie Exp $";
#endif
#endif /* not lint */
@@ -559,13 +559,13 @@ JobPrintCommand(cmdp, jobp)
/*
* Check for leading @' and -'s to control echoing and error checking.
*/
- while (*cmd == '@' || *cmd == '-') {
- if (*cmd == '@') {
+ for (;; cmd++) {
+ if (*cmd == '@')
shutUp = TRUE;
- } else {
+ else if (*cmd == '-')
errOff = TRUE;
- }
- cmd++;
+ else if (*cmd != '+')
+ break;
}
while (isspace((unsigned char) *cmd))
diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1
index 35a3915aba9..06f7aca5500 100644
--- a/usr.bin/make/make.1
+++ b/usr.bin/make/make.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: make.1,v 1.32 2000/06/06 15:32:25 ericj Exp $
+.\" $OpenBSD: make.1,v 1.33 2000/06/30 23:26:25 espie Exp $
.\" $NetBSD: make.1,v 1.18 1997/03/10 21:19:53 christos Exp $
.\"
.\" Copyright (c) 1990, 1993
@@ -291,17 +291,22 @@ dependencies may be followed by a creation script, unless the
.Ql Ic ::
operator is used.
.Pp
-If the first or first two characters of the command line are
-.Ql Ic @
+If a command line begins by a combination of the characters,
+.Ql Ic @ ,
+.Ql Ic \-
and/or
-.Ql Ic \- ,
+.Ql Ic + ,
the command is treated specially.
-A
-.Ql Ic @
+.Bl -tag -width `@'
+.It Ql Ic @
causes the command not to be echoed before it is executed.
-A
-.Ql Ic \-
+.It Ql Ic \-
causes any non-zero exit status of the command line to be ignored.
+.It Ql Ic +
+causes the command to be executed even if
+.Fl n
+has been specified (This can be useful to debug recursive Makefiles).
+.El
.Sh VARIABLE ASSIGNMENTS
Variables in
.Nm
@@ -1233,7 +1238,7 @@ When handling pre-BSD 4.4 archives,
may erroneously mark archive members as out of date if the archive name
was truncated.
.Pp
-Variable handling is incredibly inefficient.
+Variable handling is somewhat inefficient.
.Pp
The handling of ; and other special characters in tests may be utterly
bogus.
@@ -1262,6 +1267,10 @@ A+=$I
\&.endfor
.Ed
A will evaluate to a b c d after the loop, not z b c d.
+.Pp
+The
+.Ql +
+command modificator is ignored in parallel make mode.
.Sh SEE ALSO
.Xr mkdep 1
.Pp