svn commit: r261212 - in head: contrib/bmake contrib/bmake/lst.lib contrib/bmake/mk usr.bin/bmake

Simon J. Gerraty sjg at FreeBSD.org
Mon Jan 27 17:47:26 UTC 2014


Author: sjg
Date: Mon Jan 27 17:47:21 2014
New Revision: 261212
URL: http://svnweb.freebsd.org/changeset/base/261212

Log:
  Merge bmake-20140101 from vendor

Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/Makefile
  head/contrib/bmake/Makefile.config.in
  head/contrib/bmake/bmake.1
  head/contrib/bmake/bmake.cat1
  head/contrib/bmake/boot-strap
  head/contrib/bmake/compat.c
  head/contrib/bmake/configure
  head/contrib/bmake/configure.in
  head/contrib/bmake/hash.c
  head/contrib/bmake/lst.lib/lstMember.c
  head/contrib/bmake/main.c
  head/contrib/bmake/make-bootstrap.sh.in
  head/contrib/bmake/make.1
  head/contrib/bmake/make.h
  head/contrib/bmake/meta.c
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/dirdeps.mk
  head/contrib/bmake/mk/install-mk
  head/contrib/bmake/mk/meta2deps.py
  head/contrib/bmake/parse.c
  head/contrib/bmake/util.c
  head/usr.bin/bmake/Makefile
  head/usr.bin/bmake/Makefile.config
  head/usr.bin/bmake/config.h
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==============================================================================
--- head/contrib/bmake/ChangeLog	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/ChangeLog	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,3 +1,37 @@
+2014-01-03  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* boot-strap: ignore mksrc=none
+
+2014-01-02  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* Makefile (DEFAULT_SYS_PATH?): use just ${prefix}/share/mk
+
+2014-01-01  Simon J. Gerraty  <sjg at bad.crufty.net>
+	
+	* Makefile (MAKE_VERSION): 20140101
+	* configure.in: set bmake_path_max to min(_SC_PATH_MAX,1024)
+	* Makefile.config: defined BMAKE_PATH_MAX to bmake_path_max
+	* make.h: use BMAKE_PATH_MAX if MAXPATHLEN not defined (needed for
+	  Hurd) 
+	* configure.in: Add AC_PREREQ and check for
+	  sysctl; patch from Andrew Shadura andrewsh at debian.org
+
+2013-10-16  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* Makefile (MAKE_VERSION): 20131010
+	* lose the const from arg to systcl to avoid problems on older BSDs.
+
+2013-10-01  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* Makefile (MAKE_VERSION): 20131001
+	  Merge with NetBSD make, pick up
+	  o main.c: for NATIVE build sysctl to get MACHINE_ARCH from
+	    hw.machine_arch if necessary.
+	  o meta.c: meta_oodate - need to look at src of Link and target
+	    of Move as well.
+	* main.c: check that CTL_HW and HW_MACHINE_ARCH exist.
+	  provide __arraycount() if needed.
+
 2013-09-04  Simon J. Gerraty  <sjg at bad.crufty.net>
 
 	* Makefile (MAKE_VERSION): 20130904

Modified: head/contrib/bmake/Makefile
==============================================================================
--- head/contrib/bmake/Makefile	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/Makefile	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,7 +1,7 @@
-#	$Id: Makefile,v 1.20 2013/09/04 15:42:03 sjg Exp $
+#	$Id: Makefile,v 1.23 2014/01/02 22:20:52 sjg Exp $
 
 # Base version on src date
-MAKE_VERSION= 20130904
+MAKE_VERSION= 20140101
 
 PROG=	bmake
 
@@ -68,7 +68,7 @@ SRCS+= ${LIBOBJS:T:.o=.c}
 prefix?= /usr
 srcdir?= ${.CURDIR}
 
-DEFAULT_SYS_PATH?= .../share/mk:${prefix}/share/mk
+DEFAULT_SYS_PATH?= ${prefix}/share/mk
 
 CPPFLAGS+= -DUSE_META
 CFLAGS+= ${CPPFLAGS}

Modified: head/contrib/bmake/Makefile.config.in
==============================================================================
--- head/contrib/bmake/Makefile.config.in	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/Makefile.config.in	Mon Jan 27 17:47:21 2014	(r261212)
@@ -14,3 +14,7 @@ LIBOBJS= @LIBOBJS@
 LDADD= @LIBS@
 USE_META= @use_meta@
 FILEMON_H= @filemon_h@
+BMAKE_PATH_MAX?= @bmake_path_max@
+# used if MAXPATHLEN not defined
+CPPFLAGS+= -DBMAKE_PATH_MAX=${BMAKE_PATH_MAX}
+

Modified: head/contrib/bmake/bmake.1
==============================================================================
--- head/contrib/bmake/bmake.1	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/bmake.1	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.222 2013/08/11 09:53:49 apb Exp $
+.\"	$NetBSD: make.1,v 1.226 2013/11/07 18:50:46 dholland 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 11, 2013
+.Dd October 25, 2013
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -745,7 +745,7 @@ then output for each target is prefixed 
 .Ql --- target ---
 the first part of which can be controlled via
 .Va .MAKE.JOB.PREFIX .
