Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Restore previous behavior - supressing duplicat...
details: https://anonhg.NetBSD.org/src/rev/02de5f080bff
branches: trunk
changeset: 778996:02de5f080bff
user: sjg <sjg%NetBSD.org@localhost>
date: Tue Apr 24 20:12:16 2012 +0000
description:
Restore previous behavior - supressing duplicate entries in
.MAKE.MAKEFILES - it is more efficient.
diffstat:
usr.bin/make/make.1 | 5 +++--
usr.bin/make/parse.c | 38 ++++++++++++++++++++++++++++++++++----
2 files changed, 37 insertions(+), 6 deletions(-)
diffs (98 lines):
diff -r b0057c02883e -r 02de5f080bff usr.bin/make/make.1
--- a/usr.bin/make/make.1 Tue Apr 24 20:04:49 2012 +0000
+++ b/usr.bin/make/make.1 Tue Apr 24 20:12:16 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.203 2012/04/20 05:33:41 sjg Exp $
+.\" $NetBSD: make.1,v 1.204 2012/04/24 20:12:16 sjg Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\"
-.Dd April 20, 2012
+.Dd April 24, 2012
.Dt MAKE 1
.Os
.Sh NAME
@@ -735,6 +735,7 @@
The list of makefiles read by
.Nm ,
which is useful for tracking dependencies.
+Each makefile is recorded only once, regardless of the number of times read.
.It Va .MAKE.MODE
Processed after reading all makefiles.
Can affect the mode that
diff -r b0057c02883e -r 02de5f080bff usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Tue Apr 24 20:04:49 2012 +0000
+++ b/usr.bin/make/parse.c Tue Apr 24 20:12:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.183 2012/04/20 05:33:42 sjg Exp $ */
+/* $NetBSD: parse.c,v 1.184 2012/04/24 20:12:16 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.183 2012/04/20 05:33:42 sjg Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.184 2012/04/24 20:12:16 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: parse.c,v 1.183 2012/04/20 05:33:42 sjg Exp $");
+__RCSID("$NetBSD: parse.c,v 1.184 2012/04/24 20:12:16 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -2239,6 +2239,36 @@
free(dirname);
}
+/*
+ * Track the makefiles we read - so makefiles can
+ * set dependencies on them.
+ * Avoid adding anything more than once.
+ */
+
+static void
+ParseTrackInput(const char *name)
+{
+ char *old;
+ char *fp = NULL;
+ size_t name_len = strlen(name);
+
+ old = Var_Value(MAKE_MAKEFILES, VAR_GLOBAL, &fp);
+ if (old) {
+ /* does it contain name? */
+ for (; old != NULL; old = strchr(old, ' ')) {
+ if (*old == ' ')
+ old++;
+ if (memcmp(old, name, name_len) == 0
+ && (old[name_len] == 0 || old[name_len] == ' '))
+ goto cleanup;
+ }
+ }
+ Var_Append (MAKE_MAKEFILES, name, VAR_GLOBAL);
+ cleanup:
+ if (fp) {
+ free(fp);
+ }
+}
/*-
@@ -2264,7 +2294,7 @@
if (name == NULL)
name = curFile->fname;
else
- Var_Append(MAKE_MAKEFILES, name, VAR_GLOBAL);
+ ParseTrackInput(name);
if (DEBUG(PARSE))
fprintf(debug_file, "Parse_SetInput: file %s, line %d, fd %d, nextbuf %p, arg %p\n",
Home |
Main Index |
Thread Index |
Old Index