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 unknown suffix fro...
details: https://anonhg.NetBSD.org/src/rev/47df1830b23f
branches: trunk
changeset: 977318:47df1830b23f
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Oct 21 06:30:30 2020 +0000
description:
make(1): extract handling of unknown suffix from SuffFindNormalDeps
diffstat:
usr.bin/make/suff.c | 81 ++++++++++++++++++++++++++++------------------------
1 files changed, 44 insertions(+), 37 deletions(-)
diffs (109 lines):
diff -r 8e2ae51ee963 -r 47df1830b23f usr.bin/make/suff.c
--- a/usr.bin/make/suff.c Wed Oct 21 06:26:46 2020 +0000
+++ b/usr.bin/make/suff.c Wed Oct 21 06:30:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.201 2020/10/21 06:26:46 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.202 2020/10/21 06:30:30 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.201 2020/10/21 06:26:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.202 2020/10/21 06:30:30 rillig Exp $");
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1639,6 +1639,46 @@
}
}
+static void
+SuffFindNormalDepsUnknown(GNode *gn, const char *sopref,
+ SrcList *srcs, SrcList *targs)
+{
+ Src *targ;
+
+ if (Lst_IsEmpty(targs) && suffNull != NULL) {
+ SUFF_DEBUG1("\tNo known suffix on %s. Using .NULL suffix\n",
+ gn->name);
+
+ targ = bmake_malloc(sizeof *targ);
+ targ->file = bmake_strdup(gn->name);
+ targ->suff = suffNull;
+ targ->suff->refCount++;
+ targ->node = gn;
+ targ->parent = NULL;
+ targ->children = 0;
+ targ->pref = bmake_strdup(sopref);
+#ifdef DEBUG_SRC
+ targ->cp = Lst_New();
+#endif
+
+ /*
+ * Only use the default suffix rules if we don't have commands
+ * defined for this gnode; traditional make programs used to
+ * not define suffix rules if the gnode had children but we
+ * don't do this anymore.
+ */
+ if (Lst_IsEmpty(gn->commands))
+ SuffAddLevel(srcs, targ);
+ else {
+ SUFF_DEBUG0("not ");
+ }
+
+ SUFF_DEBUG0("adding suffix rules\n");
+
+ Lst_Append(targs, targ);
+ }
+}
+
/* Locate implicit dependencies for regular targets.
*
* Input:
@@ -1699,41 +1739,8 @@
SuffFindNormalDepsKnown(&sd, gn, eoname, sopref, srcs, targs);
- /*
- * Handle target of unknown suffix...
- */
- if (Lst_IsEmpty(targs) && suffNull != NULL) {
- SUFF_DEBUG1("\tNo known suffix on %s. Using .NULL suffix\n",
- gn->name);
-
- targ = bmake_malloc(sizeof(Src));
- targ->file = bmake_strdup(gn->name);
- targ->suff = suffNull;
- targ->suff->refCount++;
- targ->node = gn;
- targ->parent = NULL;
- targ->children = 0;
- targ->pref = bmake_strdup(sopref);
-#ifdef DEBUG_SRC
- targ->cp = Lst_New();
-#endif
-
- /*
- * Only use the default suffix rules if we don't have commands
- * defined for this gnode; traditional make programs used to
- * not define suffix rules if the gnode had children but we
- * don't do this anymore.
- */
- if (Lst_IsEmpty(gn->commands))
- SuffAddLevel(srcs, targ);
- else {
- SUFF_DEBUG0("not ");
- }
-
- SUFF_DEBUG0("adding suffix rules\n");
-
- Lst_Append(targs, targ);
- }
+ /* Handle target of unknown suffix... */
+ SuffFindNormalDepsUnknown(gn, sopref, srcs, targs);
/*
* Using the list of possible sources built up from the target
Home |
Main Index |
Thread Index |
Old Index