-If 
+If
 .Va .MAKE.JOB.PREFIX
 is empty, no token is printed.
 .br
@@ -1066,6 +1066,13 @@ may
 be used.
 The wildcard characters may be escaped with a backslash
 .Pq Ql \e .
+As a consequence of the way values are split into words, matched,
+and then joined, a construct like
+.Dl ${VAR:M*}
+will normalise the inter-word spacing, removing all leading and
+trailing space, and converting multiple consecutive spaces
+to single spaces.
+.
 .It Cm \&:N Ns Ar pattern
 This is identical to
 .Ql Cm \&:M ,
@@ -1209,7 +1216,7 @@ The
 modifier is just like the
 .Cm \&:S
 modifier except that the old and new strings, instead of being
-simple strings, are a regular expression (see
+simple strings, are an extended regular expression (see
 .Xr regex 3 )
 string
 .Ar pattern
@@ -1751,7 +1758,7 @@ or
 .Fl t
 options were specified.
 Normally used to mark recursive
-.Nm Ns 's .
+.Nm Ns s .
 .It Ic .META
 Create a meta file for the target, even if it is flagged as
 .Ic .PHONY ,

Modified: head/contrib/bmake/bmake.cat1
==============================================================================
--- head/contrib/bmake/bmake.cat1	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/bmake.cat1	Mon Jan 27 17:47:21 2014	(r261212)
@@ -690,7 +690,13 @@ VVAARRIIAABBLLEE AASSSSIIGG
      ::MM_p_a_t_t_e_r_n
           Select only those words that match _p_a_t_t_e_r_n.  The standard shell
           wildcard characters (`*', `?', and `[]') may be used.  The wildcard
-          characters may be escaped with a backslash (`\').
+          characters may be escaped with a backslash (`\').  As a consequence
+          of the way values are split into words, matched, and then joined, a
+          construct like
+                ${VAR:M*}
+          will normalise the inter-word spacing, removing all leading and
+          trailing space, and converting multiple consecutive spaces to single
+          spaces.
 
      ::NN_p_a_t_t_e_r_n
           This is identical to `::MM', but selects all words which do not match
@@ -777,18 +783,18 @@ VVAARRIIAABBLLEE AASSSSIIGG
 
      ::CC/_p_a_t_t_e_r_n/_r_e_p_l_a_c_e_m_e_n_t/[11ggWW]
           The ::CC modifier is just like the ::SS modifier except that the old and
-          new strings, instead of being simple strings, are a regular expres-
-          sion (see regex(3)) string _p_a_t_t_e_r_n and an ed(1)-style string
-          _r_e_p_l_a_c_e_m_e_n_t.  Normally, the first occurrence of the pattern _p_a_t_t_e_r_n
-          in each word of the value is substituted with _r_e_p_l_a_c_e_m_e_n_t.  The `1'
-          modifier causes the substitution to apply to at most one word; the
-          `g' modifier causes the substitution to apply to as many instances
-          of the search pattern _p_a_t_t_e_r_n as occur in the word or words it is
-          found in; the `W' modifier causes the value to be treated as a sin-
-          gle word (possibly containing embedded white space).  Note that `1'
-          and `g' are orthogonal; the former specifies whether multiple words
-          are potentially affected, the latter whether multiple substitutions
-          can potentially occur within each affected word.
+          new strings, instead of being simple strings, are an extended regu-
+          lar expression (see regex(3)) string _p_a_t_t_e_r_n and an ed(1)-style
+          string _r_e_p_l_a_c_e_m_e_n_t.  Normally, the first occurrence of the pattern
+          _p_a_t_t_e_r_n in each word of the value is substituted with _r_e_p_l_a_c_e_m_e_n_t.
+          The `1' modifier causes the substitution to apply to at most one
+          word; the `g' modifier causes the substitution to apply to as many
+          instances of the search pattern _p_a_t_t_e_r_n as occur in the word or
+          words it is found in; the `W' modifier causes the value to be
+          treated as a single word (possibly containing embedded white space).
+          Note that `1' and `g' are orthogonal; the former specifies whether
+          multiple words are potentially affected, the latter whether multiple
+          substitutions can potentially occur within each affected word.
 
      ::TT   Replaces each word in the variable with its last component.
 
@@ -1107,7 +1113,7 @@ SSPPEECCIIAALL SSOOUURRCCEE
 
      ..MMAAKKEE     Execute the commands associated with this target even if the --nn
                or --tt options were specified.  Normally used to mark recursive
-               bbmmaakkee's.
+               bbmmaakkees.
 
      ..MMEETTAA     Create a meta file for the target, even if it is flagged as
                ..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL.  Usage in conjunction with ..MMAAKKEE is
@@ -1378,4 +1384,4 @@ BBUUGGSS
 
      There is no way of escaping a space character in a filename.
 
-NetBSD 5.1                      August 11, 2013                     NetBSD 5.1
+NetBSD 5.1                     October 25, 2013                     NetBSD 5.1

Modified: head/contrib/bmake/boot-strap
==============================================================================
--- head/contrib/bmake/boot-strap	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/boot-strap	Mon Jan 27 17:47:21 2014	(r261212)
@@ -111,7 +111,7 @@
 #	Simon J. Gerraty <sjg at crufty.net>
 
 # RCSid:
-#	$Id: boot-strap,v 1.43 2013/03/02 18:55:23 sjg Exp $
+#	$Id: boot-strap,v 1.44 2014/01/08 14:49:10 sjg Exp $
 #
 #	@(#) Copyright (c) 2001 Simon J. Gerraty
 #
@@ -216,11 +216,9 @@ do
 	--share=*) share_dir=`get_optarg "$1"`;;
 	--share) share_dir="$2"; shift;;
 	--with-default-sys-path=*)
