Module Name:    src
Committed By:   sjg
Date:           Mon Aug 15 19:20:17 UTC 2016

Modified Files:
        src/usr.bin/make: make.1 meta.c

Log Message:
Add .MAKE.META.IGNORE_FILTER to allow more complicated filtering of filemon 
data.

The filter is applied to paths Read or Excuted, and if it expands to
nothing, the entry is skipped.

For example; dirdeps.mk can set this to:

.MAKE.META.IGNORE_FILTER = M*/${.MAKE.DEPENDFILE_PREFIX}*

when checking if DIRDEPS_CACHE is up to date, where only Makefile.depend*
are of interest.


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/usr.bin/make/make.1
cvs rdiff -u -r1.65 -r1.66 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.260 src/usr.bin/make/make.1:1.261
--- src/usr.bin/make/make.1:1.260	Wed Aug 10 23:49:12 2016
+++ src/usr.bin/make/make.1	Mon Aug 15 19:20:17 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.260 2016/08/10 23:49:12 sjg Exp $
+.\"	$NetBSD: make.1,v 1.261 2016/08/15 19:20:17 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 August 10, 2016
+.Dd August 15, 2016
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -927,6 +927,9 @@ The default list includes:
 .It Va .MAKE.META.IGNORE_PATTERNS
 Provides a list of patterns to match against pathnames.
 Ignore any that match.
+.It Va .MAKE.META.IGNORE_FILTER
+Provides a list of variable modifiers to apply to each pathname.
+Ignore if the expansion is an empty string.
 .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.65 src/usr.bin/make/meta.c:1.66
--- src/usr.bin/make/meta.c:1.65	Wed Aug 10 18:49:40 2016
+++ src/usr.bin/make/meta.c	Mon Aug 15 19:20:17 2016
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.65 2016/08/10 18:49:40 sjg Exp $ */
+/*      $NetBSD: meta.c,v 1.66 2016/08/15 19:20:17 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -65,6 +65,9 @@ static char *metaIgnorePathsStr;	/* stri
 #ifndef MAKE_META_IGNORE_PATTERNS
 #define MAKE_META_IGNORE_PATTERNS ".MAKE.META.IGNORE_PATTERNS"
 #endif
+#ifndef MAKE_META_IGNORE_FILTER
+#define MAKE_META_IGNORE_FILTER ".MAKE.META.IGNORE_FILTER"
+#endif
 
 Boolean useMeta = FALSE;
 static Boolean useFilemon = FALSE;
@@ -75,6 +78,7 @@ static Boolean metaEnv = FALSE;		/* don'
 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 metaIgnoreFilter = FALSE;   /* do we have more complex filtering? */
 static Boolean metaCurdirOk = FALSE;	/* write .meta in .CURDIR Ok? */
 static Boolean metaSilent = FALSE;	/* if we have a .meta be SILENT */
 
@@ -641,6 +645,11 @@ meta_mode_init(const char *make_mode)
 	metaIgnorePatterns = TRUE;
 	free(cp);
     }
+    cp = NULL;
+    if (Var_Value(MAKE_META_IGNORE_FILTER, VAR_GLOBAL, &cp)) {
+	metaIgnoreFilter = TRUE;
+	free(cp);
+    }
 }
 
 /*
@@ -1320,6 +1329,26 @@ meta_oodate(GNode *gn, Boolean oodate)
 			free(pm);
 		    }
 
+		    if (metaIgnoreFilter) {
+			char *fm;
+
+			/* skip if filter result is empty */
+			snprintf(fname1, sizeof(fname1),
+				 "${%s:L:${%s:ts:}}",
+				 p, MAKE_META_IGNORE_FILTER);
+			fm = Var_Subst(NULL, fname1, gn, VARF_WANTRES);
+			if (*fm == '\0') {
+#ifdef DEBUG_META_MODE
+			    if (DEBUG(META))
+				fprintf(debug_file, "meta_oodate: ignoring filtered: %s\n",
+					p);
+#endif
+			    free(fm);
+			    break;
+			}
+			free(fm);
+		    }
+		    
 		    /*
 		     * The rest of the record is the file name.
 		     * Check if it's not an absolute path.

Reply via email to