make(1): rename GNode.iParents to implicitParents The i alone was too ambiguous. It could have meant ignore, implicit, interactive, and probably many more.diff -r1.136 -r1.137 src/usr.bin/make/compat.c
(rillig)
--- src/usr.bin/make/compat.c 2020/08/30 11:12:05 1.136
+++ src/usr.bin/make/compat.c 2020/08/30 14:11:42 1.137
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: compat.c,v 1.136 2020/08/30 11:12:05 rillig Exp $ */ | 1 | /* $NetBSD: compat.c,v 1.137 2020/08/30 14:11:42 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. | |
@@ -60,34 +60,34 @@ | @@ -60,34 +60,34 @@ | |||
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
69 | * SUCH DAMAGE. | 69 | * SUCH DAMAGE. | |
70 | */ | 70 | */ | |
71 | 71 | |||
72 | #ifndef MAKE_NATIVE | 72 | #ifndef MAKE_NATIVE | |
73 | static char rcsid[] = "$NetBSD: compat.c,v 1.136 2020/08/30 11:12:05 rillig Exp $"; | 73 | static char rcsid[] = "$NetBSD: compat.c,v 1.137 2020/08/30 14:11:42 rillig Exp $"; | |
74 | #else | 74 | #else | |
75 | #include <sys/cdefs.h> | 75 | #include <sys/cdefs.h> | |
76 | #ifndef lint | 76 | #ifndef lint | |
77 | #if 0 | 77 | #if 0 | |
78 | static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; | 78 | static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; | |
79 | #else | 79 | #else | |
80 | __RCSID("$NetBSD: compat.c,v 1.136 2020/08/30 11:12:05 rillig Exp $"); | 80 | __RCSID("$NetBSD: compat.c,v 1.137 2020/08/30 14:11:42 rillig Exp $"); | |
81 | #endif | 81 | #endif | |
82 | #endif /* not lint */ | 82 | #endif /* not lint */ | |
83 | #endif | 83 | #endif | |
84 | 84 | |||
85 | /*- | 85 | /*- | |
86 | * compat.c -- | 86 | * compat.c -- | |
87 | * The routines in this file implement the full-compatibility | 87 | * The routines in this file implement the full-compatibility | |
88 | * mode of PMake. Most of the special functionality of PMake | 88 | * mode of PMake. Most of the special functionality of PMake | |
89 | * is available in this mode. Things not supported: | 89 | * is available in this mode. Things not supported: | |
90 | * - different shells. | 90 | * - different shells. | |
91 | * - friendly variable substitution. | 91 | * - friendly variable substitution. | |
92 | * | 92 | * | |
93 | * Interface: | 93 | * Interface: | |
@@ -519,27 +519,27 @@ Compat_Make(void *gnp, void *pgnp) | @@ -519,27 +519,27 @@ Compat_Make(void *gnp, void *pgnp) | |||
519 | * parent as well. | 519 | * parent as well. | |
520 | */ | 520 | */ | |
521 | gn->flags |= REMAKE; | 521 | gn->flags |= REMAKE; | |
522 | gn->made = BEINGMADE; | 522 | gn->made = BEINGMADE; | |
523 | if ((gn->type & OP_MADE) == 0) | 523 | if ((gn->type & OP_MADE) == 0) | |
524 | Suff_FindDeps(gn); | 524 | Suff_FindDeps(gn); | |
525 | Lst_ForEach(gn->children, Compat_Make, gn); | 525 | Lst_ForEach(gn->children, Compat_Make, gn); | |
526 | if ((gn->flags & REMAKE) == 0) { | 526 | if ((gn->flags & REMAKE) == 0) { | |
527 | gn->made = ABORTED; | 527 | gn->made = ABORTED; | |
528 | pgn->flags &= ~(unsigned)REMAKE; | 528 | pgn->flags &= ~(unsigned)REMAKE; | |
529 | goto cohorts; | 529 | goto cohorts; | |
530 | } | 530 | } | |
531 | 531 | |||
532 | if (Lst_FindDatum(gn->iParents, pgn) != NULL) { | 532 | if (Lst_FindDatum(gn->implicitParents, pgn) != NULL) { | |
533 | char *p1; | 533 | char *p1; | |
534 | Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn); | 534 | Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn); | |
535 | bmake_free(p1); | 535 | bmake_free(p1); | |
536 | } | 536 | } | |
537 | 537 | |||
538 | /* | 538 | /* | |
539 | * All the children were made ok. Now cmgn->mtime contains the | 539 | * All the children were made ok. Now cmgn->mtime contains the | |
540 | * modification time of the newest child, we need to find out if we | 540 | * modification time of the newest child, we need to find out if we | |
541 | * exist and when we were modified last. The criteria for datedness | 541 | * exist and when we were modified last. The criteria for datedness | |
542 | * are defined by the Make_OODate function. | 542 | * are defined by the Make_OODate function. | |
543 | */ | 543 | */ | |
544 | if (DEBUG(MAKE)) { | 544 | if (DEBUG(MAKE)) { | |
545 | fprintf(debug_file, "Examining %s...", gn->name); | 545 | fprintf(debug_file, "Examining %s...", gn->name); | |
@@ -623,27 +623,27 @@ Compat_Make(void *gnp, void *pgnp) | @@ -623,27 +623,27 @@ Compat_Make(void *gnp, void *pgnp) | |||
623 | } else if (keepgoing) { | 623 | } else if (keepgoing) { | |
624 | pgn->flags &= ~(unsigned)REMAKE; | 624 | pgn->flags &= ~(unsigned)REMAKE; | |
625 | } else { | 625 | } else { | |
626 | PrintOnError(gn, "\nStop."); | 626 | PrintOnError(gn, "\nStop."); | |
627 | exit(1); | 627 | exit(1); | |
628 | } | 628 | } | |
629 | } else if (gn->made == ERROR) { | 629 | } else if (gn->made == ERROR) { | |
630 | /* | 630 | /* | |
631 | * Already had an error when making this beastie. Tell the parent | 631 | * Already had an error when making this beastie. Tell the parent | |
632 | * to abort. | 632 | * to abort. | |
633 | */ | 633 | */ | |
634 | pgn->flags &= ~(unsigned)REMAKE; | 634 | pgn->flags &= ~(unsigned)REMAKE; | |
635 | } else { | 635 | } else { | |
636 | if (Lst_FindDatum(gn->iParents, pgn) != NULL) { | 636 | if (Lst_FindDatum(gn->implicitParents, pgn) != NULL) { | |
637 | char *p1; | 637 | char *p1; | |
638 | const char *target = Var_Value(TARGET, gn, &p1); | 638 | const char *target = Var_Value(TARGET, gn, &p1); | |
639 | Var_Set(IMPSRC, target != NULL ? target : "", pgn); | 639 | Var_Set(IMPSRC, target != NULL ? target : "", pgn); | |
640 | bmake_free(p1); | 640 | bmake_free(p1); | |
641 | } | 641 | } | |
642 | switch(gn->made) { | 642 | switch(gn->made) { | |
643 | case BEINGMADE: | 643 | case BEINGMADE: | |
644 | Error("Graph cycles through %s", gn->name); | 644 | Error("Graph cycles through %s", gn->name); | |
645 | gn->made = ERROR; | 645 | gn->made = ERROR; | |
646 | pgn->flags &= ~(unsigned)REMAKE; | 646 | pgn->flags &= ~(unsigned)REMAKE; | |
647 | break; | 647 | break; | |
648 | case MADE: | 648 | case MADE: | |
649 | if ((gn->type & OP_EXEC) == 0) { | 649 | if ((gn->type & OP_EXEC) == 0) { |
--- src/usr.bin/make/dir.c 2020/08/30 11:15:05 1.126
+++ src/usr.bin/make/dir.c 2020/08/30 14:11:42 1.127
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: dir.c,v 1.126 2020/08/30 11:15:05 rillig Exp $ */ | 1 | /* $NetBSD: dir.c,v 1.127 2020/08/30 14:11:42 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. | |
@@ -60,34 +60,34 @@ | @@ -60,34 +60,34 @@ | |||
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
69 | * SUCH DAMAGE. | 69 | * SUCH DAMAGE. | |
70 | */ | 70 | */ | |
71 | 71 | |||
72 | #ifndef MAKE_NATIVE | 72 | #ifndef MAKE_NATIVE | |
73 | static char rcsid[] = "$NetBSD: dir.c,v 1.126 2020/08/30 11:15:05 rillig Exp $"; | 73 | static char rcsid[] = "$NetBSD: dir.c,v 1.127 2020/08/30 14:11:42 rillig Exp $"; | |
74 | #else | 74 | #else | |
75 | #include <sys/cdefs.h> | 75 | #include <sys/cdefs.h> | |
76 | #ifndef lint | 76 | #ifndef lint | |
77 | #if 0 | 77 | #if 0 | |
78 | static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; | 78 | static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; | |
79 | #else | 79 | #else | |
80 | __RCSID("$NetBSD: dir.c,v 1.126 2020/08/30 11:15:05 rillig Exp $"); | 80 | __RCSID("$NetBSD: dir.c,v 1.127 2020/08/30 14:11:42 rillig Exp $"); | |
81 | #endif | 81 | #endif | |
82 | #endif /* not lint */ | 82 | #endif /* not lint */ | |
83 | #endif | 83 | #endif | |
84 | 84 | |||
85 | /*- | 85 | /*- | |
86 | * dir.c -- | 86 | * dir.c -- | |
87 | * Directory searching using wildcards and/or normal names... | 87 | * Directory searching using wildcards and/or normal names... | |
88 | * Used both for source wildcarding in the Makefile and for finding | 88 | * Used both for source wildcarding in the Makefile and for finding | |
89 | * implicit sources. | 89 | * implicit sources. | |
90 | * | 90 | * | |
91 | * The interface for this module is: | 91 | * The interface for this module is: | |
92 | * Dir_Init Initialize the module. | 92 | * Dir_Init Initialize the module. | |
93 | * | 93 | * | |
@@ -1424,27 +1424,27 @@ Dir_MTime(GNode *gn, Boolean recheck) | @@ -1424,27 +1424,27 @@ Dir_MTime(GNode *gn, Boolean recheck) | |||
1424 | struct stat stb; /* buffer for finding the mod time */ | 1424 | struct stat stb; /* buffer for finding the mod time */ | |
1425 | 1425 | |||
1426 | if (gn->type & OP_ARCHV) { | 1426 | if (gn->type & OP_ARCHV) { | |
1427 | return Arch_MTime(gn); | 1427 | return Arch_MTime(gn); | |
1428 | } else if (gn->type & OP_PHONY) { | 1428 | } else if (gn->type & OP_PHONY) { | |
1429 | gn->mtime = 0; | 1429 | gn->mtime = 0; | |
1430 | return 0; | 1430 | return 0; | |
1431 | } else if (gn->path == NULL) { | 1431 | } else if (gn->path == NULL) { | |
1432 | if (gn->type & OP_NOPATH) | 1432 | if (gn->type & OP_NOPATH) | |
1433 | fullName = NULL; | 1433 | fullName = NULL; | |
1434 | else { | 1434 | else { | |
1435 | fullName = Dir_FindFile(gn->name, Suff_FindPath(gn)); | 1435 | fullName = Dir_FindFile(gn->name, Suff_FindPath(gn)); | |
1436 | if (fullName == NULL && gn->flags & FROM_DEPEND && | 1436 | if (fullName == NULL && gn->flags & FROM_DEPEND && | |
1437 | !Lst_IsEmpty(gn->iParents)) { | 1437 | !Lst_IsEmpty(gn->implicitParents)) { | |
1438 | char *cp; | 1438 | char *cp; | |
1439 | 1439 | |||
1440 | cp = strrchr(gn->name, '/'); | 1440 | cp = strrchr(gn->name, '/'); | |
1441 | if (cp) { | 1441 | if (cp) { | |
1442 | /* | 1442 | /* | |
1443 | * This is an implied source, and it may have moved, | 1443 | * This is an implied source, and it may have moved, | |
1444 | * see if we can find it via the current .PATH | 1444 | * see if we can find it via the current .PATH | |
1445 | */ | 1445 | */ | |
1446 | cp++; | 1446 | cp++; | |
1447 | 1447 | |||
1448 | fullName = Dir_FindFile(cp, Suff_FindPath(gn)); | 1448 | fullName = Dir_FindFile(cp, Suff_FindPath(gn)); | |
1449 | if (fullName) { | 1449 | if (fullName) { | |
1450 | /* | 1450 | /* |
--- src/usr.bin/make/make.c 2020/08/30 11:15:05 1.132
+++ src/usr.bin/make/make.c 2020/08/30 14:11:42 1.133
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: make.c,v 1.132 2020/08/30 11:15:05 rillig Exp $ */ | 1 | /* $NetBSD: make.c,v 1.133 2020/08/30 14:11:42 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. | |
@@ -59,34 +59,34 @@ | @@ -59,34 +59,34 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: make.c,v 1.132 2020/08/30 11:15:05 rillig Exp $"; | 72 | static char rcsid[] = "$NetBSD: make.c,v 1.133 2020/08/30 14:11:42 rillig Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | #if 0 | 76 | #if 0 | |
77 | static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; | 77 | static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; | |
78 | #else | 78 | #else | |
79 | __RCSID("$NetBSD: make.c,v 1.132 2020/08/30 11:15:05 rillig Exp $"); | 79 | __RCSID("$NetBSD: make.c,v 1.133 2020/08/30 14:11:42 rillig Exp $"); | |
80 | #endif | 80 | #endif | |
81 | #endif /* not lint */ | 81 | #endif /* not lint */ | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | /*- | 84 | /*- | |
85 | * make.c -- | 85 | * make.c -- | |
86 | * The functions which perform the examination of targets and | 86 | * The functions which perform the examination of targets and | |
87 | * their suitability for creation | 87 | * their suitability for creation | |
88 | * | 88 | * | |
89 | * Interface: | 89 | * Interface: | |
90 | * Make_Run Initialize things for the module and recreate | 90 | * Make_Run Initialize things for the module and recreate | |
91 | * whatever needs recreating. Returns TRUE if | 91 | * whatever needs recreating. Returns TRUE if | |
92 | * work was (or would have been) done and FALSE | 92 | * work was (or would have been) done and FALSE | |
@@ -685,27 +685,27 @@ Make_Recheck(GNode *gn) | @@ -685,27 +685,27 @@ Make_Recheck(GNode *gn) | |||
685 | * If the child wasn't made, the cmgn field of the parent will be | 685 | * If the child wasn't made, the cmgn field of the parent will be | |
686 | * altered if the child's mtime is big enough. | 686 | * altered if the child's mtime is big enough. | |
687 | * | 687 | * | |
688 | * Finally, if the child is the implied source for the parent, the | 688 | * Finally, if the child is the implied source for the parent, the | |
689 | * parent's IMPSRC variable is set appropriately. | 689 | * parent's IMPSRC variable is set appropriately. | |
690 | * | 690 | * | |
691 | *----------------------------------------------------------------------- | 691 | *----------------------------------------------------------------------- | |
692 | */ | 692 | */ | |
693 | void | 693 | void | |
694 | Make_Update(GNode *cgn) | 694 | Make_Update(GNode *cgn) | |
695 | { | 695 | { | |
696 | GNode *pgn; /* the parent node */ | 696 | GNode *pgn; /* the parent node */ | |
697 | const char *cname; /* the child's name */ | 697 | const char *cname; /* the child's name */ | |
698 | LstNode ln; /* Element in parents and iParents lists */ | 698 | LstNode ln; /* Element in parents and implicitParents lists */ | |
699 | time_t mtime = -1; | 699 | time_t mtime = -1; | |
700 | char *p1; | 700 | char *p1; | |
701 | Lst parents; | 701 | Lst parents; | |
702 | GNode *centurion; | 702 | GNode *centurion; | |
703 | 703 | |||
704 | /* It is save to re-examine any nodes again */ | 704 | /* It is save to re-examine any nodes again */ | |
705 | checked++; | 705 | checked++; | |
706 | 706 | |||
707 | cname = Var_Value(TARGET, cgn, &p1); | 707 | cname = Var_Value(TARGET, cgn, &p1); | |
708 | bmake_free(p1); | 708 | bmake_free(p1); | |
709 | 709 | |||
710 | if (DEBUG(MAKE)) | 710 | if (DEBUG(MAKE)) | |
711 | fprintf(debug_file, "Make_Update: %s%s\n", cgn->name, cgn->cohort_num); | 711 | fprintf(debug_file, "Make_Update: %s%s\n", cgn->name, cgn->cohort_num); | |
@@ -828,40 +828,40 @@ Make_Update(GNode *cgn) | @@ -828,40 +828,40 @@ Make_Update(GNode *cgn) | |||
828 | pgn->name, pgn->cohort_num, pgn->made); | 828 | pgn->name, pgn->cohort_num, pgn->made); | |
829 | Targ_PrintNode(pgn, &two); | 829 | Targ_PrintNode(pgn, &two); | |
830 | } | 830 | } | |
831 | /* Ok, we can schedule the parent again */ | 831 | /* Ok, we can schedule the parent again */ | |
832 | pgn->made = REQUESTED; | 832 | pgn->made = REQUESTED; | |
833 | Lst_Enqueue(toBeMade, pgn); | 833 | Lst_Enqueue(toBeMade, pgn); | |
834 | } | 834 | } | |
835 | Lst_Close(parents); | 835 | Lst_Close(parents); | |
836 | 836 | |||
837 | /* | 837 | /* | |
838 | * Set the .PREFIX and .IMPSRC variables for all the implied parents | 838 | * Set the .PREFIX and .IMPSRC variables for all the implied parents | |
839 | * of this node. | 839 | * of this node. | |
840 | */ | 840 | */ | |
841 | Lst_Open(cgn->iParents); | 841 | Lst_Open(cgn->implicitParents); | |
842 | { | 842 | { | |
843 | const char *cpref = Var_Value(PREFIX, cgn, &p1); | 843 | const char *cpref = Var_Value(PREFIX, cgn, &p1); | |
844 | 844 | |||
845 | while ((ln = Lst_Next(cgn->iParents)) != NULL) { | 845 | while ((ln = Lst_Next(cgn->implicitParents)) != NULL) { | |
846 | pgn = LstNode_Datum(ln); | 846 | pgn = LstNode_Datum(ln); | |
847 | if (pgn->flags & REMAKE) { | 847 | if (pgn->flags & REMAKE) { | |
848 | Var_Set(IMPSRC, cname, pgn); | 848 | Var_Set(IMPSRC, cname, pgn); | |
849 | if (cpref != NULL) | 849 | if (cpref != NULL) | |
850 | Var_Set(PREFIX, cpref, pgn); | 850 | Var_Set(PREFIX, cpref, pgn); | |
851 | } | 851 | } | |
852 | } | 852 | } | |
853 | bmake_free(p1); | 853 | bmake_free(p1); | |
854 | Lst_Close(cgn->iParents); | 854 | Lst_Close(cgn->implicitParents); | |
855 | } | 855 | } | |
856 | } | 856 | } | |
857 | 857 | |||
858 | /*- | 858 | /*- | |
859 | *----------------------------------------------------------------------- | 859 | *----------------------------------------------------------------------- | |
860 | * MakeAddAllSrc -- | 860 | * MakeAddAllSrc -- | |
861 | * Add a child's name to the ALLSRC and OODATE variables of the given | 861 | * Add a child's name to the ALLSRC and OODATE variables of the given | |
862 | * node. Called from Make_DoAllVar via Lst_ForEach. A child is added only | 862 | * node. Called from Make_DoAllVar via Lst_ForEach. A child is added only | |
863 | * if it has not been given the .EXEC, .USE or .INVISIBLE attributes. | 863 | * if it has not been given the .EXEC, .USE or .INVISIBLE attributes. | |
864 | * .EXEC and .USE children are very rarely going to be files, so... | 864 | * .EXEC and .USE children are very rarely going to be files, so... | |
865 | * If the child is a .JOIN node, its ALLSRC is propagated to the parent. | 865 | * If the child is a .JOIN node, its ALLSRC is propagated to the parent. | |
866 | * | 866 | * | |
867 | * A child is added to the OODATE variable if its modification time is | 867 | * A child is added to the OODATE variable if its modification time is |
--- src/usr.bin/make/make.h 2020/08/29 12:20:17 1.132
+++ src/usr.bin/make/make.h 2020/08/30 14:11:42 1.133
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: make.h,v 1.132 2020/08/29 12:20:17 rillig Exp $ */ | 1 | /* $NetBSD: make.h,v 1.133 2020/08/30 14:11:42 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. | |
@@ -283,29 +283,30 @@ typedef struct GNode { | @@ -283,29 +283,30 @@ typedef struct GNode { | |||
283 | /* The type of operator used to define the sources (see the OP flags below). | 283 | /* The type of operator used to define the sources (see the OP flags below). | |
284 | * XXX: This looks like a wild mixture of type and flags. */ | 284 | * XXX: This looks like a wild mixture of type and flags. */ | |
285 | GNodeType type; | 285 | GNodeType type; | |
286 | /* whether it is involved in this invocation of make */ | 286 | /* whether it is involved in this invocation of make */ | |
287 | GNodeFlags flags; | 287 | GNodeFlags flags; | |
288 | 288 | |||
289 | /* The state of processing on this node */ | 289 | /* The state of processing on this node */ | |
290 | GNodeMade made; | 290 | GNodeMade made; | |
291 | int unmade; /* The number of unmade children */ | 291 | int unmade; /* The number of unmade children */ | |
292 | 292 | |||
293 | time_t mtime; /* Its modification time */ | 293 | time_t mtime; /* Its modification time */ | |
294 | struct GNode *cmgn; /* The youngest child */ | 294 | struct GNode *cmgn; /* The youngest child */ | |
295 | 295 | |||
296 | /* Links to parents for which this is an implied source. May be empty. | 296 | /* The GNodes for which this node is an implied source. May be empty. | |
297 | * Nodes that depend on this, as gleaned from the transformation rules. */ | 297 | * For example, when there is an inference rule for .c.o, the node for | |
298 | Lst iParents; | 298 | * file.c has the node for file.o in this list. */ | |
299 | Lst implicitParents; | |||
299 | 300 | |||
300 | /* Other nodes of the same name for the :: operator. */ | 301 | /* Other nodes of the same name for the :: operator. */ | |
301 | Lst cohorts; | 302 | Lst cohorts; | |
302 | 303 | |||
303 | /* The nodes that depend on this one, or in other words, the nodes for | 304 | /* The nodes that depend on this one, or in other words, the nodes for | |
304 | * which this is a source. */ | 305 | * which this is a source. */ | |
305 | Lst parents; | 306 | Lst parents; | |
306 | /* The nodes on which this one depends. */ | 307 | /* The nodes on which this one depends. */ | |
307 | Lst children; | 308 | Lst children; | |
308 | 309 | |||
309 | /* .ORDER nodes we need made. The nodes that must be made (if they're | 310 | /* .ORDER nodes we need made. The nodes that must be made (if they're | |
310 | * made) before this node can be made, but that do not enter into the | 311 | * made) before this node can be made, but that do not enter into the | |
311 | * datedness of this node. */ | 312 | * datedness of this node. */ |
--- src/usr.bin/make/suff.c 2020/08/30 11:15:05 1.138
+++ src/usr.bin/make/suff.c 2020/08/30 14:11:42 1.139
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: suff.c,v 1.138 2020/08/30 11:15:05 rillig Exp $ */ | 1 | /* $NetBSD: suff.c,v 1.139 2020/08/30 14:11:42 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. | |
@@ -59,34 +59,34 @@ | @@ -59,34 +59,34 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: suff.c,v 1.138 2020/08/30 11:15:05 rillig Exp $"; | 72 | static char rcsid[] = "$NetBSD: suff.c,v 1.139 2020/08/30 14:11:42 rillig Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | #if 0 | 76 | #if 0 | |
77 | static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; | 77 | static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; | |
78 | #else | 78 | #else | |
79 | __RCSID("$NetBSD: suff.c,v 1.138 2020/08/30 11:15:05 rillig Exp $"); | 79 | __RCSID("$NetBSD: suff.c,v 1.139 2020/08/30 14:11:42 rillig Exp $"); | |
80 | #endif | 80 | #endif | |
81 | #endif /* not lint */ | 81 | #endif /* not lint */ | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | /*- | 84 | /*- | |
85 | * suff.c -- | 85 | * suff.c -- | |
86 | * Functions to maintain suffix lists and find implicit dependents | 86 | * Functions to maintain suffix lists and find implicit dependents | |
87 | * using suffix transformation rules | 87 | * using suffix transformation rules | |
88 | * | 88 | * | |
89 | * Interface: | 89 | * Interface: | |
90 | * Suff_Init Initialize all things to do with suffixes. | 90 | * Suff_Init Initialize all things to do with suffixes. | |
91 | * | 91 | * | |
92 | * Suff_End Cleanup the module | 92 | * Suff_End Cleanup the module | |
@@ -1558,27 +1558,27 @@ SuffApplyTransform(GNode *tGn, GNode *sG | @@ -1558,27 +1558,27 @@ SuffApplyTransform(GNode *tGn, GNode *sG | |||
1558 | 1558 | |||
1559 | /* | 1559 | /* | |
1560 | * Deal with wildcards and variables in any acquired sources | 1560 | * Deal with wildcards and variables in any acquired sources | |
1561 | */ | 1561 | */ | |
1562 | for (ln = ln != NULL ? LstNode_Next(ln) : NULL; ln != NULL; ln = nln) { | 1562 | for (ln = ln != NULL ? LstNode_Next(ln) : NULL; ln != NULL; ln = nln) { | |
1563 | nln = LstNode_Next(ln); | 1563 | nln = LstNode_Next(ln); | |
1564 | SuffExpandChildren(ln, tGn); | 1564 | SuffExpandChildren(ln, tGn); | |
1565 | } | 1565 | } | |
1566 | 1566 | |||
1567 | /* | 1567 | /* | |
1568 | * Keep track of another parent to which this beast is transformed so | 1568 | * Keep track of another parent to which this beast is transformed so | |
1569 | * the .IMPSRC variable can be set correctly for the parent. | 1569 | * the .IMPSRC variable can be set correctly for the parent. | |
1570 | */ | 1570 | */ | |
1571 | Lst_Append(sGn->iParents, tGn); | 1571 | Lst_Append(sGn->implicitParents, tGn); | |
1572 | 1572 | |||
1573 | return TRUE; | 1573 | return TRUE; | |
1574 | } | 1574 | } | |
1575 | 1575 | |||
1576 | 1576 | |||
1577 | /* Locate dependencies for an OP_ARCHV node. | 1577 | /* Locate dependencies for an OP_ARCHV node. | |
1578 | * | 1578 | * | |
1579 | * Input: | 1579 | * Input: | |
1580 | * gn Node for which to locate dependencies | 1580 | * gn Node for which to locate dependencies | |
1581 | * | 1581 | * | |
1582 | * Side Effects: | 1582 | * Side Effects: | |
1583 | * Same as Suff_FindDeps | 1583 | * Same as Suff_FindDeps | |
1584 | */ | 1584 | */ |
--- src/usr.bin/make/targ.c 2020/08/30 11:15:05 1.79
+++ src/usr.bin/make/targ.c 2020/08/30 14:11:42 1.80
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: targ.c,v 1.79 2020/08/30 11:15:05 rillig Exp $ */ | 1 | /* $NetBSD: targ.c,v 1.80 2020/08/30 14:11:42 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. | |
@@ -59,34 +59,34 @@ | @@ -59,34 +59,34 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: targ.c,v 1.79 2020/08/30 11:15:05 rillig Exp $"; | 72 | static char rcsid[] = "$NetBSD: targ.c,v 1.80 2020/08/30 14:11:42 rillig Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | #if 0 | 76 | #if 0 | |
77 | static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; | 77 | static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; | |
78 | #else | 78 | #else | |
79 | __RCSID("$NetBSD: targ.c,v 1.79 2020/08/30 11:15:05 rillig Exp $"); | 79 | __RCSID("$NetBSD: targ.c,v 1.80 2020/08/30 14:11:42 rillig Exp $"); | |
80 | #endif | 80 | #endif | |
81 | #endif /* not lint */ | 81 | #endif /* not lint */ | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | /*- | 84 | /*- | |
85 | * targ.c -- | 85 | * targ.c -- | |
86 | * Functions for maintaining the Lst allTargets. Target nodes are | 86 | * Functions for maintaining the Lst allTargets. Target nodes are | |
87 | * kept in two structures: a Lst and a hash table. | 87 | * kept in two structures: a Lst and a hash table. | |
88 | * | 88 | * | |
89 | * Interface: | 89 | * Interface: | |
90 | * Targ_Init Initialization procedure. | 90 | * Targ_Init Initialization procedure. | |
91 | * | 91 | * | |
92 | * Targ_End Cleanup the module | 92 | * Targ_End Cleanup the module | |
@@ -195,27 +195,27 @@ Targ_NewGN(const char *name) | @@ -195,27 +195,27 @@ Targ_NewGN(const char *name) | |||
195 | gn->name = bmake_strdup(name); | 195 | gn->name = bmake_strdup(name); | |
196 | gn->uname = NULL; | 196 | gn->uname = NULL; | |
197 | gn->path = NULL; | 197 | gn->path = NULL; | |
198 | gn->type = name[0] == '-' && name[1] == 'l' ? OP_LIB : 0; | 198 | gn->type = name[0] == '-' && name[1] == 'l' ? OP_LIB : 0; | |
199 | gn->unmade = 0; | 199 | gn->unmade = 0; | |
200 | gn->unmade_cohorts = 0; | 200 | gn->unmade_cohorts = 0; | |
201 | gn->cohort_num[0] = 0; | 201 | gn->cohort_num[0] = 0; | |
202 | gn->centurion = NULL; | 202 | gn->centurion = NULL; | |
203 | gn->made = UNMADE; | 203 | gn->made = UNMADE; | |
204 | gn->flags = 0; | 204 | gn->flags = 0; | |
205 | gn->checked = 0; | 205 | gn->checked = 0; | |
206 | gn->mtime = 0; | 206 | gn->mtime = 0; | |
207 | gn->cmgn = NULL; | 207 | gn->cmgn = NULL; | |
208 | gn->iParents = Lst_Init(); | 208 | gn->implicitParents = Lst_Init(); | |
209 | gn->cohorts = Lst_Init(); | 209 | gn->cohorts = Lst_Init(); | |
210 | gn->parents = Lst_Init(); | 210 | gn->parents = Lst_Init(); | |
211 | gn->children = Lst_Init(); | 211 | gn->children = Lst_Init(); | |
212 | gn->order_pred = Lst_Init(); | 212 | gn->order_pred = Lst_Init(); | |
213 | gn->order_succ = Lst_Init(); | 213 | gn->order_succ = Lst_Init(); | |
214 | Hash_InitTable(&gn->context, 0); | 214 | Hash_InitTable(&gn->context, 0); | |
215 | gn->commands = Lst_Init(); | 215 | gn->commands = Lst_Init(); | |
216 | gn->suffix = NULL; | 216 | gn->suffix = NULL; | |
217 | gn->fname = NULL; | 217 | gn->fname = NULL; | |
218 | gn->lineno = 0; | 218 | gn->lineno = 0; | |
219 | 219 | |||
220 | #ifdef CLEANUP | 220 | #ifdef CLEANUP | |
221 | if (allGNs == NULL) | 221 | if (allGNs == NULL) | |
@@ -226,27 +226,27 @@ Targ_NewGN(const char *name) | @@ -226,27 +226,27 @@ Targ_NewGN(const char *name) | |||
226 | return gn; | 226 | return gn; | |
227 | } | 227 | } | |
228 | 228 | |||
229 | #ifdef CLEANUP | 229 | #ifdef CLEANUP | |
230 | static void | 230 | static void | |
231 | TargFreeGN(void *gnp) | 231 | TargFreeGN(void *gnp) | |
232 | { | 232 | { | |
233 | GNode *gn = (GNode *)gnp; | 233 | GNode *gn = (GNode *)gnp; | |
234 | 234 | |||
235 | free(gn->name); | 235 | free(gn->name); | |
236 | free(gn->uname); | 236 | free(gn->uname); | |
237 | free(gn->path); | 237 | free(gn->path); | |
238 | 238 | |||
239 | Lst_Free(gn->iParents); | 239 | Lst_Free(gn->implicitParents); | |
240 | Lst_Free(gn->cohorts); | 240 | Lst_Free(gn->cohorts); | |
241 | Lst_Free(gn->parents); | 241 | Lst_Free(gn->parents); | |
242 | Lst_Free(gn->children); | 242 | Lst_Free(gn->children); | |
243 | Lst_Free(gn->order_succ); | 243 | Lst_Free(gn->order_succ); | |
244 | Lst_Free(gn->order_pred); | 244 | Lst_Free(gn->order_pred); | |
245 | Hash_DeleteTable(&gn->context); | 245 | Hash_DeleteTable(&gn->context); | |
246 | Lst_Free(gn->commands); | 246 | Lst_Free(gn->commands); | |
247 | 247 | |||
248 | /* XXX: does gn->suffix need to be freed? It is reference-counted. */ | 248 | /* XXX: does gn->suffix need to be freed? It is reference-counted. */ | |
249 | /* gn->fname points to name allocated when file was opened, don't free */ | 249 | /* gn->fname points to name allocated when file was opened, don't free */ | |
250 | 250 | |||
251 | free(gn); | 251 | free(gn); | |
252 | } | 252 | } | |
@@ -479,29 +479,29 @@ Targ_PrintNode(void *gnp, void *passp) | @@ -479,29 +479,29 @@ Targ_PrintNode(void *gnp, void *passp) | |||
479 | } | 479 | } | |
480 | if (! (gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC))) { | 480 | if (! (gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC))) { | |
481 | if (gn->mtime != 0) { | 481 | if (gn->mtime != 0) { | |
482 | fprintf(debug_file, "# last modified %s: %s\n", | 482 | fprintf(debug_file, "# last modified %s: %s\n", | |
483 | Targ_FmtTime(gn->mtime), | 483 | Targ_FmtTime(gn->mtime), | |
484 | made_name(gn->made)); | 484 | made_name(gn->made)); | |
485 | } else if (gn->made != UNMADE) { | 485 | } else if (gn->made != UNMADE) { | |
486 | fprintf(debug_file, "# non-existent (maybe): %s\n", | 486 | fprintf(debug_file, "# non-existent (maybe): %s\n", | |
487 | made_name(gn->made)); | 487 | made_name(gn->made)); | |
488 | } else { | 488 | } else { | |
489 | fprintf(debug_file, "# unmade\n"); | 489 | fprintf(debug_file, "# unmade\n"); | |
490 | } | 490 | } | |
491 | } | 491 | } | |
492 | if (!Lst_IsEmpty(gn->iParents)) { | 492 | if (!Lst_IsEmpty(gn->implicitParents)) { | |
493 | fprintf(debug_file, "# implicit parents: "); | 493 | fprintf(debug_file, "# implicit parents: "); | |
494 | Lst_ForEach(gn->iParents, TargPrintName, NULL); | 494 | Lst_ForEach(gn->implicitParents, TargPrintName, NULL); | |
495 | fprintf(debug_file, "\n"); | 495 | fprintf(debug_file, "\n"); | |
496 | } | 496 | } | |
497 | } else { | 497 | } else { | |
498 | if (gn->unmade) | 498 | if (gn->unmade) | |
499 | fprintf(debug_file, "# %d unmade children\n", gn->unmade); | 499 | fprintf(debug_file, "# %d unmade children\n", gn->unmade); | |
500 | } | 500 | } | |
501 | if (!Lst_IsEmpty(gn->parents)) { | 501 | if (!Lst_IsEmpty(gn->parents)) { | |
502 | fprintf(debug_file, "# parents: "); | 502 | fprintf(debug_file, "# parents: "); | |
503 | Lst_ForEach(gn->parents, TargPrintName, NULL); | 503 | Lst_ForEach(gn->parents, TargPrintName, NULL); | |
504 | fprintf(debug_file, "\n"); | 504 | fprintf(debug_file, "\n"); | |
505 | } | 505 | } | |
506 | if (!Lst_IsEmpty(gn->order_pred)) { | 506 | if (!Lst_IsEmpty(gn->order_pred)) { | |
507 | fprintf(debug_file, "# order_pred: "); | 507 | fprintf(debug_file, "# order_pred: "); |