-	    CONFIGURE_ARGS="$1"
-	    MAKESYSPATH=`get_optarg "$1"`;;
+	    CONFIGURE_ARGS="$1";;
 	--with-default-sys-path)
-	    CONFIGURE_ARGS="$1 $2"
-	    MAKESYSPATH="$2"; shift;;
+	    CONFIGURE_ARGS="$1 $2";;
 	--install) INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix};;
 	--install-host-target)
                 INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix}
@@ -330,8 +328,8 @@ add_path () {
 srcdir=`GetDir /bmake make-bootstrap.sh.in "$srcdir" "$2" "$Mydir" ./bmake* "$Mydir"/../bmake*`
 [ -d "${srcdir:-/dev/null}" ] || Usage
 case "$mksrc" in
-none|-) # we don't want it
-	mksrc=
+none|-) # we ignore this now
+	mksrc=$Mydir/mk
 	;;
 .../*)	# find here or above
 	mksrc=`FindHereOrAbove -C "$Mydir" -s "$mksrc/sys.mk"`

Modified: head/contrib/bmake/compat.c
==============================================================================
--- head/contrib/bmake/compat.c	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/compat.c	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.93 2013/09/02 19:26:42 sjg Exp $	*/
+/*	$NetBSD: compat.c,v 1.94 2014/01/03 00:02:01 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.93 2013/09/02 19:26:42 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.94 2014/01/03 00:02:01 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.93 2013/09/02 19:26:42 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.94 2014/01/03 00:02:01 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -133,7 +133,7 @@ Compat_Init(void)
 
     Shell_Init();		/* setup default shell */
     
