Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): extract handling of known suffix from ...
details: https://anonhg.NetBSD.org/src/rev/de191eafc817
branches: trunk
changeset: 941434:de191eafc817
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Oct 21 06:26:46 2020 +0000
description:
make(1): extract handling of known suffix from SuffFindNormalDeps
diffstat:
usr.bin/make/suff.c | 109 ++++++++++++++++++++++++++++-----------------------
1 files changed, 60 insertions(+), 49 deletions(-)
diffs (158 lines):
diff -r 9dbbe067c583 -r de191eafc817 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c Wed Oct 21 06:12:16 2020 +0000
+++ b/usr.bin/make/suff.c Wed Oct 21 06:26:46 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.200 2020/10/21 06:12:16 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.201 2020/10/21 06:26:46 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.200 2020/10/21 06:12:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.201 2020/10/21 06:26:46 rillig Exp $");
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1588,6 +1588,57 @@
mem->type |= OP_MEMBER | OP_JOIN | OP_MADE;
}
+static void
+SuffFindNormalDepsKnown(const struct SuffSuffGetSuffixArgs *sd, GNode *gn,
+ const char *eoname, const char *sopref,
+ SrcList *srcs, SrcList *targs)
+{
+ SuffListNode *ln = sufflist->first;
+
+ while (ln != NULL) {
+ /*
+ * Look for next possible suffix...
+ */
+ ln = Lst_FindFrom(sufflist, ln, SuffSuffIsSuffix, sd);
+
+ if (ln != NULL) {
+ const char *eopref;
+
+ /*
+ * Allocate a Src structure to which things can be transformed
+ */
+ Src *targ = bmake_malloc(sizeof(Src));
+ targ->file = bmake_strdup(gn->name);
+ targ->suff = ln->datum;
+ targ->suff->refCount++;
+ targ->node = gn;
+ targ->parent = NULL;
+ targ->children = 0;
+#ifdef DEBUG_SRC
+ targ->cp = Lst_New();
+#endif
+
+ eopref = eoname - targ->suff->nameLen;
+ targ->pref = bmake_strsedup(sopref, eopref);
+
+ /*
+ * Add nodes from which the target can be made
+ */
+ SuffAddLevel(srcs, targ);
+
+ /*
+ * Record the target so we can nuke it
+ */
+ Lst_Append(targs, targ);
+
+ /*
+ * Search from this suffix's successor...
+ */
+ ln = ln->next;
+ }
+ }
+}
+
/* Locate implicit dependencies for regular targets.
*
* Input:
@@ -1601,7 +1652,6 @@
{
char *eoname; /* End of name */
char *sopref; /* Start of prefix */
- SuffListNode *ln, *nln;
SrcList *srcs; /* List of sources at which to look */
SrcList *targs; /* List of targets to which things can be
* transformed. They all have the same file,
@@ -1621,7 +1671,6 @@
/*
* Begin at the beginning...
*/
- ln = sufflist->first;
srcs = Lst_New();
targs = Lst_New();
@@ -1648,48 +1697,7 @@
if (!(gn->type & OP_PHONY)) {
- while (ln != NULL) {
- /*
- * Look for next possible suffix...
- */
- ln = Lst_FindFrom(sufflist, ln, SuffSuffIsSuffix, &sd);
-
- if (ln != NULL) {
- const char *eopref;
-
- /*
- * Allocate a Src structure to which things can be transformed
- */
- targ = bmake_malloc(sizeof(Src));
- targ->file = bmake_strdup(gn->name);
- targ->suff = ln->datum;
- targ->suff->refCount++;
- targ->node = gn;
- targ->parent = NULL;
- targ->children = 0;
-#ifdef DEBUG_SRC
- targ->cp = Lst_New();
-#endif
-
- eopref = eoname - targ->suff->nameLen;
- targ->pref = bmake_strsedup(sopref, eopref);
-
- /*
- * Add nodes from which the target can be made
- */
- SuffAddLevel(srcs, targ);
-
- /*
- * Record the target so we can nuke it
- */
- Lst_Append(targs, targ);
-
- /*
- * Search from this suffix's successor...
- */
- ln = ln->next;
- }
- }
+ SuffFindNormalDepsKnown(&sd, gn, eoname, sopref, srcs, targs);
/*
* Handle target of unknown suffix...
@@ -1762,9 +1770,12 @@
* Now we've got the important local variables set, expand any sources
* that still contain variables or wildcards in their names.
*/
- for (ln = gn->children->first; ln != NULL; ln = nln) {
- nln = ln->next;
- SuffExpandChildren(ln, gn);
+ {
+ SuffListNode *ln, *nln;
+ for (ln = gn->children->first; ln != NULL; ln = nln) {
+ nln = ln->next;
+ SuffExpandChildren(ln, gn);
+ }
}
if (targ == NULL) {
Home |
Main Index |
Thread Index |
Old Index