Author: sjg
Date: Fri Aug  2 06:25:28 2013
New Revision: 253883
URL: http://svnweb.freebsd.org/changeset/base/253883

Log:
  Merge bmake-20130730
  Main feature of interest is .MAKE.JOB.PREFIX=
  to suppress --- job --- tokens.

Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/Makefile
  head/contrib/bmake/bmake.1
  head/contrib/bmake/bmake.cat1
  head/contrib/bmake/compat.c
  head/contrib/bmake/configure
  head/contrib/bmake/configure.in
  head/contrib/bmake/job.c
  head/contrib/bmake/job.h
  head/contrib/bmake/main.c
  head/contrib/bmake/make.1
  head/contrib/bmake/make.h
  head/contrib/bmake/meta.c
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/init.mk
  head/contrib/bmake/mk/install-mk
  head/contrib/bmake/mk/lib.mk
  head/contrib/bmake/mk/meta2deps.py
  head/contrib/bmake/mk/own.mk
  head/contrib/bmake/mk/prog.mk
  head/contrib/bmake/parse.c
  head/contrib/bmake/unit-tests/Makefile.in
  head/contrib/bmake/var.c
  head/usr.bin/bmake/Makefile
  head/usr.bin/bmake/config.h
  head/usr.bin/bmake/unit-tests/Makefile
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==============================================================================
--- head/contrib/bmake/ChangeLog        Fri Aug  2 05:52:53 2013        
(r253882)
+++ head/contrib/bmake/ChangeLog        Fri Aug  2 06:25:28 2013        
(r253883)
@@ -1,3 +1,36 @@
+2013-07-30  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * Makefile (MAKE_VERSION): 20130730
+         Merge with NetBSD make, pick up
+         o Allow suppression of --- job -- tokens by setting
+           .MAKE.JOB.PREFIX empty.
+
+2013-07-16  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * Makefile (MAKE_VERSION): 20130716
+         Merge with NetBSD make, pick up
+         o number of gmake compatability tweaks
+           -w for gmake style entering/leaving messages
+           if .MAKE.LEVEL > 0 indicate it in progname "make[1]" etc.
+           handle MAKEFLAGS containing only letters.
+         o when overriding a GLOBAL variable on the command line,
+           delete it from GLOBAL context so -V doesn't show the wrong
+           value.
+       
+2013-07-06  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * configure.in: We don't need MAKE_LEVEL_SAFE anymore.
+
+       * Makefile (MAKE_VERSION): 20130706
+         Merge with NetBSD make, pick up
+         o Shell_Init(): export shellErrFlag if commandShell hasErrCtl is
+           true so that CompatRunCommand() can use it, to ensure
+           consistent behavior with jobs mode.
+         o use MAKE_LEVEL_ENV to define the variable to propagate
+           .MAKE.LEVEL - currently set to MAKELEVEL (same as gmake).
+         o meta.c: use .MAKE.META.IGNORE_PATHS to allow customization of
+           paths to ignore.
+
 2013-06-04  Simon J. Gerraty  <s...@bad.crufty.net>
 
        * Makefile (MAKE_VERSION): 20130604

Modified: head/contrib/bmake/Makefile
==============================================================================
--- head/contrib/bmake/Makefile Fri Aug  2 05:52:53 2013        (r253882)
+++ head/contrib/bmake/Makefile Fri Aug  2 06:25:28 2013        (r253883)
@@ -1,7 +1,7 @@
-#      $Id: Makefile,v 1.14 2013/06/05 04:03:22 sjg Exp $
+#      $Id: Makefile,v 1.17 2013/07/30 19:13:53 sjg Exp $
 
 # Base version on src date
-MAKE_VERSION= 20130604
+MAKE_VERSION= 20130730
 
 PROG=  bmake
 

Modified: head/contrib/bmake/bmake.1
==============================================================================
--- head/contrib/bmake/bmake.1  Fri Aug  2 05:52:53 2013        (r253882)
+++ head/contrib/bmake/bmake.1  Fri Aug  2 06:25:28 2013        (r253883)
@@ -1,4 +1,4 @@
-.\"    $NetBSD: make.1,v 1.213 2013/03/31 05:49:51 sjg Exp $
+.\"    $NetBSD: make.1,v 1.220 2013/07/30 19:09:57 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 March 30, 2013
+.Dd July 30, 2013
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd maintain program dependencies
 .Sh SYNOPSIS
 .Nm
-.Op Fl BeikNnqrstWX
+.Op Fl BeikNnqrstWwX
 .Op Fl C Ar directory
 .Op Fl D Ar variable
 .Op Fl d Ar flags