-    for (cp = "#=|^(){};&<>*?[]:$`\\\n"; *cp != '\0'; cp++) {
+    for (cp = "~#=|^(){};&<>*?[]:$`\\\n"; *cp != '\0'; cp++) {
 	meta[(unsigned char) *cp] = 1;
     }
     /*

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	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/configure.in	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,10 +1,11 @@
 dnl
 dnl RCSid:
-dnl	$Id: configure.in,v 1.49 2013/07/06 18:25:19 sjg Exp $
+dnl	$Id: configure.in,v 1.51 2014/01/02 22:20:52 sjg Exp $
 dnl
 dnl Process this file with autoconf to produce a configure script
 dnl
-AC_INIT([bmake], [20130706], [sjg at NetBSD.org])
+AC_PREREQ(2.50)
+AC_INIT([bmake], [20140101], [sjg at NetBSD.org])
 AC_CONFIG_HEADER(config.h)
 
 dnl make srcdir absolute
@@ -77,7 +78,18 @@ AC_PROG_GCC_TRADITIONAL
 AC_PROG_INSTALL
 dnl Executable suffix - normally empty; .exe on os2.
 AC_SUBST(ac_exe_suffix)dnl
-
+dnl
+dnl Hurd refuses to define PATH_MAX or MAXPATHLEN
+if test -x /usr/bin/getconf; then
+   bmake_path_max=`getconf PATH_MAX / 2> /dev/null`
+fi
+bmake_path_max=${bmake_path_max:-1024}
+if test $bmake_path_max -gt 1024; then
+   # this is all we expect
+   bmake_path_max=1024
+fi
+echo "Using: BMAKE_PATH_MAX=$bmake_path_max" >&6
+AC_SUBST(bmake_path_max)dnl
 dnl
 dnl AC_C_CROSS
 dnl
@@ -98,6 +110,7 @@ AC_CHECK_HEADERS( \
 	sys/mman.h \
 	sys/select.h \
 	sys/socket.h \
+	sys/sysctl.h \
 	sys/time.h \
 	sys/uio.h \
 	unistd.h \
@@ -159,6 +172,7 @@ AC_CHECK_FUNCS( \
 	strsep \
 	strtod \
 	strtol \
+	sysctl \
 	unsetenv \
 	vsnprintf \
 	wait3 \

Modified: head/contrib/bmake/hash.c
==============================================================================
--- head/contrib/bmake/hash.c	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/hash.c	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.19 2009/01/24 10:59:09 dsl Exp $	*/
+/*	$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 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: hash.c,v 1.19 2009/01/24 10:59:09 dsl Exp $";
+static char rcsid[] = "$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)hash.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: hash.c,v 1.19 2009/01/24 10:59:09 dsl Exp $");
+__RCSID("$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif

Modified: head/contrib/bmake/lst.lib/lstMember.c
==============================================================================
--- head/contrib/bmake/lst.lib/lstMember.c	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/lst.lib/lstMember.c	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,4 +1,4 @@
-/*	$NetBSD: lstMember.c,v 1.13 2009/01/23 21:26:30 dsl Exp $	*/
+/*	$NetBSD: lstMember.c,v 1.14 2013/11/14 00:01:28 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -33,14 +33,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lstMember.c,v 1.13 2009/01/23 21:26:30 dsl Exp $";
+static char rcsid[] = "$NetBSD: lstMember.c,v 1.14 2013/11/14 00:01:28 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)lstMember.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: lstMember.c,v 1.13 2009/01/23 21:26:30 dsl Exp $");
+__RCSID("$NetBSD: lstMember.c,v 1.14 2013/11/14 00:01:28 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif

Modified: head/contrib/bmake/main.c
==============================================================================
--- head/contrib/bmake/main.c	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/main.c	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.224 2013/09/04 15:38:26 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.225 2013/09/14 15:09:34 matt Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.224 2013/09/04 15:38:26 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.225 2013/09/14 15:09:34 matt 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.224 2013/09/04 15:38:26 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.225 2013/09/14 15:09:34 matt Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -118,6 +118,9 @@ __RCSID("$NetBSD: main.c,v 1.224 2013/09
 #include <sys/param.h>
 #include <sys/resource.h>
 #include <sys/stat.h>
+#if defined(MAKE_NATIVE) && defined(HAVE_SYSCTL)
+#include <sys/sysctl.h>
+#endif
 #include <sys/utsname.h>
 #include "wait.h"
 
@@ -145,6 +148,10 @@ __RCSID("$NetBSD: main.c,v 1.224 2013/09
 #define	DEFMAXLOCAL DEFMAXJOBS
 #endif	/* DEFMAXLOCAL */
 
+#ifndef __arraycount
+# define __arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))
+#endif
+
 Lst			create;		/* Targets to be made */
 time_t			now;		/* Time at start of make */
 GNode			*DEFAULT;	/* .DEFAULT node */
@@ -910,6 +917,20 @@ main(int argc, char **argv)
 	}
 
 	if (!machine_arch) {
+#if defined(MAKE_NATIVE) && defined(HAVE_SYSCTL) && defined(CTL_HW) && defined(HW_MACHINE_ARCH)
+	    static char machine_arch_buf[sizeof(utsname.machine)];
+	    int mib[2] = { CTL_HW, HW_MACHINE_ARCH };
+	    size_t len = sizeof(machine_arch_buf);
+                
+	    if (sysctl(mib, __arraycount(mib), machine_arch_buf,
+		    &len, NULL, 0) < 0) {
+		(void)fprintf(stderr, "%s: sysctl failed (%s).\n", progname,
+		    strerror(errno));
+		exit(2);
+	    }
+
+	    machine_arch = machine_arch_buf;
+#else
 #ifndef MACHINE_ARCH
 #ifdef MAKE_MACHINE_ARCH
             machine_arch = MAKE_MACHINE_ARCH;
@@ -919,6 +940,7 @@ main(int argc, char **argv)
 #else
 	    machine_arch = MACHINE_ARCH;
 #endif
+#endif
 	}
 
 	myPid = getpid();		/* remember this for vFork() */

Modified: head/contrib/bmake/make-bootstrap.sh.in
==============================================================================
--- head/contrib/bmake/make-bootstrap.sh.in	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/make-bootstrap.sh.in	Mon Jan 27 17:47:21 2014	(r261212)
@@ -11,7 +11,7 @@ yes) XDEFS="-DUSE_META ${XDEFS}";;
 esac
 
 CC="@CC@"
-CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS}"
+CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS} -DBMAKE_PATH_MAX=@bmake_path_max@"
 
 MAKE_VERSION=`sed -n '/^MAKE_VERSION=/s,.*=[^0-9]*,,p' $srcdir/Makefile`
 

Modified: head/contrib/bmake/make.1
==============================================================================
--- head/contrib/bmake/make.1	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/make.1	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.222 2013/08/11 09:53:49 apb Exp $
+.\"	$NetBSD: make.1,v 1.226 2013/11/07 18:50:46 dholland 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 11, 2013
+.Dd October 25, 2013
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -756,7 +756,7 @@ then output for each target is prefixed 
 .Ql --- target ---
 the first part of which can be controlled via
 .Va .MAKE.JOB.PREFIX .
-If 
+If
 .Va .MAKE.JOB.PREFIX
 is empty, no token is printed.
 .br
@@ -1077,6 +1077,13 @@ may
 be used.
 The wildcard characters may be escaped with a backslash
 .Pq Ql \e .
