Module Name:    src
Committed By:   sjg
Date:           Sun Mar 27 19:39:21 UTC 2011

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

Log Message:
When .MAKE.MODE inlcudes 'meta'; 'curdir=true' enables creating .meta
files in .CURDIR - such as when running make in .OBJDIR with a generated
makefile.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/usr.bin/make/make.1
cvs rdiff -u -r1.11 -r1.12 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.183 src/usr.bin/make/make.1:1.184
--- src/usr.bin/make/make.1:1.183	Sat Feb 26 01:17:24 2011
+++ src/usr.bin/make/make.1	Sun Mar 27 19:39:21 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.183 2011/02/26 01:17:24 sjg Exp $
+.\"	$NetBSD: make.1,v 1.184 2011/03/27 19:39:21 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 25, 2011
+.Dd March 27, 2011
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -767,7 +767,7 @@
 .Bl -hang -width ignore-cmd
 .It Pa compat
 Like
-.Fl B
+.Fl B ,
 puts
 .Nm
 into "compat" mode.
@@ -780,6 +780,14 @@
 is available, the system calls which are of interest to
 .Nm .
 The captured output can be very useful when diagnosing errors.
+.It Pa curdir= Ar bf
+Normally
+.Nm
+will not create .meta files in
+.Ql Va .CURDIR .
+This can be overridden by setting
+.Va bf 
+to a value which represents True.
 .It Pa verbose
 If in "meta" mode, print a clue about the target being built.
 This is useful if the build is otherwise running silently.

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.11 src/usr.bin/make/meta.c:1.12
--- src/usr.bin/make/meta.c:1.11	Sun Mar  6 17:41:11 2011
+++ src/usr.bin/make/meta.c	Sun Mar 27 19:39:21 2011
@@ -60,6 +60,7 @@
 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 metaCurdirOk = FALSE;	/* write .meta in .CURDIR Ok? */
 
 extern Boolean forceJobs;
 extern Boolean comatMake;
@@ -435,7 +436,7 @@
 	dname = objdir;
 
     /* If we aren't in the object directory, don't create a meta file. */
-    if (strcmp(curdir, dname) == 0) {
+    if (!metaCurdirOk && strcmp(curdir, dname) == 0) {
 	if (DEBUG(META))
 	    fprintf(debug_file, "Skipping meta for %s: .OBJDIR == .CURDIR\n",
 		    gn->name);
@@ -516,11 +517,25 @@
     return (mf.fp);
 }
 
+static Boolean
+boolValue(char *s)
+{
+    switch(*s) {
+    case '0':
+    case 'N':
+    case 'n':
+    case 'F':
+    case 'f':
+	return FALSE;
+    }
+    return TRUE;
+}
 
 void
 meta_init(const char *make_mode)
 {
     static int once = 0;
+    char *cp;
 
     useMeta = TRUE;
     useFilemon = TRUE;
@@ -535,6 +550,9 @@
 	    writeMeta = FALSE;
 	if (strstr(make_mode, "nofilemon"))
 	    useFilemon = FALSE;
+	if ((cp = strstr(make_mode, "curdir="))) {
+	    metaCurdirOk = boolValue(&cp[7]);
+	}
 	if (strstr(make_mode, "ignore-cmd"))
 	    metaIgnoreCMDs = TRUE;
 	/* for backwards compatability */

Reply via email to