@@ -209,6 +209,8 @@ Force the
 option to print raw values of variables.
 .It Ar v
 Print debugging information about variable assignment.
+.It Ar w
+Print entering and leaving directory messages, pre and post processing.
 .It Ar x
 Run shell commands with
 .Fl x
@@ -743,6 +745,9 @@ then output for each target is prefixed 
 .Ql --- target ---
 the first part of which can be controlled via
 .Va .MAKE.JOB.PREFIX .
+If 
+.Va .MAKE.JOB.PREFIX
+is empty, no token is printed.
 .br
 For example:
 .Li .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}]
@@ -856,6 +861,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:
@@ -877,7 +887,7 @@ is modified.
 .It Va .MAKE.PATH_FILEMON
 If
 .Nm
-was built with 
+was built with
 .Xr filemon 4
 support, this is set to the path of the device node.
 This allows makefiles to test for this support.
@@ -1298,7 +1308,7 @@ should start and end with a period.
 For example.
 .Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@}
 .Pp
-However a single character varaiable is often more readable:
+However a single character variable is often more readable:
 .Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}
 .It Cm \&:U Ns Ar newval
 If the variable is undefined
@@ -1321,7 +1331,7 @@ The path of the node which has the same 
 is the value.
 If no such node exists or its path is null, then the
 name of the variable is used.
-In order for this modifier to work, the name (node) must at least have 
+In order for this modifier to work, the name (node) must at least have
 appeared on the rhs of a dependency.
 .Sm off
 .It Cm \&:\&! Ar cmd Cm \&!
@@ -2115,6 +2125,13 @@ for Sprite at Berkeley.
 It was designed to be a parallel distributed make running jobs on different
 machines using a daemon called
 .Dq customs .
+.Pp
+Historically the target/dependency
+.Dq FRC
+has been used to FoRCe rebuilding (since the target/dependency
+does not exist... unless someone creates an
+.Dq FRC
+file).
 .Sh BUGS
 The
 make

Modified: head/contrib/bmake/bmake.cat1
==============================================================================
--- head/contrib/bmake/bmake.cat1       Fri Aug  2 05:52:53 2013        
(r253882)
+++ head/contrib/bmake/bmake.cat1       Fri Aug  2 06:25:28 2013        
(r253883)
@@ -4,7 +4,7 @@ NNAAMMEE
      bbmmaakkee -- maintain program dependencies
 
 SSYYNNOOPPSSIISS
-     bbmmaakkee [--BBeeiikkNNnnqqrrssttWWXX] [--CC 
_d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd 
_f_l_a_g_s]
+     bbmmaakkee [--BBeeiikkNNnnqqrrssttWWwwXX] [--CC 
_d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd 
_f_l_a_g_s]
            [--ff _m_a_k_e_f_i_l_e] [--II 
_d_i_r_e_c_t_o_r_y] [--JJ _p_r_i_v_a_t_e] [--jj 
_m_a_x___j_o_b_s]
            [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV 
_v_a_r_i_a_b_l_e] [_v_a_r_i_a_b_l_e_=_v_a_l_u_e]
            [_t_a_r_g_e_t _._._.]
@@ -122,6 +122,9 @@ DDEESSCCRRIIPPTTIIOONN
 
              _v       Print debugging information about variable assignment.
 
+             _w       Print entering and leaving directory messages, pre and
+                     post processing.
+
              _x       Run shell commands with --xx so the actual commands 
are
                      printed as they are executed.
 
@@ -469,7 +472,8 @@ VVAARRIIAABBLLEE AASSSSIIGG
      _._M_A_K_E_._J_O_B_._P_R_E_F_I_X
                      If bbmmaakkee is run with _j then output for each 
target is
                      prefixed with a token `--- target ---' the first part of
-                     which can be controlled via 
_._M_A_K_E_._J_O_B_._P_R_E_F_I_X.
+                     which can be controlled via 
_._M_A_K_E_._J_O_B_._P_R_E_F_I_X.  If
+                     _._M_A_K_E_._J_O_B_._P_R_E_F_I_X is 
empty, no token is printed.
                      For example:
                      .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}]
                      would produce tokens like `---make[1234] target ---' mak-
@@ -551,6 +555,12 @@ VVAARRIIAABBLLEE AASSSSIIGG
                      to process the meta files to extract dependency informa-
                      tion.
 