+As a consequence of the way values are split into words, matched,
+and then joined, a construct like
+.Dl ${VAR:M*}
+will normalise the inter-word spacing, removing all leading and
+trailing space, and converting multiple consecutive spaces
+to single spaces.
+.
 .It Cm \&:N Ns Ar pattern
 This is identical to
 .Ql Cm \&:M ,
@@ -1220,7 +1227,7 @@ The
 modifier is just like the
 .Cm \&:S
 modifier except that the old and new strings, instead of being
-simple strings, are a regular expression (see
+simple strings, are an extended regular expression (see
 .Xr regex 3 )
 string
 .Ar pattern
@@ -1762,7 +1769,7 @@ or
 .Fl t
 options were specified.
 Normally used to mark recursive
-.Nm Ns 's .
+.Nm Ns s .
 .It Ic .META
 Create a meta file for the target, even if it is flagged as
 .Ic .PHONY ,

Modified: head/contrib/bmake/make.h
==============================================================================
--- head/contrib/bmake/make.h	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/make.h	Mon Jan 27 17:47:21 2014	(r261212)
@@ -518,4 +518,8 @@ int str2Lst_Append(Lst, char *, const ch
 #define MAX(a, b) ((a > b) ? a : b)
 #endif
 
+#ifndef MAXPATHLEN
+#define MAXPATHLEN BMAKE_PATH_MAX
+#endif
+
 #endif /* _MAKE_H_ */

Modified: head/contrib/bmake/meta.c
==============================================================================
--- head/contrib/bmake/meta.c	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/meta.c	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.32 2013/06/25 00:20:54 sjg Exp $ */
+/*      $NetBSD: meta.c,v 1.33 2013/10/01 05:37:17 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -860,6 +860,13 @@ string_match(const void *p, const void *
     continue; \
     }
 
+#define DEQUOTE(p) if (*p == '\'') {	\
+    char *ep; \
+    p++; \
+    if ((ep = strchr(p, '\''))) \
+	*ep = '\0'; \
+    }
+
 Boolean
 meta_oodate(GNode *gn, Boolean oodate)
 {
@@ -872,6 +879,8 @@ meta_oodate(GNode *gn, Boolean oodate)
     char fname2[MAXPATHLEN];
     char *p;
     char *cp;
+    char *link_src;
+    char *move_target;
     static size_t cwdlen = 0;
     static size_t tmplen = 0;
     FILE *fp;
@@ -938,6 +947,8 @@ meta_oodate(GNode *gn, Boolean oodate)
 		oodate = TRUE;
 		break;
 	    }
+	    link_src = NULL;
+	    move_target = NULL;
 	    /* Find the start of the build monitor section. */
 	    if (!f) {
 		if (strncmp(buf, "-- filemon", 10) == 0) {
@@ -1051,16 +1062,21 @@ meta_oodate(GNode *gn, Boolean oodate)
 		    break;
 
 		case 'M':		/* renaMe */
-		    if (Lst_IsEmpty(missingFiles))
-			break;
+		    /*
+		     * For 'M'oves we want to check
+		     * the src as for 'R'ead
+		     * and the target as for 'W'rite.
+		     */
+		    cp = p;		/* save this for a second */
+		    /* now get target */
+		    if (strsep(&p, " ") == NULL)
+			continue;
+		    CHECK_VALID_META(p);
+		    move_target = p;
+		    p = cp;
 		    /* 'L' and 'M' put single quotes around the args */
-		    if (*p == '\'') {
-			char *ep;
-
-			p++;
-			if ((ep = strchr(p, '\'')))
-			    *ep = '\0';
-		    }
+		    DEQUOTE(p);
+		    DEQUOTE(move_target);
 		    /* FALLTHROUGH */
 		case 'D':		/* unlink */
 		    if (*p == '/' && !Lst_IsEmpty(missingFiles)) {
@@ -1072,22 +1088,39 @@ meta_oodate(GNode *gn, Boolean oodate)
 			    ln = NULL;	/* we're done with it */
 			}
 		    }
+		    if (buf[0] == 'M') {
+			/* the target of the mv is a file 'W'ritten */
+#ifdef DEBUG_META_MODE
+			if (DEBUG(META))
+			    fprintf(debug_file, "meta_oodate: M %s -> %s\n",
+				    p, move_target);
+#endif
+			p = move_target;
+			goto check_write;
+		    }
 		    break;
 		case 'L':		/* Link */
-		    /* we want the target */
+		    /*
+		     * For 'L'inks check
+		     * the src as for 'R'ead
+		     * and the target as for 'W'rite.
+		     */
+		    link_src = p;
+		    /* now get target */
 		    if (strsep(&p, " ") == NULL)
 			continue;
 		    CHECK_VALID_META(p);
 		    /* 'L' and 'M' put single quotes around the args */
-		    if (*p == '\'') {
-			char *ep;
-
-			p++;
-			if ((ep = strchr(p, '\'')))
-			    *ep = '\0';
-		    }
+		    DEQUOTE(p);
+		    DEQUOTE(link_src);
+#ifdef DEBUG_META_MODE
+		    if (DEBUG(META))
+			fprintf(debug_file, "meta_oodate: L %s -> %s\n",
+				link_src, p);
+#endif
 		    /* FALLTHROUGH */
 		case 'W':		/* Write */
+		check_write:
 		    /*
 		     * If a file we generated within our bailiwick
 		     * but outside of .OBJDIR is missing,
@@ -1119,6 +1152,14 @@ meta_oodate(GNode *gn, Boolean oodate)
 			Lst_AtEnd(missingFiles, bmake_strdup(p));
 		    }
 		    break;
+		check_link_src:
+		    p = link_src;
+		    link_src = NULL;
+#ifdef DEBUG_META_MODE
+		    if (DEBUG(META))
+			fprintf(debug_file, "meta_oodate: L src %s\n", p);
+#endif
+		    /* FALLTHROUGH */
 		case 'R':		/* Read */
 		case 'E':		/* Exec */
 		    /*
@@ -1213,6 +1254,8 @@ meta_oodate(GNode *gn, Boolean oodate)
 		default:
 		    break;
 		}
+		if (!oodate && buf[0] == 'L' && link_src != NULL)
+		    goto check_link_src;
 	    } else if (strcmp(buf, "CMD") == 0) {
 		/*
 		 * Compare the current command with the one in the

Modified: head/contrib/bmake/mk/ChangeLog
==============================================================================
--- head/contrib/bmake/mk/ChangeLog	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/mk/ChangeLog	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,3 +1,22 @@
+2013-12-12  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* install-mk (MK_VERSION): bump version
+	* meta2deps.py: convert to print function for python3 compat.
+	  we also need to open files with mode 'r' rather than 'rb'
+	  otherwise we get bytes instead of strings.
+
+2013-10-10  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* install-mk (MK_VERSION): bump version
+
+	* dirdeps.mk: when TARGET_SPEC_VARS is more than just MACHINE
+	  apply the same filtering (M_dep_qual_fixes) when setting _machines
+	  as _build_dirs.
+	  Also fix the filtering of Makefile.depend files - for reporting
+	  what we are looking for (M_dep_qual_fixes can get confused by
+	  Makefile.depend) 
+	  Add some more debug info.
+
 2013-09-04  Simon J. Gerraty  <sjg at bad.crufty.net>
 
 	* gendirdeps.mk (_objtops): fix typo also

Modified: head/contrib/bmake/mk/dirdeps.mk
==============================================================================
--- head/contrib/bmake/mk/dirdeps.mk	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/mk/dirdeps.mk	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.28 2013/03/25 21:11:43 sjg Exp $
+# $Id: dirdeps.mk,v 1.29 2013/10/13 18:43:53 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -149,11 +149,11 @@ DEP_$v ?= ${$v}
 JOT ?= jot
 _tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh}
 # this handles unqualified entries
-M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.${DEP_TARGET_SPEC};
+M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC};
 # there needs to be at least one item missing for these to make sense
 .for i in ${_tspec_x:[2..-1]}
 _tspec_m$i := ${TARGET_SPEC_VARS:[2..$i]:@w@[^,]+@:ts,}
-_tspec_a$i := ,${TARGET_SPEC_VARS:[$i..-1]:@v@$${DEP_$v}@:ts,}
+_tspec_a$i := ,${TARGET_SPEC_VARS:[$i..-1]:@v@$$$${DEP_$v}@:ts,}
 M_dep_qual_fixes += C;(\.${_tspec_m$i})$$;\1${_tspec_a$i};
 .endfor
 .else
@@ -359,7 +359,8 @@ _machines := ${_machines:O:u}
 .if ${TARGET_SPEC_VARS:[#]} > 1
 # we need to tweak _machines
 _dm := ${DEP_MACHINE}
-_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@}
+# apply the same filtering that we do when qualifying DIRDEPS.
+_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@:${M_dep_qual_fixes:ts:}:O:u}
 DEP_MACHINE := ${_dm}
 .endif
 
@@ -464,6 +465,9 @@ ${_this_dir}.$m: ${_build_dirs:M*.$m:N${
 .if ${_DIRDEP_CHECKED:M$d} == ""
 # once only
 _DIRDEP_CHECKED += $d
+.if !empty(_debug_search)
+.info checking $d
+.endif
 # Note: _build_dirs is fully qualifed so d:R is always the directory
 .if exists(${d:R})
 # Warning: there is an assumption here that MACHINE is always 
@@ -471,7 +475,8 @@ _DIRDEP_CHECKED += $d
 # If TARGET_SPEC and MACHINE are insufficient, you have a problem.
 _m := ${.MAKE.DEPENDFILE_PREFERENCE:T:S;${TARGET_SPEC}$;${d:E};:S;${MACHINE};${d:E:C/,.*//};:@m@${exists(${d:R}/$m):?${d:R}/$m:}@:[1]}
 .if !empty(_m)
-_qm := ${_m:${M_dep_qual_fixes:ts:}}
+# M_dep_qual_fixes isn't geared to Makefile.depend
+_qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}}
 .if !empty(_debug_search)
 .info Looking for ${_qm}
 .endif

