Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Add .MAKE.META.IGNORE_FILTER to allow more comp...



details:   https://anonhg.NetBSD.org/src/rev/1e3217bab8a2
branches:  trunk
changeset: 347145:1e3217bab8a2
user:      sjg <sjg%NetBSD.org@localhost>
date:      Mon Aug 15 19:20:17 2016 +0000

description:
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.

diffstat:

 usr.bin/make/make.1 |   7 +++++--
 usr.bin/make/meta.c |  31 ++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 3 deletions(-)

diffs (94 lines):

diff -r 220ffe137343 -r 1e3217bab8a2 usr.bin/make/make.1
--- a/usr.bin/make/make.1       Mon Aug 15 19:13:24 2016 +0000
+++ b/usr.bin/make/make.1       Mon Aug 15 19:20:17 2016 +0000
@@ -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 @@
 .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:
diff -r 220ffe137343 -r 1e3217bab8a2 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Mon Aug 15 19:13:24 2016 +0000
+++ b/usr.bin/make/meta.c       Mon Aug 15 19:20:17 2016 +0000
@@ -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 @@
 #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 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 @@
        metaIgnorePatterns = TRUE;
        free(cp);
     }
+    cp = NULL;
+    if (Var_Value(MAKE_META_IGNORE_FILTER, VAR_GLOBAL, &cp)) {
+       metaIgnoreFilter = TRUE;
+       free(cp);
+    }
 }
 
 /*
@@ -1320,6 +1329,26 @@
                        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.



Home | Main Index | Thread Index | Old Index