Author: sjg
Date: Sat Apr 15 01:44:45 2017
New Revision: 316949
URL: https://svnweb.freebsd.org/changeset/base/316949

Log:
  Update to bmake 20170413

Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/Makefile
  head/contrib/bmake/job.c
  head/contrib/bmake/main.c
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/auto.obj.mk
  head/contrib/bmake/mk/dirdeps.mk
  head/contrib/bmake/mk/install-mk
  head/contrib/bmake/mk/meta.stage.mk
  head/contrib/bmake/mk/meta2deps.py
  head/contrib/bmake/mk/mkopt.sh
  head/contrib/bmake/str.c
  head/contrib/bmake/unit-tests/modmatch.exp
  head/contrib/bmake/unit-tests/modmatch.mk
  head/usr.bin/bmake/Makefile
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==============================================================================
--- head/contrib/bmake/ChangeLog        Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/ChangeLog        Sat Apr 15 01:44:45 2017        
(r316949)
@@ -1,8 +1,35 @@
+2017-04-13  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * Makefile (_MAKE_VERSION): 20170413
+         Merge with NetBSD make, pick up
+         o main.c: when setting .OBJDIR ignore '$' in paths.
+
+       * job.c: use MALLOC_OPTIONS to set malloc_options.
+
+2017-04-11  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * Makefile (_MAKE_VERSION): 20170411
+         Merge with NetBSD make, pick up
+         o str.c: Str_Match: allow [^a-z] to behave as expected.
+
+2017-03-26  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * Makefile (_MAKE_VERSION): 20170326
+         Merge with NetBSD make, pick up
+         o main.c: purge relative paths from realpath cache when .OBJDIR
+           is changed.
+
+2017-03-11  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * Makefile (_MAKE_VERSION): 20170311
+         Merge with NetBSD make, pick up
+          o main.c: only use -C arg "as is" if it starts with '/'.
+
 2017-03-01  Simon J. Gerraty  <s...@bad.crufty.net>
 
        * Makefile (_MAKE_VERSION): 20170301
          Merge with NetBSD make, pick up
-         o main.c: use -C arg as is rather than getcwd()
+         o main.c: use -C arg "as is" rather than getcwd()
            if they identify the same directory.
          o parse.c: ensure loadfile buffer is \n terminated in non-mmap case
 

Modified: head/contrib/bmake/Makefile
==============================================================================
--- head/contrib/bmake/Makefile Sat Apr 15 00:51:35 2017        (r316948)
+++ head/contrib/bmake/Makefile Sat Apr 15 01:44:45 2017        (r316949)
@@ -1,7 +1,7 @@
-#      $Id: Makefile,v 1.81 2017/03/01 17:01:23 sjg Exp $
+#      $Id: Makefile,v 1.85 2017/04/13 16:29:40 sjg Exp $
 
 # Base version on src date
-_MAKE_VERSION= 20170301
+_MAKE_VERSION= 20170413
 
 PROG=  bmake
 

Modified: head/contrib/bmake/job.c
==============================================================================
--- head/contrib/bmake/job.c    Sat Apr 15 00:51:35 2017        (r316948)
+++ head/contrib/bmake/job.c    Sat Apr 15 01:44:45 2017        (r316949)
@@ -389,7 +389,10 @@ static void JobSigLock(sigset_t *);
 static void JobSigUnlock(sigset_t *);
 static void JobSigReset(void);
 
-const char *malloc_options="A";
+#if !defined(MALLOC_OPTIONS)
+# define MALLOC_OPTIONS "A"
+#endif
+const char *malloc_options= MALLOC_OPTIONS;
 
 static void
 job_table_dump(const char *where)

