Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make When .MAKE.MODE inlcudes 'meta'; 'curdir=true' ...



details:   https://anonhg.NetBSD.org/src/rev/accb0d160ec3
branches:  trunk
changeset: 763613:accb0d160ec3
user:      sjg <sjg%NetBSD.org@localhost>
date:      Sun Mar 27 19:39:21 2011 +0000

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

diffstat:

 usr.bin/make/make.1 |  14 +++++++++++---
 usr.bin/make/meta.c |  20 +++++++++++++++++++-
 2 files changed, 30 insertions(+), 4 deletions(-)

diffs (98 lines):

diff -r 27eb8eac1a3c -r accb0d160ec3 usr.bin/make/make.1
--- a/usr.bin/make/make.1       Sun Mar 27 19:09:43 2011 +0000
+++ b/usr.bin/make/make.1       Sun Mar 27 19:39:21 2011 +0000
@@ -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.
diff -r 27eb8eac1a3c -r accb0d160ec3 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Sun Mar 27 19:09:43 2011 +0000
+++ b/usr.bin/make/meta.c       Sun Mar 27 19:39:21 2011 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index