Modified: head/contrib/bmake/mk/install-mk
==============================================================================
--- head/contrib/bmake/mk/install-mk	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/mk/install-mk	Mon Jan 27 17:47:21 2014	(r261212)
@@ -55,7 +55,7 @@
 #       Simon J. Gerraty <sjg at crufty.net>
 
 # RCSid:
-#	$Id: install-mk,v 1.93 2013/08/02 18:28:47 sjg Exp $
+#	$Id: install-mk,v 1.95 2013/12/20 06:08:52 sjg Exp $
 #
 #	@(#) Copyright (c) 1994 Simon J. Gerraty
 #
@@ -70,7 +70,7 @@
 #	sjg at crufty.net
 #
 
-MK_VERSION=20130801
+MK_VERSION=20131212
 OWNER=
 GROUP=
 MODE=444

Modified: head/contrib/bmake/mk/meta2deps.py
==============================================================================
--- head/contrib/bmake/mk/meta2deps.py	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/mk/meta2deps.py	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
+
 """
 This script parses each "meta" file and extracts the
 information needed to deduce build and src dependencies.
@@ -35,7 +37,7 @@ We only pay attention to a subset of the
 
 """
 RCSid:
-	$Id: meta2deps.py,v 1.15 2013/07/29 20:41:23 sjg Exp $
+	$Id: meta2deps.py,v 1.16 2013/12/20 06:08:52 sjg Exp $
 
 	Copyright (c) 2011-2013, Juniper Networks, Inc.
 	All rights reserved.