Modified: head/contrib/bmake/main.c
==============================================================================
--- head/contrib/bmake/main.c   Sat Apr 15 00:51:35 2017        (r316948)
+++ head/contrib/bmake/main.c   Sat Apr 15 01:44:45 2017        (r316949)
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.257 2017/02/08 17:47:36 christos Exp $      */
+/*     $NetBSD: main.c,v 1.260 2017/04/13 13:55:23 christos Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.257 2017/02/08 17:47:36 christos 
Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.260 2017/04/13 13:55:23 christos 
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.257 2017/02/08 17:47:36 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.260 2017/04/13 13:55:23 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -722,22 +722,15 @@ Boolean
 Main_SetObjdir(const char *fmt, ...)
 {
        struct stat sb;
-       char *p, *path;
-       char buf[MAXPATHLEN + 1], pbuf[MAXPATHLEN + 1];
+       char *path;
+       char buf[MAXPATHLEN + 1];
        Boolean rc = FALSE;
        va_list ap;
 
        va_start(ap, fmt);
-       vsnprintf(path = pbuf, MAXPATHLEN, fmt, ap);
+       vsnprintf(path = buf, MAXPATHLEN, fmt, ap);
        va_end(ap);
 
-       /* expand variable substitutions */
-       if (strchr(path, '$') != 0) {
-               snprintf(buf, MAXPATHLEN, "%s", path);
-               path = p = Var_Subst(NULL, buf, VAR_GLOBAL, VARF_WANTRES);
-       } else
-               p = NULL;
-
        if (path[0] != '/') {
                snprintf(buf, MAXPATHLEN, "%s/%s", curdir, path);
                path = buf;
@@ -753,25 +746,35 @@ Main_SetObjdir(const char *fmt, ...)
                        Var_Set(".OBJDIR", objdir, VAR_GLOBAL, 0);
                        setenv("PWD", objdir, 1);
                        Dir_InitDot();
+                       cached_realpath(".OBJDIR", NULL); /* purge */
                        rc = TRUE;
                        if (enterFlag && strcmp(objdir, curdir) != 0)
                                enterFlagObj = TRUE;
                }
        }
 
-       free(p);
        return rc;
 }
 
 static Boolean
 Main_SetVarObjdir(const char *var, const char *suffix)
 {
-       char *p1, *path;
-       if ((path = Var_Value(var, VAR_CMD, &p1)) == NULL)
+       char *p, *path, *xpath;
+
+       if ((path = Var_Value(var, VAR_CMD, &p)) == NULL)
                return FALSE;
 
-       (void)Main_SetObjdir("%s%s", path, suffix);
-       free(p1);
+       /* expand variable substitutions */
+       if (strchr(path, '$') != 0)
+               xpath = Var_Subst(NULL, path, VAR_GLOBAL, VARF_WANTRES);
+       else
+               xpath = path;
+
+       (void)Main_SetObjdir("%s%s", xpath, suffix);
+
+       if (xpath != path)
+               free(xpath);
+       free(p);
        return TRUE;
 }
 
@@ -1923,7 +1926,23 @@ cached_realpath(const char *pathname, ch
        cache->flags = INTERNAL;
 #endif
     }
