make(1): negate NoExecute to GNode_ShouldExecutediff -r1.172 -r1.173 src/usr.bin/make/compat.c
(rillig)
--- src/usr.bin/make/compat.c 2020/10/31 18:20:00 1.172
+++ src/usr.bin/make/compat.c 2020/11/01 17:47:26 1.173
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: compat.c,v 1.172 2020/10/31 18:20:00 rillig Exp $ */ | 1 | /* $NetBSD: compat.c,v 1.173 2020/11/01 17:47:26 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -86,27 +86,27 @@ | @@ -86,27 +86,27 @@ | |||
86 | #include <sys/stat.h> | 86 | #include <sys/stat.h> | |
87 | #include <sys/wait.h> | 87 | #include <sys/wait.h> | |
88 | 88 | |||
89 | #include <errno.h> | 89 | #include <errno.h> | |
90 | #include <signal.h> | 90 | #include <signal.h> | |
91 | 91 | |||
92 | #include "make.h" | 92 | #include "make.h" | |
93 | #include "dir.h" | 93 | #include "dir.h" | |
94 | #include "job.h" | 94 | #include "job.h" | |
95 | #include "metachar.h" | 95 | #include "metachar.h" | |
96 | #include "pathnames.h" | 96 | #include "pathnames.h" | |
97 | 97 | |||
98 | /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ | 98 | /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ | |
99 | MAKE_RCSID("$NetBSD: compat.c,v 1.172 2020/10/31 18:20:00 rillig Exp $"); | 99 | MAKE_RCSID("$NetBSD: compat.c,v 1.173 2020/11/01 17:47:26 rillig Exp $"); | |
100 | 100 | |||
101 | static GNode *curTarg = NULL; | 101 | static GNode *curTarg = NULL; | |
102 | static pid_t compatChild; | 102 | static pid_t compatChild; | |
103 | static int compatSigno; | 103 | static int compatSigno; | |
104 | 104 | |||
105 | /* | 105 | /* | |
106 | * CompatDeleteTarget -- delete a failed, interrupted, or otherwise | 106 | * CompatDeleteTarget -- delete a failed, interrupted, or otherwise | |
107 | * duffed target if not inhibited by .PRECIOUS. | 107 | * duffed target if not inhibited by .PRECIOUS. | |
108 | */ | 108 | */ | |
109 | static void | 109 | static void | |
110 | CompatDeleteTarget(GNode *gn) | 110 | CompatDeleteTarget(GNode *gn) | |
111 | { | 111 | { | |
112 | if (gn != NULL && !Targ_Precious(gn)) { | 112 | if (gn != NULL && !Targ_Precious(gn)) { | |
@@ -264,36 +264,36 @@ Compat_RunCommand(const char *cmdp, GNod | @@ -264,36 +264,36 @@ Compat_RunCommand(const char *cmdp, GNod | |||
264 | * | 264 | * | |
265 | * Additionally variable assignments and empty commands | 265 | * Additionally variable assignments and empty commands | |
266 | * go to the shell. Therefore treat '=' and ':' like shell | 266 | * go to the shell. Therefore treat '=' and ':' like shell | |
267 | * meta characters as documented in make(1). | 267 | * meta characters as documented in make(1). | |
268 | */ | 268 | */ | |
269 | 269 | |||
270 | useShell = needshell(cmd); | 270 | useShell = needshell(cmd); | |
271 | #endif | 271 | #endif | |
272 | 272 | |||
273 | /* | 273 | /* | |
274 | * Print the command before echoing if we're not supposed to be quiet for | 274 | * Print the command before echoing if we're not supposed to be quiet for | |
275 | * this one. We also print the command if -n given. | 275 | * this one. We also print the command if -n given. | |
276 | */ | 276 | */ | |
277 | if (!silent || NoExecute(gn)) { | 277 | if (!silent || !GNode_ShouldExecute(gn)) { | |
278 | printf("%s\n", cmd); | 278 | printf("%s\n", cmd); | |
279 | fflush(stdout); | 279 | fflush(stdout); | |
280 | } | 280 | } | |
281 | 281 | |||
282 | /* | 282 | /* | |
283 | * If we're not supposed to execute any commands, this is as far as | 283 | * If we're not supposed to execute any commands, this is as far as | |
284 | * we go... | 284 | * we go... | |
285 | */ | 285 | */ | |
286 | if (!doIt && NoExecute(gn)) { | 286 | if (!doIt && !GNode_ShouldExecute(gn)) { | |
287 | return 0; | 287 | return 0; | |
288 | } | 288 | } | |
289 | DEBUG1(JOB, "Execute: '%s'\n", cmd); | 289 | DEBUG1(JOB, "Execute: '%s'\n", cmd); | |
290 | 290 | |||
291 | if (useShell) { | 291 | if (useShell) { | |
292 | /* | 292 | /* | |
293 | * We need to pass the command off to the shell, typically | 293 | * We need to pass the command off to the shell, typically | |
294 | * because the command contains a "meta" character. | 294 | * because the command contains a "meta" character. | |
295 | */ | 295 | */ | |
296 | static const char *shargv[5]; | 296 | static const char *shargv[5]; | |
297 | int shargc; | 297 | int shargc; | |
298 | 298 | |||
299 | shargc = 0; | 299 | shargc = 0; | |
@@ -538,40 +538,40 @@ Compat_Make(GNode *gn, GNode *pgn) | @@ -538,40 +538,40 @@ Compat_Make(GNode *gn, GNode *pgn) | |||
538 | if (Targ_Ignore(gn)) | 538 | if (Targ_Ignore(gn)) | |
539 | gn->type |= OP_IGNORE; | 539 | gn->type |= OP_IGNORE; | |
540 | if (Targ_Silent(gn)) | 540 | if (Targ_Silent(gn)) | |
541 | gn->type |= OP_SILENT; | 541 | gn->type |= OP_SILENT; | |
542 | 542 | |||
543 | if (Job_CheckCommands(gn, Fatal)) { | 543 | if (Job_CheckCommands(gn, Fatal)) { | |
544 | /* | 544 | /* | |
545 | * Our commands are ok, but we still have to worry about the -t | 545 | * Our commands are ok, but we still have to worry about the -t | |
546 | * flag... | 546 | * flag... | |
547 | */ | 547 | */ | |
548 | if (!opts.touchFlag || (gn->type & OP_MAKE)) { | 548 | if (!opts.touchFlag || (gn->type & OP_MAKE)) { | |
549 | curTarg = gn; | 549 | curTarg = gn; | |
550 | #ifdef USE_META | 550 | #ifdef USE_META | |
551 | if (useMeta && !NoExecute(gn)) { | 551 | if (useMeta && GNode_ShouldExecute(gn)) { | |
552 | meta_job_start(NULL, gn); | 552 | meta_job_start(NULL, gn); | |
553 | } | 553 | } | |
554 | #endif | 554 | #endif | |
555 | RunCommands(gn); | 555 | RunCommands(gn); | |
556 | curTarg = NULL; | 556 | curTarg = NULL; | |
557 | } else { | 557 | } else { | |
558 | Job_Touch(gn, (gn->type & OP_SILENT) != 0); | 558 | Job_Touch(gn, (gn->type & OP_SILENT) != 0); | |
559 | } | 559 | } | |
560 | } else { | 560 | } else { | |
561 | gn->made = ERROR; | 561 | gn->made = ERROR; | |
562 | } | 562 | } | |
563 | #ifdef USE_META | 563 | #ifdef USE_META | |
564 | if (useMeta && !NoExecute(gn)) { | 564 | if (useMeta && GNode_ShouldExecute(gn)) { | |
565 | if (meta_job_finish(NULL) != 0) | 565 | if (meta_job_finish(NULL) != 0) | |
566 | gn->made = ERROR; | 566 | gn->made = ERROR; | |
567 | } | 567 | } | |
568 | #endif | 568 | #endif | |
569 | 569 | |||
570 | if (gn->made != ERROR) { | 570 | if (gn->made != ERROR) { | |
571 | /* | 571 | /* | |
572 | * If the node was made successfully, mark it so, update | 572 | * If the node was made successfully, mark it so, update | |
573 | * its modification time and timestamp all its parents. Note | 573 | * its modification time and timestamp all its parents. Note | |
574 | * that for .ZEROTIME targets, the timestamping isn't done. | 574 | * that for .ZEROTIME targets, the timestamping isn't done. | |
575 | * This is to keep its state from affecting that of its parent. | 575 | * This is to keep its state from affecting that of its parent. | |
576 | */ | 576 | */ | |
577 | gn->made = MADE; | 577 | gn->made = MADE; |
--- src/usr.bin/make/job.c 2020/11/01 17:07:03 1.299
+++ src/usr.bin/make/job.c 2020/11/01 17:47:26 1.300
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: job.c,v 1.299 2020/11/01 17:07:03 rillig Exp $ */ | 1 | /* $NetBSD: job.c,v 1.300 2020/11/01 17:47:26 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -133,27 +133,27 @@ | @@ -133,27 +133,27 @@ | |||
133 | #ifndef USE_SELECT | 133 | #ifndef USE_SELECT | |
134 | #include <poll.h> | 134 | #include <poll.h> | |
135 | #endif | 135 | #endif | |
136 | #include <signal.h> | 136 | #include <signal.h> | |
137 | #include <utime.h> | 137 | #include <utime.h> | |
138 | 138 | |||
139 | #include "make.h" | 139 | #include "make.h" | |
140 | #include "dir.h" | 140 | #include "dir.h" | |
141 | #include "job.h" | 141 | #include "job.h" | |
142 | #include "pathnames.h" | 142 | #include "pathnames.h" | |
143 | #include "trace.h" | 143 | #include "trace.h" | |
144 | 144 | |||
145 | /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ | 145 | /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ | |
146 | MAKE_RCSID("$NetBSD: job.c,v 1.299 2020/11/01 17:07:03 rillig Exp $"); | 146 | MAKE_RCSID("$NetBSD: job.c,v 1.300 2020/11/01 17:47:26 rillig Exp $"); | |
147 | 147 | |||
148 | /* A shell defines how the commands are run. All commands for a target are | 148 | /* A shell defines how the commands are run. All commands for a target are | |
149 | * written into a single file, which is then given to the shell to execute | 149 | * written into a single file, which is then given to the shell to execute | |
150 | * the commands from it. The commands are written to the file using a few | 150 | * the commands from it. The commands are written to the file using a few | |
151 | * templates for echo control and error control. | 151 | * templates for echo control and error control. | |
152 | * | 152 | * | |
153 | * The name of the shell is the basename for the predefined shells, such as | 153 | * The name of the shell is the basename for the predefined shells, such as | |
154 | * "sh", "csh", "bash". For custom shells, it is the full pathname, and its | 154 | * "sh", "csh", "bash". For custom shells, it is the full pathname, and its | |
155 | * basename is used to select the type of shell; the longest match wins. | 155 | * basename is used to select the type of shell; the longest match wins. | |
156 | * So /usr/pkg/bin/bash has type sh, /usr/local/bin/tcsh has type csh. | 156 | * So /usr/pkg/bin/bash has type sh, /usr/local/bin/tcsh has type csh. | |
157 | * | 157 | * | |
158 | * The echoing of command lines is controlled using hasEchoCtl, echoOff, | 158 | * The echoing of command lines is controlled using hasEchoCtl, echoOff, | |
159 | * echoOn, noPrint and noPrintLen. When echoOff is executed by the shell, it | 159 | * echoOn, noPrint and noPrintLen. When echoOff is executed by the shell, it | |
@@ -721,27 +721,27 @@ JobPrintCommand(Job *job, char *cmd) | @@ -721,27 +721,27 @@ JobPrintCommand(Job *job, char *cmd) | |||
721 | * inserting special commands into | 721 | * inserting special commands into | |
722 | * the input stream. */ | 722 | * the input stream. */ | |
723 | Boolean shutUp; /* true if we put a no echo command | 723 | Boolean shutUp; /* true if we put a no echo command | |
724 | * into the command file */ | 724 | * into the command file */ | |
725 | Boolean errOff; /* true if we turned error checking | 725 | Boolean errOff; /* true if we turned error checking | |
726 | * off before printing the command | 726 | * off before printing the command | |
727 | * and need to turn it back on */ | 727 | * and need to turn it back on */ | |
728 | Boolean runAlways; | 728 | Boolean runAlways; | |
729 | const char *cmdTemplate; /* Template to use when printing the | 729 | const char *cmdTemplate; /* Template to use when printing the | |
730 | * command */ | 730 | * command */ | |
731 | char *cmdStart; /* Start of expanded command */ | 731 | char *cmdStart; /* Start of expanded command */ | |
732 | char *escCmd = NULL; /* Command with quotes/backticks escaped */ | 732 | char *escCmd = NULL; /* Command with quotes/backticks escaped */ | |
733 | 733 | |||
734 | noSpecials = NoExecute(job->node); | 734 | noSpecials = !GNode_ShouldExecute(job->node); | |
735 | 735 | |||
736 | #define DBPRINTF(fmt, arg) if (DEBUG(JOB)) { \ | 736 | #define DBPRINTF(fmt, arg) if (DEBUG(JOB)) { \ | |
737 | debug_printf(fmt, arg); \ | 737 | debug_printf(fmt, arg); \ | |
738 | } \ | 738 | } \ | |
739 | (void)fprintf(job->cmdFILE, fmt, arg); \ | 739 | (void)fprintf(job->cmdFILE, fmt, arg); \ | |
740 | (void)fflush(job->cmdFILE); | 740 | (void)fflush(job->cmdFILE); | |
741 | 741 | |||
742 | numCommands++; | 742 | numCommands++; | |
743 | 743 | |||
744 | Var_Subst(cmd, job->node, VARE_WANTRES, &cmd); | 744 | Var_Subst(cmd, job->node, VARE_WANTRES, &cmd); | |
745 | /* TODO: handle errors */ | 745 | /* TODO: handle errors */ | |
746 | cmdStart = cmd; | 746 | cmdStart = cmd; | |
747 | 747 | |||
@@ -1132,32 +1132,32 @@ Job_Touch(GNode *gn, Boolean silent) | @@ -1132,32 +1132,32 @@ Job_Touch(GNode *gn, Boolean silent) | |||
1132 | { | 1132 | { | |
1133 | int streamID; /* ID of stream opened to do the touch */ | 1133 | int streamID; /* ID of stream opened to do the touch */ | |
1134 | struct utimbuf times; /* Times for utime() call */ | 1134 | struct utimbuf times; /* Times for utime() call */ | |
1135 | 1135 | |||
1136 | if (gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC|OP_OPTIONAL| | 1136 | if (gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC|OP_OPTIONAL| | |
1137 | OP_SPECIAL|OP_PHONY)) { | 1137 | OP_SPECIAL|OP_PHONY)) { | |
1138 | /* | 1138 | /* | |
1139 | * .JOIN, .USE, .ZEROTIME and .OPTIONAL targets are "virtual" targets | 1139 | * .JOIN, .USE, .ZEROTIME and .OPTIONAL targets are "virtual" targets | |
1140 | * and, as such, shouldn't really be created. | 1140 | * and, as such, shouldn't really be created. | |
1141 | */ | 1141 | */ | |
1142 | return; | 1142 | return; | |
1143 | } | 1143 | } | |
1144 | 1144 | |||
1145 | if (!silent || NoExecute(gn)) { | 1145 | if (!silent || !GNode_ShouldExecute(gn)) { | |
1146 | (void)fprintf(stdout, "touch %s\n", gn->name); | 1146 | (void)fprintf(stdout, "touch %s\n", gn->name); | |
1147 | (void)fflush(stdout); | 1147 | (void)fflush(stdout); | |
1148 | } | 1148 | } | |
1149 | 1149 | |||
1150 | if (NoExecute(gn)) { | 1150 | if (!GNode_ShouldExecute(gn)) { | |
1151 | return; | 1151 | return; | |
1152 | } | 1152 | } | |
1153 | 1153 | |||
1154 | if (gn->type & OP_ARCHV) { | 1154 | if (gn->type & OP_ARCHV) { | |
1155 | Arch_Touch(gn); | 1155 | Arch_Touch(gn); | |
1156 | } else if (gn->type & OP_LIB) { | 1156 | } else if (gn->type & OP_LIB) { | |
1157 | Arch_TouchLib(gn); | 1157 | Arch_TouchLib(gn); | |
1158 | } else { | 1158 | } else { | |
1159 | const char *file = GNode_Path(gn); | 1159 | const char *file = GNode_Path(gn); | |
1160 | 1160 | |||
1161 | times.actime = times.modtime = now; | 1161 | times.actime = times.modtime = now; | |
1162 | if (utime(file, ×) < 0){ | 1162 | if (utime(file, ×) < 0){ | |
1163 | streamID = open(file, O_RDWR | O_CREAT, 0666); | 1163 | streamID = open(file, O_RDWR | O_CREAT, 0666); | |
@@ -1590,27 +1590,27 @@ JobStart(GNode *gn, int flags) | @@ -1590,27 +1590,27 @@ JobStart(GNode *gn, int flags) | |||
1590 | */ | 1590 | */ | |
1591 | numCommands = 0; | 1591 | numCommands = 0; | |
1592 | JobPrintCommands(job); | 1592 | JobPrintCommands(job); | |
1593 | 1593 | |||
1594 | /* | 1594 | /* | |
1595 | * If we didn't print out any commands to the shell script, | 1595 | * If we didn't print out any commands to the shell script, | |
1596 | * there's not much point in executing the shell, is there? | 1596 | * there's not much point in executing the shell, is there? | |
1597 | */ | 1597 | */ | |
1598 | if (numCommands == 0) { | 1598 | if (numCommands == 0) { | |
1599 | noExec = TRUE; | 1599 | noExec = TRUE; | |
1600 | } | 1600 | } | |
1601 | 1601 | |||
1602 | free(tfile); | 1602 | free(tfile); | |
1603 | } else if (NoExecute(gn)) { | 1603 | } else if (!GNode_ShouldExecute(gn)) { | |
1604 | /* | 1604 | /* | |
1605 | * Not executing anything -- just print all the commands to stdout | 1605 | * Not executing anything -- just print all the commands to stdout | |
1606 | * in one fell swoop. This will still set up job->tailCmds correctly. | 1606 | * in one fell swoop. This will still set up job->tailCmds correctly. | |
1607 | */ | 1607 | */ | |
1608 | if (lastNode != gn) { | 1608 | if (lastNode != gn) { | |
1609 | MESSAGE(stdout, gn); | 1609 | MESSAGE(stdout, gn); | |
1610 | lastNode = gn; | 1610 | lastNode = gn; | |
1611 | } | 1611 | } | |
1612 | job->cmdFILE = stdout; | 1612 | job->cmdFILE = stdout; | |
1613 | /* | 1613 | /* | |
1614 | * Only print the commands if they're ok, but don't die if they're | 1614 | * Only print the commands if they're ok, but don't die if they're | |
1615 | * not -- just let the user know they're bad and keep going. It | 1615 | * not -- just let the user know they're bad and keep going. It | |
1616 | * doesn't do any harm in this case and may do some good. | 1616 | * doesn't do any harm in this case and may do some good. |
--- src/usr.bin/make/make.c 2020/10/31 18:41:07 1.185
+++ src/usr.bin/make/make.c 2020/11/01 17:47:26 1.186
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: make.c,v 1.185 2020/10/31 18:41:07 rillig Exp $ */ | 1 | /* $NetBSD: make.c,v 1.186 2020/11/01 17:47:26 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -97,27 +97,27 @@ | @@ -97,27 +97,27 @@ | |||
97 | * Make_OODate Determine if a target is out-of-date. | 97 | * Make_OODate Determine if a target is out-of-date. | |
98 | * | 98 | * | |
99 | * Make_HandleUse See if a child is a .USE node for a parent | 99 | * Make_HandleUse See if a child is a .USE node for a parent | |
100 | * and perform the .USE actions if so. | 100 | * and perform the .USE actions if so. | |
101 | * | 101 | * | |
102 | * Make_ExpandUse Expand .USE nodes | 102 | * Make_ExpandUse Expand .USE nodes | |
103 | */ | 103 | */ | |
104 | 104 | |||
105 | #include "make.h" | 105 | #include "make.h" | |
106 | #include "dir.h" | 106 | #include "dir.h" | |
107 | #include "job.h" | 107 | #include "job.h" | |
108 | 108 | |||
109 | /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ | 109 | /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ | |
110 | MAKE_RCSID("$NetBSD: make.c,v 1.185 2020/10/31 18:41:07 rillig Exp $"); | 110 | MAKE_RCSID("$NetBSD: make.c,v 1.186 2020/11/01 17:47:26 rillig Exp $"); | |
111 | 111 | |||
112 | /* Sequence # to detect recursion. */ | 112 | /* Sequence # to detect recursion. */ | |
113 | static unsigned int checked = 1; | 113 | static unsigned int checked = 1; | |
114 | 114 | |||
115 | /* The current fringe of the graph. | 115 | /* The current fringe of the graph. | |
116 | * These are nodes which await examination by MakeOODate. | 116 | * These are nodes which await examination by MakeOODate. | |
117 | * It is added to by Make_Update and subtracted from by MakeStartJobs */ | 117 | * It is added to by Make_Update and subtracted from by MakeStartJobs */ | |
118 | static GNodeList *toBeMade; | 118 | static GNodeList *toBeMade; | |
119 | 119 | |||
120 | static int MakeCheckOrder(void *, void *); | 120 | static int MakeCheckOrder(void *, void *); | |
121 | static int MakeBuildParent(void *, void *); | 121 | static int MakeBuildParent(void *, void *); | |
122 | 122 | |||
123 | void | 123 | void | |
@@ -168,29 +168,29 @@ GNode_FprintDetails(FILE *f, const char | @@ -168,29 +168,29 @@ GNode_FprintDetails(FILE *f, const char | |||
168 | char flags_buf[GNodeFlags_ToStringSize]; | 168 | char flags_buf[GNodeFlags_ToStringSize]; | |
169 | 169 | |||
170 | fprintf(f, "%smade %s, type %s, flags %s%s", | 170 | fprintf(f, "%smade %s, type %s, flags %s%s", | |
171 | prefix, | 171 | prefix, | |
172 | Enum_ValueToString(gn->made, GNodeMade_ToStringSpecs), | 172 | Enum_ValueToString(gn->made, GNodeMade_ToStringSpecs), | |
173 | Enum_FlagsToString(type_buf, sizeof type_buf, | 173 | Enum_FlagsToString(type_buf, sizeof type_buf, | |
174 | gn->type, GNodeType_ToStringSpecs), | 174 | gn->type, GNodeType_ToStringSpecs), | |
175 | Enum_FlagsToString(flags_buf, sizeof flags_buf, | 175 | Enum_FlagsToString(flags_buf, sizeof flags_buf, | |
176 | gn->flags, GNodeFlags_ToStringSpecs), | 176 | gn->flags, GNodeFlags_ToStringSpecs), | |
177 | suffix); | 177 | suffix); | |
178 | } | 178 | } | |
179 | 179 | |||
180 | Boolean | 180 | Boolean | |
181 | NoExecute(GNode *gn) | 181 | GNode_ShouldExecute(GNode *gn) | |
182 | { | 182 | { | |
183 | return (gn->type & OP_MAKE) ? opts.noRecursiveExecute : opts.noExecute; | 183 | return !((gn->type & OP_MAKE) ? opts.noRecursiveExecute : opts.noExecute); | |
184 | } | 184 | } | |
185 | 185 | |||
186 | /* Update the youngest child of the node, according to the given child. */ | 186 | /* Update the youngest child of the node, according to the given child. */ | |
187 | void | 187 | void | |
188 | Make_TimeStamp(GNode *pgn, GNode *cgn) | 188 | Make_TimeStamp(GNode *pgn, GNode *cgn) | |
189 | { | 189 | { | |
190 | if (pgn->youngestChild == NULL || cgn->mtime > pgn->youngestChild->mtime) { | 190 | if (pgn->youngestChild == NULL || cgn->mtime > pgn->youngestChild->mtime) { | |
191 | pgn->youngestChild = cgn; | 191 | pgn->youngestChild = cgn; | |
192 | } | 192 | } | |
193 | } | 193 | } | |
194 | 194 | |||
195 | /* See if the node is out of date with respect to its sources. | 195 | /* See if the node is out of date with respect to its sources. | |
196 | * | 196 | * | |
@@ -537,27 +537,27 @@ Make_Recheck(GNode *gn) | @@ -537,27 +537,27 @@ Make_Recheck(GNode *gn) | |||
537 | * machine will not be modified before the local stat() implied by | 537 | * machine will not be modified before the local stat() implied by | |
538 | * the Dir_MTime occurs, thus leading us to believe that the file | 538 | * the Dir_MTime occurs, thus leading us to believe that the file | |
539 | * is unchanged, wreaking havoc with files that depend on this one. | 539 | * is unchanged, wreaking havoc with files that depend on this one. | |
540 | * | 540 | * | |
541 | * I have decided it is better to make too much than to make too | 541 | * I have decided it is better to make too much than to make too | |
542 | * little, so this stuff is commented out unless you're sure it's ok. | 542 | * little, so this stuff is commented out unless you're sure it's ok. | |
543 | * -- ardeb 1/12/88 | 543 | * -- ardeb 1/12/88 | |
544 | */ | 544 | */ | |
545 | /* | 545 | /* | |
546 | * Christos, 4/9/92: If we are saving commands pretend that | 546 | * Christos, 4/9/92: If we are saving commands pretend that | |
547 | * the target is made now. Otherwise archives with ... rules | 547 | * the target is made now. Otherwise archives with ... rules | |
548 | * don't work! | 548 | * don't work! | |
549 | */ | 549 | */ | |
550 | if (NoExecute(gn) || (gn->type & OP_SAVE_CMDS) || | 550 | if (!GNode_ShouldExecute(gn) || (gn->type & OP_SAVE_CMDS) || | |
551 | (mtime == 0 && !(gn->type & OP_WAIT))) { | 551 | (mtime == 0 && !(gn->type & OP_WAIT))) { | |
552 | DEBUG2(MAKE, " recheck(%s): update time from %s to now\n", | 552 | DEBUG2(MAKE, " recheck(%s): update time from %s to now\n", | |
553 | gn->name, Targ_FmtTime(gn->mtime)); | 553 | gn->name, Targ_FmtTime(gn->mtime)); | |
554 | gn->mtime = now; | 554 | gn->mtime = now; | |
555 | } | 555 | } | |
556 | else { | 556 | else { | |
557 | DEBUG2(MAKE, " recheck(%s): current update time: %s\n", | 557 | DEBUG2(MAKE, " recheck(%s): current update time: %s\n", | |
558 | gn->name, Targ_FmtTime(gn->mtime)); | 558 | gn->name, Targ_FmtTime(gn->mtime)); | |
559 | } | 559 | } | |
560 | #endif | 560 | #endif | |
561 | return mtime; | 561 | return mtime; | |
562 | } | 562 | } | |
563 | 563 |
--- src/usr.bin/make/make.h 2020/10/31 11:54:33 1.178
+++ src/usr.bin/make/make.h 2020/11/01 17:47:26 1.179
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: make.h,v 1.178 2020/10/31 11:54:33 rillig Exp $ */ | 1 | /* $NetBSD: make.h,v 1.179 2020/11/01 17:47:26 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -619,27 +619,27 @@ Boolean Make_OODate(GNode *); | @@ -619,27 +619,27 @@ Boolean Make_OODate(GNode *); | |||
619 | void Make_ExpandUse(GNodeList *); | 619 | void Make_ExpandUse(GNodeList *); | |
620 | time_t Make_Recheck(GNode *); | 620 | time_t Make_Recheck(GNode *); | |
621 | void Make_HandleUse(GNode *, GNode *); | 621 | void Make_HandleUse(GNode *, GNode *); | |
622 | void Make_Update(GNode *); | 622 | void Make_Update(GNode *); | |
623 | void Make_DoAllVar(GNode *); | 623 | void Make_DoAllVar(GNode *); | |
624 | Boolean Make_Run(GNodeList *); | 624 | Boolean Make_Run(GNodeList *); | |
625 | int dieQuietly(GNode *, int); | 625 | int dieQuietly(GNode *, int); | |
626 | void PrintOnError(GNode *, const char *); | 626 | void PrintOnError(GNode *, const char *); | |
627 | void Main_ExportMAKEFLAGS(Boolean); | 627 | void Main_ExportMAKEFLAGS(Boolean); | |
628 | Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2); | 628 | Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2); | |
629 | int mkTempFile(const char *, char **); | 629 | int mkTempFile(const char *, char **); | |
630 | int str2Lst_Append(StringList *, char *, const char *); | 630 | int str2Lst_Append(StringList *, char *, const char *); | |
631 | void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *); | 631 | void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *); | |
632 | Boolean NoExecute(GNode *gn); | 632 | Boolean GNode_ShouldExecute(GNode *gn); | |
633 | 633 | |||
634 | /* See if the node was seen on the left-hand side of a dependency operator. */ | 634 | /* See if the node was seen on the left-hand side of a dependency operator. */ | |
635 | static MAKE_ATTR_UNUSED Boolean | 635 | static MAKE_ATTR_UNUSED Boolean | |
636 | GNode_IsTarget(const GNode *gn) | 636 | GNode_IsTarget(const GNode *gn) | |
637 | { | 637 | { | |
638 | return (gn->type & OP_OPMASK) != 0; | 638 | return (gn->type & OP_OPMASK) != 0; | |
639 | } | 639 | } | |
640 | 640 | |||
641 | static MAKE_ATTR_UNUSED const char * | 641 | static MAKE_ATTR_UNUSED const char * | |
642 | GNode_Path(const GNode *gn) | 642 | GNode_Path(const GNode *gn) | |
643 | { | 643 | { | |
644 | return gn->path != NULL ? gn->path : gn->name; | 644 | return gn->path != NULL ? gn->path : gn->name; | |
645 | } | 645 | } |