Module Name:    src
Committed By:   sjg
Date:           Tue Jun 25 00:20:54 UTC 2013

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

Log Message:
Add .MAKE.META.IGNORE_PATHS to facilitate local additions to the paths
which should be ignored by meta_oodate().


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/usr.bin/make/make.1
cvs rdiff -u -r1.31 -r1.32 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.215 src/usr.bin/make/make.1:1.216
--- src/usr.bin/make/make.1:1.215	Wed May 22 19:35:11 2013
+++ src/usr.bin/make/make.1	Tue Jun 25 00:20:54 2013
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.215 2013/05/22 19:35:11 christos Exp $
+.\"	$NetBSD: make.1,v 1.216 2013/06/25 00:20:54 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 May 22, 2013
+.Dd June 24, 2013
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -856,6 +856,11 @@ In "meta" mode, this variable contains a
 used (updated or not).
 This list can be used to process the meta files to extract dependency
 information.
+.It Va .MAKE.META.IGNORE_PATHS
+Provides a list of path prefixes that should be ignored;
+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.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.31 src/usr.bin/make/meta.c:1.32
--- src/usr.bin/make/meta.c:1.31	Mon Jun 24 21:16:02 2013
+++ src/usr.bin/make/meta.c	Tue Jun 25 00:20:54 2013
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.31 2013/06/24 21:16:02 sjg Exp $ */
+/*      $NetBSD: meta.c,v 1.32 2013/06/25 00:20:54 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -55,7 +55,12 @@
 #endif
 
 static BuildMon Mybm;			/* for compat */
-static Lst metaBailiwick;			/* our scope of control */
+static Lst metaBailiwick;		/* our scope of control */
+static Lst metaIgnorePaths;		/* paths we deliberately ignore */
+
+#ifndef MAKE_META_IGNORE_PATHS
+#define MAKE_META_IGNORE_PATHS ".MAKE.META.IGNORE_PATHS"
+#endif
 
 Boolean useMeta = FALSE;
 static Boolean useFilemon = FALSE;
@@ -607,6 +612,17 @@ meta_mode_init(const char *make_mode)
     if (cp) {
 	str2Lst_Append(metaBailiwick, cp, NULL);
     }
+    /*
+     * We ignore any paths that start with ${.MAKE.META.IGNORE_PATHS}
+     */
+    metaIgnorePaths = Lst_Init(FALSE);
+    Var_Append(MAKE_META_IGNORE_PATHS,
+	       "/dev /etc /proc /tmp /var/run /var/tmp ${TMPDIR}", VAR_GLOBAL);
+    cp = Var_Subst(NULL,
+		   "${" MAKE_META_IGNORE_PATHS ":O:u:tA}", VAR_GLOBAL, 0);
+    if (cp) {
+	str2Lst_Append(metaIgnorePaths, cp, NULL);
+    }
 }
 
 /*
@@ -1110,24 +1126,15 @@ meta_oodate(GNode *gn, Boolean oodate)
 		     * be part of the dependencies because
 		     * they are _expected_ to change.
 		     */
-		    if (strncmp(p, "/tmp/", 5) == 0 ||
-			(tmplen > 0 && strncmp(p, tmpdir, tmplen) == 0))
-			break;
-
-		    if (strncmp(p, "/var/", 5) == 0)
-			break;
-
-		    /* Ignore device files. */
-		    if (strncmp(p, "/dev/", 5) == 0)
-			break;
-
-		    /* Ignore /etc/ files. */
-		    if (strncmp(p, "/etc/", 5) == 0)
-			break;
-
-		    /* Ignore /proc/ too. */
-		    if (strncmp(p, "/proc/", 6) == 0)
+		    if (*p == '/' &&
+			Lst_ForEach(metaIgnorePaths, prefix_match, p)) {
+#ifdef DEBUG_META_MODE
+			if (DEBUG(META))
+			    fprintf(debug_file, "meta_oodate: ignoring: %s\n",
+				    p);
+#endif
 			break;
+		    }
 
 		    if ((cp = strrchr(p, '/'))) {
 			cp++;

Reply via email to