-
+    if (resolved == NULL && strcmp(pathname, ".OBJDIR") == 0) {
+       /* purge any relative paths */
+       Hash_Entry *he, *nhe;
+       Hash_Search hs;
+
+       he = Hash_EnumFirst(&cache->context, &hs);
+       while (he) {
+           nhe = Hash_EnumNext(&hs);
+           if (he->name[0] != '/') {
+               if (DEBUG(DIR))
+                   fprintf(stderr, "cached_realpath: purging %s\n", he->name);
+               Hash_DeleteEntry(&cache->context, he);
+           }
+           he = nhe;
+       }
+       return NULL;
+    }
     if ((rp = Var_Value(pathname, cache, &cp)) != NULL) {
        /* a hit */
        strlcpy(resolved, rp, MAXPATHLEN);

Modified: head/contrib/bmake/mk/ChangeLog
==============================================================================
--- head/contrib/bmake/mk/ChangeLog     Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/mk/ChangeLog     Sat Apr 15 01:44:45 2017        
(r316949)
@@ -1,3 +1,24 @@
+2017-04-01  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * install-mk (MK_VERSION): 20170401
+
+       * meta2deps.py: add is_src so we can check if obj dependency
+         is also a src dependency.
+
+2017-03-26  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * install-mk (MK_VERSION): 20170326
+
+       * meta.stage.mk: do nothing if NO_STAGING is defined.
+
+2017-03-24  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * auto.obj.mk: handle the case of __objdir=obj or obj.${MACHINE} etc.
+
+2017-03-18  Simon J. Gerraty  <s...@bad.crufty.net>
+
+       * mkopt.sh: treat WITH_*=NO like no; ie. WITHOUT_*
+
 2017-03-01  Simon J. Gerraty  <s...@bad.crufty.net>
 
        * install-mk (MK_VERSION): 20170301

Modified: head/contrib/bmake/mk/auto.obj.mk
==============================================================================
--- head/contrib/bmake/mk/auto.obj.mk   Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/mk/auto.obj.mk   Sat Apr 15 01:44:45 2017        
(r316949)
@@ -1,4 +1,4 @@
-# $Id: auto.obj.mk,v 1.12 2015/12/16 01:57:06 sjg Exp $
+# $Id: auto.obj.mk,v 1.13 2017/03/24 20:53:22 sjg Exp $
 #
 #      @(#) Copyright (c) 2004, Simon J. Gerraty
 #
@@ -57,7 +57,10 @@ __objdir_made != echo ${__objdir}/; umas
 # This causes make to use the specified directory as .OBJDIR
 .OBJDIR: ${__objdir}
 .if ${.OBJDIR:tA} != ${__objdir:tA} && ${__objdir_made:Uno:M${__objdir}/*} != 
""
+# watch out for __objdir being relative path
+.if !(${__objdir:M/*} == "" && ${.OBJDIR:tA} == ${${.CURDIR}/${__objdir}:L:tA})
 .error could not use ${__objdir}: .OBJDIR=${.OBJDIR}
 .endif
 .endif
 .endif
+.endif

Modified: head/contrib/bmake/mk/dirdeps.mk
==============================================================================
--- head/contrib/bmake/mk/dirdeps.mk    Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/mk/dirdeps.mk    Sat Apr 15 01:44:45 2017        
(r316949)
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.86 2017/03/01 20:26:51 sjg Exp $
+# $Id: dirdeps.mk,v 1.87 2017/03/07 01:49:03 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -57,7 +57,7 @@
 #      distinguish them from others.
 #      
 #      Before each Makefile.depend file is read, we set 
-#      DEP_RELDIR to be the the RELDIR (path relative to SRCTOP) for
+#      DEP_RELDIR to be the RELDIR (path relative to SRCTOP) for
 #      its directory, and DEP_MACHINE etc according to the .<target_spec>
 #      represented by the suffix of the corresponding target.
 #      

Modified: head/contrib/bmake/mk/install-mk
==============================================================================
--- head/contrib/bmake/mk/install-mk    Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/mk/install-mk    Sat Apr 15 01:44:45 2017        
(r316949)
@@ -55,7 +55,7 @@
 #       Simon J. Gerraty <s...@crufty.net>
 
 # RCSid:
-#      $Id: install-mk,v 1.138 2017/03/01 20:26:51 sjg Exp $
+#      $Id: install-mk,v 1.140 2017/04/03 21:04:09 sjg Exp $
 #
 #      @(#) Copyright (c) 1994 Simon J. Gerraty
 #
@@ -70,7 +70,7 @@
 #      s...@crufty.net
 #
 
-MK_VERSION=20170301
+MK_VERSION=20170401
 OWNER=
 GROUP=
 MODE=444

Modified: head/contrib/bmake/mk/meta.stage.mk
==============================================================================
--- head/contrib/bmake/mk/meta.stage.mk Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/mk/meta.stage.mk Sat Apr 15 01:44:45 2017        
(r316949)
@@ -1,4 +1,4 @@
-# $Id: meta.stage.mk,v 1.48 2017/03/01 22:48:07 sjg Exp $
+# $Id: meta.stage.mk,v 1.49 2017/04/01 02:10:34 sjg Exp $
 #
 #      @(#) Copyright (c) 2011-2017, Simon J. Gerraty
 #
@@ -13,6 +13,8 @@
 #      s...@crufty.net
 #
 
+.ifndef NO_STAGING
+
 .if !target(__${.PARSEFILE}__)
 # the guard target is defined later
 
@@ -324,3 +326,4 @@ stale_staged: staging .NOMETA
 .endif
 .endif
 .endif
+.endif

Modified: head/contrib/bmake/mk/meta2deps.py
==============================================================================
--- head/contrib/bmake/mk/meta2deps.py  Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/mk/meta2deps.py  Sat Apr 15 01:44:45 2017        
(r316949)
@@ -37,7 +37,7 @@ We only pay attention to a subset of the
 
 """
 RCSid:
-       $Id: meta2deps.py,v 1.24 2017/02/08 22:17:10 sjg Exp $
+       $Id: meta2deps.py,v 1.25 2017/04/03 21:04:09 sjg Exp $
 
        Copyright (c) 2011-2013, Juniper Networks, Inc.
        All rights reserved.
@@ -491,6 +491,21 @@ class MetaFile:
         if not file:
             f.close()
 
+    def is_src(self, base, dir, rdir):
+        """is base in srctop"""
+        for dir in [dir,rdir]:
+            if not dir:
+                continue
+            path = '/'.join([dir,base])
+            srctop = self.find_top(path, self.srctops)
+            if srctop:
+                if self.dpdeps:
+                    self.add(self.file_deps, path.replace(srctop,''), 'file')
+                self.add(self.src_deps, dir.replace(srctop,''), 'src')
+                self.seenit(dir)
+                return True
+        return False
+
     def parse_path(self, path, cwd, op=None, w=[]):
         """look at a path for the op specified"""
 
@@ -519,10 +534,9 @@ class MetaFile:
         # to the src dir, we may need to add dependencies for each
         rdir = dir
         dir = abspath(dir, cwd, self.last_dir, self.debug, self.debug_out)
-        if rdir == dir or rdir.find('./') > 0:
-            rdir = None
-        if os.path.islink(dir):
             rdir = os.path.realpath(dir)
+        if rdir == dir:
+            rdir = None
         # now put path back together
         path = '/'.join([dir,base])
         if self.debug > 1:
@@ -543,17 +557,9 @@ class MetaFile:
             # finally, we get down to it
             if dir == self.cwd or dir == self.curdir:
                 return
-            srctop = self.find_top(path, self.srctops)
-            if srctop:
-                if self.dpdeps:
-                    self.add(self.file_deps, path.replace(srctop,''), 'file')
-                self.add(self.src_deps, dir.replace(srctop,''), 'src')
+            if self.is_src(base, dir, rdir):
                 self.seenit(w[2])
-                self.seenit(dir)
-                if rdir and not rdir.startswith(srctop):
-                    dir = rdir      # for below
-                    rdir = None
-                else:
+                if not rdir:
                     return
 
             objroot = None

Modified: head/contrib/bmake/mk/mkopt.sh
==============================================================================
--- head/contrib/bmake/mk/mkopt.sh      Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/mk/mkopt.sh      Sat Apr 15 01:44:45 2017        
(r316949)
@@ -1,5 +1,5 @@
 :
-# $Id: mkopt.sh,v 1.10 2015/06/07 17:29:08 sjg Exp $
+# $Id: mkopt.sh,v 1.11 2017/03/18 21:36:42 sjg Exp $
 #
 #      @(#) Copyright (c) 2014, Simon J. Gerraty
 #
@@ -40,7 +40,7 @@ _mk_opt() {
     eval "_mov=\$$_mo _wov=\$$_wo _wiv=\$$_wi"
 
     case "$_wiv" in
-    no) _wov=no;;
+    [Nn][Oo]) _wov=no;;
     esac
     _v=${_mov:-${_wov:+no}}
     _v=${_v:-${_wiv:+yes}}

Modified: head/contrib/bmake/str.c
==============================================================================
--- head/contrib/bmake/str.c    Sat Apr 15 00:51:35 2017        (r316948)
+++ head/contrib/bmake/str.c    Sat Apr 15 01:44:45 2017        (r316949)
@@ -1,4 +1,4 @@
-/*     $NetBSD: str.c,v 1.36 2016/04/06 09:57:00 gson Exp $    */
+/*     $NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $     */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.36 2016/04/06 09:57:00 gson Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char     sccsid[] = "@(#)str.c  5.8 (Berkeley) 6/1/90";
 #else
-__RCSID("$NetBSD: str.c,v 1.36 2016/04/06 09:57:00 gson Exp $");
+__RCSID("$NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $");
 #endif
 #endif                         /* not lint */
 #endif
@@ -373,16 +373,23 @@ Str_Match(const char *string, const char
                 * by a range (two characters separated by "-").
                 */
                if (*pattern == '[') {
+                       int nomatch;
+
                        ++pattern;
+                       if (*pattern == '^') {
+                               ++pattern;
+                               nomatch = 1;
+                       } else
+                               nomatch = 0;
                        for (;;) {
                                if ((*pattern == ']') || (*pattern == 0))
-                                       return(0);
+                                       return(nomatch);
                                if (*pattern == *string)
                                        break;
                                if (pattern[1] == '-') {
                                        c2 = pattern[2];
                                        if (c2 == 0)
-                                               return(0);
+                                               return(nomatch);
                                        if ((*pattern <= *string) &&
                                            (c2 >= *string))
                                                break;
@@ -393,6 +400,8 @@ Str_Match(const char *string, const char
                                }
                                ++pattern;
                        }
+                       if (nomatch)
+                               return 0;
                        while ((*pattern != ']') && (*pattern != 0))
                                ++pattern;
                        goto thisCharOK;

Modified: head/contrib/bmake/unit-tests/modmatch.exp
==============================================================================
--- head/contrib/bmake/unit-tests/modmatch.exp  Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/unit-tests/modmatch.exp  Sat Apr 15 01:44:45 2017        
(r316949)
@@ -14,4 +14,6 @@ LIB=e X_LIBS:M${LIB${LIB:tu}} is "/tmp/l
 LIB=e X_LIBS:M*/lib${LIB}.a is "/tmp/libe.a"
 LIB=e X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBE.A"
 Mscanner=OK
+Upper=One Two Three Four
+Lower=five six seven
 exit status 0

Modified: head/contrib/bmake/unit-tests/modmatch.mk
==============================================================================
--- head/contrib/bmake/unit-tests/modmatch.mk   Sat Apr 15 00:51:35 2017        
(r316948)
+++ head/contrib/bmake/unit-tests/modmatch.mk   Sat Apr 15 01:44:45 2017        
(r316949)
@@ -15,7 +15,9 @@ res = no
 res = OK
 .endif
 
-all:
+all:   show-libs check-cclass
+
+show-libs:
        @for x in $X; do ${.MAKE} -f ${MAKEFILE} show LIB=$$x; done
        @echo "Mscanner=${res}"
 
@@ -23,3 +25,9 @@ show:
        @echo 'LIB=${LIB} X_LIBS:M$${LIB$${LIB:tu}} is 
"${X_LIBS:M${LIB${LIB:tu}}}"'
        @echo 'LIB=${LIB} X_LIBS:M*/lib$${LIB}.a is "${X_LIBS:M*/lib${LIB}.a}"'
        @echo 'LIB=${LIB} X_LIBS:M*/lib$${LIB}.a:tu is 
"${X_LIBS:M*/lib${LIB}.a:tu}"'
+
+LIST= One Two Three Four five six seven
+
+check-cclass:
+       @echo Upper=${LIST:M[A-Z]*}
+       @echo Lower=${LIST:M[^A-Z]*}

Modified: head/usr.bin/bmake/Makefile
==============================================================================
--- head/usr.bin/bmake/Makefile Sat Apr 15 00:51:35 2017        (r316948)
+++ head/usr.bin/bmake/Makefile Sat Apr 15 01:44:45 2017        (r316949)
@@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
 CLEANDIRS+= FreeBSD
 CLEANFILES+= bootstrap
 
-#      $Id: Makefile,v 1.81 2017/03/01 17:01:23 sjg Exp $
+#      $Id: Makefile,v 1.85 2017/04/13 16:29:40 sjg Exp $
 
 # Base version on src date
-_MAKE_VERSION= 20170301
+_MAKE_VERSION= 20170413
 
 PROG?= ${.CURDIR:T}
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to