@@ -90,14 +92,14 @@ def resolve(path, cwd, last_dir=None, de
             continue
         p = '/'.join([d,path])
         if debug > 2:
-            print >> debug_out, "looking for:", p,
+            print("looking for:", p, end=' ', file=debug_out)
         if not os.path.exists(p):
             if debug > 2:
-                print >> debug_out, "nope"
+                print("nope", file=debug_out)
             p = None
             continue
         if debug > 2:
-            print >> debug_out, "found:", p
+            print("found:", p, file=debug_out)
         return p
     return None
 
@@ -236,21 +238,21 @@ class MetaFile:
             self.objroots.sort(reverse=True)
             
             if self.debug:
-                print >> self.debug_out, "host_target=", self.host_target
-                print >> self.debug_out, "srctops=", self.srctops
-                print >> self.debug_out, "objroots=", self.objroots
+                print("host_target=", self.host_target, file=self.debug_out)
+                print("srctops=", self.srctops, file=self.debug_out)
+                print("objroots=", self.objroots, file=self.debug_out)
 
             self.dirdep_re = re.compile(r'([^/]+)/(.+)')
 
         if self.dpdeps and not self.reldir:
             if self.debug:
-                print >> self.debug_out, "need reldir:",
+                print("need reldir:", end=' ', file=self.debug_out)
             if self.curdir:
                 srctop = self.find_top(self.curdir, self.srctops)
                 if srctop:
                     self.reldir = self.curdir.replace(srctop,'')
                     if self.debug:
-                        print >> self.debug_out, self.reldir
+                        print(self.reldir, file=self.debug_out)
             if not self.reldir:
                 self.dpdeps = None      # we cannot do it?
 
@@ -280,7 +282,7 @@ class MetaFile:
         if not self.reldir:
             return None
         for f in sort_unique(self.file_deps):
-            print >> out, 'DPDEPS_%s += %s' % (f, self.reldir)
+            print('DPDEPS_%s += %s' % (f, self.reldir), file=out)
 
     def seenit(self, dir):
         """rememer that we have seen dir."""
@@ -291,14 +293,14 @@ class MetaFile:
         if data not in list:
             list.append(data)
             if self.debug:
-                print >> self.debug_out, "%s: %sAdd: %s" % (self.name, clue, data)
+                print("%s: %sAdd: %s" % (self.name, clue, data), file=self.debug_out)
 
     def find_top(self, path, list):
         """the logical tree may be split accross multiple trees"""
         for top in list:
             if path.startswith(top):
                 if self.debug > 2:
-                    print >> self.debug_out, "found in", top
+                    print("found in", top, file=self.debug_out)
                 return top
         return None
 
@@ -307,9 +309,9 @@ class MetaFile:
         ddep = None
         for ddepf in [path + '.dirdep', dir + '/.dirdep']:
             if not ddep and os.path.exists(ddepf):
-                ddep = open(ddepf, 'rb').readline().strip('# \n')
+                ddep = open(ddepf, 'r').readline().strip('# \n')
                 if self.debug > 1:
-                    print >> self.debug_out, "found %s: %s\n" % (ddepf, ddep)
+                    print("found %s: %s\n" % (ddepf, ddep), file=self.debug_out)
                 if ddep.endswith(self.machine):
                     ddep = ddep[0:-(1+len(self.machine))]
                 elif self.target_spec and ddep.endswith(self.target_spec):
@@ -331,7 +333,7 @@ class MetaFile:
                     if not (self.machine == 'host' and
                             dmachine == self.host_target):
                         if self.debug > 2:
-                            print >> self.debug_out, "adding .%s to %s" % (dmachine, ddep)
+                            print("adding .%s to %s" % (dmachine, ddep), file=self.debug_out)
                         ddep += '.' + dmachine
 
         return ddep
@@ -342,7 +344,7 @@ class MetaFile:
             self.parse(name, file)
         except:
             # give a useful clue
-            print >> sys.stderr, '{}:{}: '.format(self.name, self.line),
+            print('{}:{}: '.format(self.name, self.line), end=' ', file=sys.stderr)
             raise
         
     def parse(self, name=None, file=None):
@@ -379,7 +381,7 @@ class MetaFile:
             f = file
             cwd = last_dir = self.cwd
         else:
-            f = open(self.name, 'rb')
+            f = open(self.name, 'r')
         skip = True
         pid_cwd = {}
         pid_last_dir = {}
@@ -396,7 +398,7 @@ class MetaFile:
             if not line[0] in interesting:
                 continue
             if self.debug > 2:
-                print >> self.debug_out, "input:", line,
+                print("input:", line, end=' ', file=self.debug_out)
             w = line.split()
 
             if skip:
@@ -413,7 +415,7 @@ class MetaFile:
                     self.cwd = cwd = last_dir = w[1]
                     self.seenit(cwd)    # ignore this
                     if self.debug:
-                        print >> self.debug_out, "%s: CWD=%s" % (self.name, cwd)
+                        print("%s: CWD=%s" % (self.name, cwd), file=self.debug_out)
                 continue
 
             pid = int(w[1])
@@ -438,12 +440,12 @@ class MetaFile:
                     cwd = cwd[0:-2]
                 last_dir = cwd
                 if self.debug > 1:
-                    print >> self.debug_out, "cwd=", cwd
+                    print("cwd=", cwd, file=self.debug_out)
                 continue
 
             if w[2] in self.seen:
                 if self.debug > 2:
-                    print >> self.debug_out, "seen:", w[2]
+                    print("seen:", w[2], file=self.debug_out)
                 continue
             # file operations
             if w[0] in 'ML':
@@ -461,7 +463,7 @@ class MetaFile:
             dir,base = os.path.split(path)
             if dir in self.seen:
                 if self.debug > 2:
-                    print >> self.debug_out, "seen:", dir
+                    print("seen:", dir, file=self.debug_out)
                 continue
             # we can have a path in an objdir which is a link
             # to the src dir, we may need to add dependencies for each
@@ -472,19 +474,19 @@ class MetaFile:
             # now put path back together
             path = '/'.join([dir,base])
             if self.debug > 1:
-                print >> self.debug_out, "raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path)
+                print("raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path), file=self.debug_out)
             if w[0] in 'SRWL':
                 if w[0] == 'W' and path.endswith('.dirdep'):
                     continue
                 if path in [last_dir, cwd, self.cwd, self.curdir]:
                     if self.debug > 1:
-                        print >> self.debug_out, "skipping:", path
+                        print("skipping:", path, file=self.debug_out)
                     continue
                 if os.path.isdir(path):
                     if w[0] in 'RW':
                         last_dir = path;
                     if self.debug > 1:
-                        print >> self.debug_out, "ldir=", last_dir
+                        print("ldir=", last_dir, file=self.debug_out)
                     continue
 
             if w[0] in 'REWML':
@@ -642,10 +644,10 @@ def main(argv, klass=MetaFile, xopts='',
     debug_out = getv(conf, 'debug_out', sys.stderr)
 
     if debug:
-        print >> debug_out, "config:"
-        print >> debug_out, "psyco=", have_psyco
-        for k,v in conf.items():
-            print >> debug_out, "%s=%s" % (k,v)
+        print("config:", file=debug_out)
+        print("psyco=", have_psyco, file=debug_out)
+        for k,v in list(conf.items()):
+            print("%s=%s" % (k,v), file=debug_out)
 
     for a in args:
         if a.endswith('.meta'):
@@ -657,9 +659,9 @@ def main(argv, klass=MetaFile, xopts='',
                     m = klass(f, conf)
 
     if output:
-        print m.dirdeps()
+        print(m.dirdeps())
 
-        print m.src_dirdeps('\nsrc:')
+        print(m.src_dirdeps('\nsrc:'))
 
         dpdeps = getv(conf, 'DPDEPS')
         if dpdeps:
@@ -672,6 +674,6 @@ if __name__ == '__main__':
         main(sys.argv)
     except:
         # yes, this goes to stdout
-        print "ERROR: ", sys.exc_info()[1]
+        print("ERROR: ", sys.exc_info()[1])
         raise
 

Modified: head/contrib/bmake/parse.c
==============================================================================
--- head/contrib/bmake/parse.c	Mon Jan 27 17:31:21 2014	(r261211)
+++ head/contrib/bmake/parse.c	Mon Jan 27 17:47:21 2014	(r261212)
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $	*/
+/*	$NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list