Module Name: src
Committed By: sjg
Date: Tue May 10 23:45:45 UTC 2016
Modified Files:
src/usr.bin/make: make.1 meta.c
Log Message:
Allow for ignoring paths that match a set of patterns.
This can be expensive, so use with caution.
To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/usr.bin/make/make.1
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/make/meta.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.256 src/usr.bin/make/make.1:1.257
--- src/usr.bin/make/make.1:1.256 Wed Mar 16 00:19:01 2016
+++ src/usr.bin/make/make.1 Tue May 10 23:45:45 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.256 2016/03/16 00:19:01 sjg Exp $
+.\" $NetBSD: make.1,v 1.257 2016/05/10 23:45:45 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 February 19, 2016
+.Dd May 10, 2016
.Dt MAKE 1
.Os
.Sh NAME
@@ -913,6 +913,9 @@ Provides a list of path prefixes that sh
because the contents are expected to change over time.
The default list includes:
.Ql Pa /dev /etc /proc /tmp /var/run /var/tmp
+.It Va .MAKE.META.IGNORE_PATTERNS
+Provides a list of patterns to match against pathnames.
+Ignore any that match.
.It Va .MAKE.META.PREFIX
Defines the message printed for each meta file updated in "meta verbose" mode.
The default value is:
Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.55 src/usr.bin/make/meta.c:1.56
--- src/usr.bin/make/meta.c:1.55 Tue May 10 00:02:31 2016
+++ src/usr.bin/make/meta.c Tue May 10 23:45:45 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.55 2016/05/10 00:02:31 sjg Exp $ */
+/* $NetBSD: meta.c,v 1.56 2016/05/10 23:45:45 sjg Exp $ */
/*
* Implement 'meta' mode.
@@ -62,6 +62,9 @@ static char *metaIgnorePathsStr; /* stri
#ifndef MAKE_META_IGNORE_PATHS
#define MAKE_META_IGNORE_PATHS ".MAKE.META.IGNORE_PATHS"
#endif
+#ifndef MAKE_META_IGNORE_PATTERNS
+#define MAKE_META_IGNORE_PATTERNS ".MAKE.META.IGNORE_PATTERNS"
+#endif
Boolean useMeta = FALSE;
static Boolean useFilemon = FALSE;
@@ -69,6 +72,7 @@ static Boolean writeMeta = FALSE;
static Boolean metaEnv = FALSE; /* don't save env unless asked */
static Boolean metaVerbose = FALSE;
static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */
+static Boolean metaIgnorePatterns = FALSE; /* do we need to do pattern matches */
static Boolean metaCurdirOk = FALSE; /* write .meta in .CURDIR Ok? */
static Boolean metaSilent = FALSE; /* if we have a .meta be SILENT */
@@ -616,6 +620,15 @@ meta_mode_init(const char *make_mode)
if (metaIgnorePathsStr) {
str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr, NULL);
}
+
+ /*
+ * We ignore any paths that match ${.MAKE.META.IGNORE_PATTERNS}
+ */
+ cp = NULL;
+ if (Var_Value(MAKE_META_IGNORE_PATTERNS, VAR_GLOBAL, &cp)) {
+ metaIgnorePatterns = TRUE;
+ free(cp);
+ }
}
/*
@@ -1210,11 +1223,30 @@ meta_oodate(GNode *gn, Boolean oodate)
if (Lst_ForEach(metaIgnorePaths, prefix_match, fname1)) {
#ifdef DEBUG_META_MODE
if (DEBUG(META))
- fprintf(debug_file, "meta_oodate: ignoring: %s\n",
+ fprintf(debug_file, "meta_oodate: ignoring path: %s\n",
+ p);
+#endif
+ break;
+ }
+ }
+
+ if (metaIgnorePatterns) {
+ char *pm;
+
+ snprintf(fname1, sizeof(fname1),
+ "${%s:@m@${%s:L:M$m}@}",
+ MAKE_META_IGNORE_PATTERNS, p);
+ pm = Var_Subst(NULL, fname1, gn, VARF_WANTRES);
+ if (*pm) {
+#ifdef DEBUG_META_MODE
+ if (DEBUG(META))
+ fprintf(debug_file, "meta_oodate: ignoring pattern: %s\n",
p);
#endif
+ free(pm);
break;
}
+ free(pm);
}
/*