+     _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_H_S
+                     Provides a list of path prefixes that should be ignored;
+                     because the contents are expected to change over time.
+                     The default list includes: `_/_d_e_v _/_e_t_c 
_/_p_r_o_c _/_t_m_p _/_v_a_r_/_r_u_n
+                     _/_v_a_r_/_t_m_p'
+
      _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X
                      Defines the message printed for each meta file updated in
                      "meta verbose" mode.  The default value is:
@@ -818,7 +828,7 @@ VVAARRIIAABBLLEE AASSSSIIGG
           period.  For example.
                 ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@}
 
-          However a single character varaiable is often more readable:
+          However a single character variable is often more readable:
                 ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}
 
      ::UU_n_e_w_v_a_l
@@ -1351,6 +1361,10 @@ HHIISSTTOORRYY
      Berkeley.  It was designed to be a parallel distributed make running jobs
      on different machines using a daemon called ``customs''.
 
+     Historically the target/dependency ``FRC'' has been used to FoRCe
+     rebuilding (since the target/dependency does not exist... unless someone
+     creates an ``FRC'' file).
+
 BBUUGGSS
      The make syntax is difficult to parse without actually acting of the
      data.  For instance finding the end of a variable use should involve
@@ -1360,4 +1374,4 @@ BBUUGGSS
 
      There is no way of escaping a space character in a filename.
 
-NetBSD 5.1                      March 30, 2013                      NetBSD 5.1
+NetBSD 5.1                       July 30, 2013                      NetBSD 5.1

Modified: head/contrib/bmake/compat.c
==============================================================================
--- head/contrib/bmake/compat.c Fri Aug  2 05:52:53 2013        (r253882)
+++ head/contrib/bmake/compat.c Fri Aug  2 06:25:28 2013        (r253883)
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.91 2013/01/25 02:01:10 sjg Exp $  */
+/*     $NetBSD: compat.c,v 1.92 2013/07/05 22:14:56 sjg Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.91 2013/01/25 02:01:10 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.92 2013/07/05 22:14:56 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.91 2013/01/25 02:01:10 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.92 2013/07/05 22:14:56 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -332,18 +332,23 @@ again:
         * We need to pass the command off to the shell, typically
         * because the command contains a "meta" character.
         */
-       static const char *shargv[4];
+       static const char *shargv[5];
+       int shargc;
 
-       shargv[0] = shellPath;
+       shargc = 0;
+       shargv[shargc++] = shellPath;
        /*
         * The following work for any of the builtin shell specs.
         */
+       if (shellErrFlag) {
+           shargv[shargc++] = shellErrFlag;
+       }
        if (DEBUG(SHELL))
-               shargv[1] = "-xc";
+               shargv[shargc++] = "-xc";
        else
-               shargv[1] = "-c";
-       shargv[2] = cmd;
-       shargv[3] = NULL;
+               shargv[shargc++] = "-c";
+       shargv[shargc++] = cmd;
+       shargv[shargc++] = NULL;
        av = shargv;
        argc = 0;
        bp = NULL;

Modified: head/contrib/bmake/configure
==============================================================================
Binary file (source and/or target). No diff available.

Modified: head/contrib/bmake/configure.in
==============================================================================
--- head/contrib/bmake/configure.in     Fri Aug  2 05:52:53 2013        
(r253882)
+++ head/contrib/bmake/configure.in     Fri Aug  2 06:25:28 2013        
(r253883)
@@ -1,10 +1,10 @@
 dnl
 dnl RCSid:
-dnl    $Id: configure.in,v 1.48 2013/03/04 21:25:57 sjg Exp $
+dnl    $Id: configure.in,v 1.49 2013/07/06 18:25:19 sjg Exp $
 dnl
 dnl Process this file with autoconf to produce a configure script
 dnl
-AC_INIT([bmake], [20130303], [s...@netbsd.org])
+AC_INIT([bmake], [20130706], [s...@netbsd.org])
 AC_CONFIG_HEADER(config.h)
 
 dnl make srcdir absolute
@@ -79,15 +79,6 @@ dnl Executable suffix - normally empty; 
 AC_SUBST(ac_exe_suffix)dnl
 
 dnl
-dnl Check if /bin/sh will pass .MAKE.LEVEL
-echo $ECHO_N "checking if sh will pass .MAKE. variables... $ECHO_C" >&6
-ok=`env .MAKE.LEVEL=1 /bin/sh -c env | grep LEVEL=`
-case "$ok" in
-"") echo no >&6; CPPFLAGS="${CPPFLAGS} -DNEED_MAKE_LEVEL_SAFE";;
-*) echo yes >&6;;
-esac
-
-dnl
 dnl AC_C_CROSS
 dnl
 

Modified: head/contrib/bmake/job.c
==============================================================================
--- head/contrib/bmake/job.c    Fri Aug  2 05:52:53 2013        (r253882)
+++ head/contrib/bmake/job.c    Fri Aug  2 06:25:28 2013        (r253883)
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $    */
+/*     $NetBSD: job.c,v 1.175 2013/07/30 19:09:57 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.175 2013/07/30 19:09:57 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c      8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $");
+__RCSID("$NetBSD: job.c,v 1.175 2013/07/30 19:09:57 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -313,6 +313,7 @@ static Shell *commandShell = &shells[DEF
 const char *shellPath = NULL,                    /* full pathname of
                                                   * executable image */
            *shellName = NULL;                    /* last component of shell */
+char *shellErrFlag = NULL;
 static const char *shellArgv = NULL;             /* Custom shell args */
 
 
@@ -344,7 +345,7 @@ static Job childExitJob;    /* child exit p
 
 #define TARG_FMT  "%s %s ---\n" /* Default format */
 #define MESSAGE(fp, gn) \
-       if (maxJobs != 1) \
+       if (maxJobs != 1 && targPrefix && *targPrefix) \
            (void)fprintf(fp, TARG_FMT, targPrefix, gn->name)
 
 static sigset_t caught_signals;        /* Set of signals we handle */
@@ -2152,6 +2153,24 @@ Shell_Init(void)
     if (commandShell->echo == NULL) {
        commandShell->echo = "";
     }
+    if (commandShell->hasErrCtl && *commandShell->exit) {
+       if (shellErrFlag &&
+           strcmp(commandShell->exit, &shellErrFlag[1]) != 0) {
+           free(shellErrFlag);
+           shellErrFlag = NULL;
+       }
+       if (!shellErrFlag) {
+           int n = strlen(commandShell->exit) + 2;
+
+           shellErrFlag = bmake_malloc(n);
+           if (shellErrFlag) {
+               snprintf(shellErrFlag, n, "-%s", commandShell->exit);
+           }
+       }
+    } else if (shellErrFlag) {
+       free(shellErrFlag);
+       shellErrFlag = NULL;
+    }
 }
 
 /*-
@@ -2496,6 +2515,8 @@ Job_ParseShell(char *line)
            commandShell = bmake_malloc(sizeof(Shell));
            *commandShell = newShell;
        }
+       /* this will take care of shellErrFlag */
+       Shell_Init();
     }
 
     if (commandShell->echoOn && commandShell->echoOff) {

Modified: head/contrib/bmake/job.h
==============================================================================
--- head/contrib/bmake/job.h    Fri Aug  2 05:52:53 2013        (r253882)
+++ head/contrib/bmake/job.h    Fri Aug  2 06:25:28 2013        (r253883)
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.h,v 1.41 2013/03/05 22:01:44 christos Exp $        */
+/*     $NetBSD: job.h,v 1.42 2013/07/05 22:14:56 sjg Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -243,6 +243,7 @@ typedef struct Shell {
 
 extern const char *shellPath;
 extern const char *shellName;
+extern char *shellErrFlag;
 
 extern int     jobTokensRunning; /* tokens currently "out" */
 extern int     maxJobs;        /* Max jobs we can run */

Modified: head/contrib/bmake/main.c
==============================================================================
--- head/contrib/bmake/main.c   Fri Aug  2 05:52:53 2013        (r253882)
+++ head/contrib/bmake/main.c   Fri Aug  2 06:25:28 2013        (r253883)
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.210 2013/03/23 05:31:29 sjg Exp $   */
+/*     $NetBSD: main.c,v 1.222 2013/07/18 15:31:49 sjg Exp $   */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.210 2013/03/23 05:31:29 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.222 2013/07/18 15:31:49 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c     8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.210 2013/03/23 05:31:29 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.222 2013/07/18 15:31:49 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -117,17 +117,18 @@ __RCSID("$NetBSD: main.c,v 1.210 2013/03
 #include <sys/time.h>
 #include <sys/param.h>
 #include <sys/resource.h>
-#include <signal.h>
 #include <sys/stat.h>
 #include <sys/utsname.h>
 #include "wait.h"
 
 #include <errno.h>
 #include <fcntl.h>
+#include <signal.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
+#include <ctype.h>
 
 #include "make.h"
 #include "hash.h"
@@ -163,6 +164,7 @@ Boolean                     noRecursiveExecute;     /* -N 
flag
 Boolean                        keepgoing;      /* -k flag */
 Boolean                        queryFlag;      /* -q flag */
 Boolean                        touchFlag;      /* -t flag */
+Boolean                        enterFlag;      /* -w flag */
 Boolean                        ignoreErrors;   /* -i flag */
 Boolean                        beSilent;       /* -s flag */
 Boolean                        oldVars;        /* variable substitution style 
*/
@@ -184,6 +186,7 @@ char curdir[MAXPATHLEN + 1];                /* Startup
 char *progname;                                /* the program name */
 char *makeDependfile;
 pid_t myPid;
+int makelevel;
 
 Boolean forceJobs = FALSE;
 
@@ -198,6 +201,38 @@ Boolean forceJobs = FALSE;
 
 extern Lst parseIncPath;
 
+/*
+ * For compatibility with the POSIX version of MAKEFLAGS that includes
+ * all the options with out -, convert flags to -f -l -a -g -s.
+ */
+static char *
+explode(const char *flags)
+{
+    size_t len;
+    char *nf, *st;
+    const char *f;
+
+    if (flags == NULL)
+       return NULL;
+
+    for (f = flags; *f; f++)
+       if (!isalpha((unsigned char)*f))
+           break;
+
+    if (*f)
+       return bmake_strdup(flags);
+
+    len = strlen(flags);
+    st = nf = bmake_malloc(len * 3 + 1);
+    while (*flags) {
+       *nf++ = '-';
+       *nf++ = *flags++;
+       *nf++ = ' ';
+    }
+    *nf = '\0';
+    return st;
+}
+           
 static void
 parse_debug_options(const char *argvalue)
 {
@@ -350,7 +385,7 @@ MainParseArgs(int argc, char **argv)
        Boolean inOption, dashDash = FALSE;
        char found_path[MAXPATHLEN + 1];        /* for searching for sys.mk */
 
-#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrst"
+#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstw"
 /* Can't actually use getopt(3) because rescanning is not portable */
 
        getopt_def = OPTFLAGS;
@@ -558,6 +593,10 @@ rearg:     
                        touchFlag = TRUE;
                        Var_Append(MAKEFLAGS, "-t", VAR_GLOBAL);
                        break;
+               case 'w':
+                       enterFlag = TRUE;
+                       Var_Append(MAKEFLAGS, "-w", VAR_GLOBAL);
+                       break;
                case '-':
                        dashDash = TRUE;
                        break;
@@ -797,9 +836,6 @@ main(int argc, char **argv)
        Boolean outOfDate = FALSE;      /* FALSE if all targets up to date */
        struct stat sb, sa;
        char *p1, *path;
-#ifndef NO_PWD_OVERRIDE
-       char *pwd;
-#endif
        char mdpath[MAXPATHLEN];
 #ifdef FORCE_MACHINE
        const char *machine = FORCE_MACHINE;
@@ -966,26 +1002,30 @@ main(int argc, char **argv)
        Var_Set(MAKEOVERRIDES, "", VAR_GLOBAL, 0);
        Var_Set("MFLAGS", "", VAR_GLOBAL, 0);
        Var_Set(".ALLTARGETS", "", VAR_GLOBAL, 0);
+       /* some makefiles need to know this */
+       Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMD, 0);
 
        /*
         * Set some other useful macros
         */
        {
-           char tmp[64];
-           const char *ep;
+           char tmp[64], *ep;
 
-           if (!(ep = getenv(MAKE_LEVEL))) {
-#ifdef MAKE_LEVEL_SAFE
-               if (!(ep = getenv(MAKE_LEVEL_SAFE)))
-#endif
-                   ep = "0";
-           }
-           Var_Set(MAKE_LEVEL, ep, VAR_GLOBAL, 0);
+           makelevel = ((ep = getenv(MAKE_LEVEL_ENV)) && *ep) ? atoi(ep) : 0;
+           if (makelevel < 0)
+               makelevel = 0;
+           snprintf(tmp, sizeof(tmp), "%d", makelevel);
+           Var_Set(MAKE_LEVEL, tmp, VAR_GLOBAL, 0);
            snprintf(tmp, sizeof(tmp), "%u", myPid);
            Var_Set(".MAKE.PID", tmp, VAR_GLOBAL, 0);
            snprintf(tmp, sizeof(tmp), "%u", getppid());
            Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL, 0);
        }
+       if (makelevel > 0) {
+               char pn[1024];
+               snprintf(pn, sizeof(pn), "%s[%d]", progname, makelevel);
+               progname = bmake_strdup(pn);
+       }
        Job_SetPrefix();
 
 #ifdef USE_META
@@ -997,7 +1037,9 @@ main(int argc, char **argv)
         * in a different format).
         */
 #ifdef POSIX
-       Main_ParseArgLine(getenv("MAKEFLAGS"));
+       p1 = explode(getenv("MAKEFLAGS"));
+       Main_ParseArgLine(p1);
+       free(p1);
 #else
        Main_ParseArgLine(getenv("MAKE"));
 #endif
@@ -1014,6 +1056,9 @@ main(int argc, char **argv)
 
        MainParseArgs(argc, argv);
 
+       if (enterFlag)
+               printf("%s: Entering directory `%s'\n", progname, curdir);
+
        /*
         * Verify that cwd is sane.
         */
