diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2000-06-30 23:26:26 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2000-06-30 23:26:26 +0000 |
commit | 8178309145e472d5971cedf459d046f4f0c326b9 (patch) | |
tree | 5fbb067c288ede359bb9403caa458dd5051a887d /usr.bin/make/compat.c | |
parent | 2dfad5a51ae955f52f750aa5c5de1cf3b6701b69 (diff) |
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.
Diffstat (limited to 'usr.bin/make/compat.c')
-rw-r--r-- | usr.bin/make/compat.c | 22 |
1 files changed, 13 insertions, 9 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') { |