@@ -1035,15 +1080,19 @@ main(int argc, char **argv)
         * MAKEOBJDIRPREFIX is set or MAKEOBJDIR contains a transform.
         */
 #ifndef NO_PWD_OVERRIDE
-       if (!ignorePWD &&
-           (pwd = getenv("PWD")) != NULL &&
-           getenv("MAKEOBJDIRPREFIX") == NULL) {
-               const char *makeobjdir = getenv("MAKEOBJDIR");
-
-               if (makeobjdir == NULL || !strchr(makeobjdir, '$')) {
-                       if (stat(pwd, &sb) == 0 && sa.st_ino == sb.st_ino &&
-                           sa.st_dev == sb.st_dev)
-                               (void)strncpy(curdir, pwd, MAXPATHLEN);
+       if (!ignorePWD) {
+               char *pwd;
+
+               if ((pwd = getenv("PWD")) != NULL &&
+                   getenv("MAKEOBJDIRPREFIX") == NULL) {
+                       const char *makeobjdir = getenv("MAKEOBJDIR");
+
+                       if (makeobjdir == NULL || !strchr(makeobjdir, '$')) {
+                               if (stat(pwd, &sb) == 0 &&
+                                   sa.st_ino == sb.st_ino &&
+                                   sa.st_dev == sb.st_dev)
+                                       (void)strncpy(curdir, pwd, MAXPATHLEN);
+                       }
                }
        }
 #endif
@@ -1331,6 +1380,9 @@ main(int argc, char **argv)
 
        Trace_Log(MAKEEND, 0);
 
+       if (enterFlag)
+               printf("%s: Leaving directory `%s'\n", progname, curdir);
+
        Suff_End();
         Targ_End();
        Arch_End();
@@ -1759,8 +1811,12 @@ execError(const char *af, const char *av
 static void
 usage(void)
 {
+       char *p;
+       if ((p = strchr(progname, '[')) != NULL)
+           *p = '\0';
+
        (void)fprintf(stderr,
-"usage: %s [-BeikNnqrstWX] \n\
+"usage: %s [-BeikNnqrstWwX] \n\
             [-C directory] [-D variable] [-d flags] [-f makefile]\n\
             [-I directory] [-J private] [-j max_jobs] [-m directory] [-T 
file]\n\
             [-V variable] [variable=value] [target ...]\n", progname);

Modified: head/contrib/bmake/make.1
==============================================================================
--- head/contrib/bmake/make.1   Fri Aug  2 05:52:53 2013        (r253882)
+++ head/contrib/bmake/make.1   Fri Aug  2 06:25:28 2013        (r253883)
@@ -1,4 +1,4 @@
-.\"    $NetBSD: make.1,v 1.215 2013/05/22 19:35:11 christos Exp $
+.\"    $NetBSD: make.1,v 1.220 2013/07/30 19:09:57 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 July 30, 2013
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd maintain program dependencies
 .Sh SYNOPSIS
 .Nm
-.Op Fl BeikNnqrstWX
+.Op Fl BeikNnqrstWwX
 .Op Fl C Ar directory
 .Op Fl D Ar variable
 .Op Fl d Ar flags
@@ -209,6 +209,8 @@ Force the
 option to print raw values of variables.
 .It Ar v
 Print debugging information about variable assignment.
+.It Ar w
+Print entering and leaving directory messages, pre and post processing.
 .It Ar x
 Run shell commands with
 .Fl x
@@ -743,6 +745,9 @@ then output for each target is prefixed 
 .Ql --- target ---
 the first part of which can be controlled via
 .Va .MAKE.JOB.PREFIX .
+If 
+.Va .MAKE.JOB.PREFIX
+is empty, no token is printed.
 .br
 For example:
 .Li .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}]
@@ -856,6 +861,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:
@@ -877,7 +887,7 @@ is modified.
 .It Va .MAKE.PATH_FILEMON
 If
 .Nm
-was built with 
+was built with
 .Xr filemon 4
 support, this is set to the path of the device node.
 This allows makefiles to test for this support.
@@ -1298,7 +1308,7 @@ should start and end with a period.
 For example.
 .Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@}
 .Pp
-However a single character varaiable is often more readable:
+However a single character variable is often more readable:
 .Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}
 .It Cm \&:U Ns Ar newval
 If the variable is undefined
@@ -1321,7 +1331,7 @@ The path of the node which has the same 
 is the value.
 If no such node exists or its path is null, then the
 name of the variable is used.
-In order for this modifier to work, the name (node) must at least have 
+In order for this modifier to work, the name (node) must at least have
 appeared on the rhs of a dependency.
 .Sm off
 .It Cm \&:\&! Ar cmd Cm \&!
@@ -2114,7 +2124,7 @@ machines using a daemon called
 Historically the target/dependency
 .Dq FRC
 has been used to FoRCe rebuilding (since the target/dependency
-does not exist... unless someone creates an 
+does not exist... unless someone creates an
 .Dq FRC
 file).
 .Sh BUGS

Modified: head/contrib/bmake/make.h
==============================================================================
--- head/contrib/bmake/make.h   Fri Aug  2 05:52:53 2013        (r253882)
+++ head/contrib/bmake/make.h   Fri Aug  2 06:25:28 2013        (r253883)
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.90 2013/02/25 01:57:14 dholland Exp $       */
+/*     $NetBSD: make.h,v 1.91 2013/06/18 20:06:09 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -442,9 +442,8 @@ extern pid_t        myPid;
 #define MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
 #define MAKE_DEPENDFILE        ".MAKE.DEPENDFILE" /* .depend */
 #define MAKE_MODE      ".MAKE.MODE"
-
-#ifdef NEED_MAKE_LEVEL_SAFE
-# define MAKE_LEVEL_SAFE "_MAKE_LEVEL" /* some shells will not pass .MAKE. */
+#ifndef MAKE_LEVEL_ENV
+# define MAKE_LEVEL_ENV        "MAKELEVEL"
 #endif
 
 /*

Modified: head/contrib/bmake/meta.c
==============================================================================
--- head/contrib/bmake/meta.c   Fri Aug  2 05:52:53 2013        (r253882)
+++ head/contrib/bmake/meta.c   Fri Aug  2 06:25:28 2013        (r253883)
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.30 2013/05/16 21:56:56 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,20 +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)
+                   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++;

Modified: head/contrib/bmake/mk/ChangeLog
==============================================================================
--- head/contrib/bmake/mk/ChangeLog     Fri Aug  2 05:52:53 2013        
(r253882)
+++ head/contrib/bmake/mk/ChangeLog     Fri Aug  2 06:25:28 2013        
(r253883)
@@ -1,3 +1,18 @@
+2013-07-26  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * install-mk (MK_VERSION): 20130726
+         some updates from Juniper and FreeBSD
+         o meta2deps.py: indicate file and line number when we hit parse
+           errors
+           also allow @file to provide huge list of .meta files.
+       * meta2deps.py: add try_parse() to cleanup the above.
+       
+2013-07-16  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * install-mk (MK_VERSION): 20130716
+       * own.mk: add GPROG as an option
+       * prog.mk: honor MK_GPROF==yes
+       
 2013-05-10  Simon J. Gerraty  <s...@bad.crufty.net>
 
        * install-mk (MK_VERSION): 20130505

Modified: head/contrib/bmake/mk/init.mk
==============================================================================
--- head/contrib/bmake/mk/init.mk       Fri Aug  2 05:52:53 2013        
(r253882)
+++ head/contrib/bmake/mk/init.mk       Fri Aug  2 06:25:28 2013        
(r253883)
@@ -1,4 +1,4 @@
-# $Id: init.mk,v 1.8 2012/11/11 22:37:02 sjg Exp $
+# $Id: init.mk,v 1.9 2013/07/18 05:46:24 sjg Exp $
 #
 #      @(#) Copyright (c) 2002, Simon J. Gerraty
 #
@@ -36,6 +36,12 @@ COPTS += ${COPTS.${.IMPSRC:T}}
 CPPFLAGS += ${CPPFLAGS.${.IMPSRC:T}}
 CPUFLAGS += ${CPUFLAGS.${.IMPSRC:T}}
 
+CC_PG?= -pg
+CXX_PG?= ${CC_PG}
+CC_PIC?= -DPIC
+CXX_PIC?= ${CC_PIC}
+PROFFLAGS?= -DGPROF -DPROF
+
 .if ${.MAKE.LEVEL:U1} == 0 && ${BUILD_AT_LEVEL0:Uyes:tl} == "no"
 # this tells lib.mk and prog.mk to not actually build anything
 _SKIP_BUILD = not building at level 0

Modified: head/contrib/bmake/mk/install-mk
==============================================================================
--- head/contrib/bmake/mk/install-mk    Fri Aug  2 05:52:53 2013        
(r253882)
+++ head/contrib/bmake/mk/install-mk    Fri Aug  2 06:25:28 2013        
(r253883)
@@ -55,7 +55,7 @@
 #       Simon J. Gerraty <s...@crufty.net>
 
 # RCSid:
-#      $Id: install-mk,v 1.90 2013/05/11 05:16:26 sjg Exp $
+#      $Id: install-mk,v 1.92 2013/07/27 05:37:37 sjg Exp $
 #
 #      @(#) Copyright (c) 1994 Simon J. Gerraty
 #
@@ -70,7 +70,7 @@
 #      s...@crufty.net
 #
 
-MK_VERSION=20130505
+MK_VERSION=20130726
 OWNER=
 GROUP=
 MODE=444

Modified: head/contrib/bmake/mk/lib.mk
==============================================================================
--- head/contrib/bmake/mk/lib.mk        Fri Aug  2 05:52:53 2013        
(r253882)
+++ head/contrib/bmake/mk/lib.mk        Fri Aug  2 06:25:28 2013        
(r253883)
@@ -1,4 +1,4 @@
-# $Id: lib.mk,v 1.48 2012/11/12 04:08:18 sjg Exp $
+# $Id: lib.mk,v 1.49 2013/07/18 05:46:24 sjg Exp $
 
 .if !target(__${.PARSEFILE}__)
 __${.PARSEFILE}__:
@@ -146,9 +146,6 @@ LD_shared=${SHLIB_SHFLAGS}
 MKPICLIB?= yes
 
 # sys.mk can override these
-CC_PG?=-pg
-CC_PIC?=-DPIC
-
 LD_X?=-X
 LD_x?=-x
 LD_r?=-r
@@ -284,7 +281,7 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version 
 
 .if (${LD_X} == "")
 .c.po:
-       ${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET}
+       ${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}
 
 .cc.po .C.po:
        ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
@@ -293,14 +290,14 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version 
        ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} 
-o ${.TARGET}
 .else
 .c.po:
-       @echo ${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET}
-       @${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET}.o
+       @echo ${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}
+       @${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}.o
        @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
        @rm -f ${.TARGET}.o
 
 .cc.po .C.po:
-       @echo ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
-       @${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
+       @echo ${COMPILE.cc} ${CXX_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}
+       @${COMPILE.cc} ${CXX_PG} ${.IMPSRC} -o ${.TARGET}.o
        @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
        @rm -f ${.TARGET}.o
 
@@ -319,7 +316,7 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version 
        ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}
 
 .S.po .s.po:
-       ${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o 
${.TARGET}
+       ${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o 
${.TARGET}
 .else
 
 .c.so:
@@ -335,8 +332,8 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version 
        @rm -f ${.TARGET}.o
 
 .S.po .s.po:
-       @echo ${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} 
-o ${.TARGET}
-       @${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o 
${.TARGET}.o
+       @echo ${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o 
${.TARGET}
+       @${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o 
${.TARGET}.o
        @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
        @rm -f ${.TARGET}.o
 

Modified: head/contrib/bmake/mk/meta2deps.py
==============================================================================
--- head/contrib/bmake/mk/meta2deps.py  Fri Aug  2 05:52:53 2013        
(r253882)
+++ head/contrib/bmake/mk/meta2deps.py  Fri Aug  2 06:25:28 2013        
(r253883)
@@ -35,7 +35,7 @@ We only pay attention to a subset of the
 
 """
 RCSid:
-       $Id: meta2deps.py,v 1.13 2013/05/11 05:16:26 sjg Exp $
+       $Id: meta2deps.py,v 1.15 2013/07/29 20:41:23 sjg Exp $
 
        Copyright (c) 2011-2013, Juniper Networks, Inc.
        All rights reserved.
@@ -77,7 +77,7 @@ def resolve(path, cwd, last_dir=None, de
     """
     if path.endswith('/.'):
         path = path[0:-2]
-    if path[0] == '/':
+    if len(path) > 0 and path[0] == '/':
         return path
     if path == '.':
         return cwd
@@ -107,10 +107,12 @@ def abspath(path, cwd, last_dir=None, de
     this gets called a lot, so we try to avoid calling realpath
     until we know we have something.
     """
-    path = resolve(path, cwd, last_dir, debug, debug_out)
-    if path and (path.find('./') > 0 or
-                 path.endswith('/..') or
-                 os.path.islink(path)):
+    rpath = resolve(path, cwd, last_dir, debug, debug_out)
+    if rpath:
+        path = rpath
+    if (path.find('./') > 0 or
+        path.endswith('/..') or
+        os.path.islink(path)):
         return os.path.realpath(path)
     return path
 
@@ -191,6 +193,7 @@ class MetaFile:
         self.curdir = getv(conf, 'CURDIR')
         self.reldir = getv(conf, 'RELDIR')
         self.dpdeps = getv(conf, 'DPDEPS')
+        self.line = 0
 
         if not self.conf:
             # some of the steps below we want to do only once
@@ -254,7 +257,7 @@ class MetaFile:
         self.cwd = os.getcwd()          # make sure this is initialized
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to