aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog29
-rw-r--r--Makefile4
-rw-r--r--job.c5
-rw-r--r--main.c60
-rw-r--r--mk/ChangeLog21
-rw-r--r--mk/auto.obj.mk5
-rw-r--r--mk/dirdeps.mk4
-rw-r--r--mk/install-mk4
-rw-r--r--mk/meta.stage.mk5
-rwxr-xr-xmk/meta2deps.py34
-rwxr-xr-xmk/mkopt.sh4
-rw-r--r--str.c19
-rw-r--r--unit-tests/modmatch.exp2
-rw-r--r--unit-tests/modmatch.mk10
14 files changed, 154 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 49ce971d4934..1e0fb8a7cb63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,35 @@
+2017-04-13 Simon J. Gerraty <sjg@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 <sjg@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 <sjg@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 <sjg@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 <sjg@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
diff --git a/Makefile b/Makefile
index 34493789133f..2d3d412884b6 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/job.c b/job.c
index 199d77df33e4..ecb7266076aa 100644
--- a/job.c
+++ b/job.c
@@ -373,7 +373,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)
diff --git a/main.c b/main.c
index 870eefd6e591..cf9a64dba531 100644
--- a/main.c
+++ b/main.c
@@ -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, 1989, 1990, 1993\
#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
@@ -458,7 +458,8 @@ rearg:
(void)fprintf(stderr, "%s: %s.\n", progname, strerror(errno));
exit(2);
}
- if (stat(argvalue, &sa) != -1 &&
+ if (argvalue[0] == '/' &&
+ stat(argvalue, &sa) != -1 &&
stat(curdir, &sb) != -1 &&
sa.st_ino == sb.st_ino &&
sa.st_dev == sb.st_dev)
@@ -721,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;
@@ -752,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;
}
@@ -1922,7 +1926,23 @@ cached_realpath(const char *pathname, char *resolved)
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);
diff --git a/mk/ChangeLog b/mk/ChangeLog
index ef0bd3793fba..a106a4185d97 100644
--- a/mk/ChangeLog
+++ b/mk/ChangeLog
@@ -1,3 +1,24 @@
+2017-04-01 Simon J. Gerraty <sjg@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 <sjg@bad.crufty.net>
+
+ * install-mk (MK_VERSION): 20170326
+
+ * meta.stage.mk: do nothing if NO_STAGING is defined.
+
+2017-03-24 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * auto.obj.mk: handle the case of __objdir=obj or obj.${MACHINE} etc.
+
+2017-03-18 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * mkopt.sh: treat WITH_*=NO like no; ie. WITHOUT_*
+
2017-03-01 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20170301
diff --git a/mk/auto.obj.mk b/mk/auto.obj.mk
index 2395f6491fe0..bc2d9b07629e 100644
--- a/mk/auto.obj.mk
+++ b/mk/auto.obj.mk
@@ -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}/; umask ${OBJDIR_UMASK:U002}; \
# 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
diff --git a/mk/dirdeps.mk b/mk/dirdeps.mk
index 6b2952057d72..82b781ac0d82 100644
--- a/mk/dirdeps.mk
+++ b/mk/dirdeps.mk
@@ -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.
#
diff --git a/mk/install-mk b/mk/install-mk
index 158f74cf6d06..43c7d7819a72 100644
--- a/mk/install-mk
+++ b/mk/install-mk
@@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@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 @@
# sjg@crufty.net
#
-MK_VERSION=20170301
+MK_VERSION=20170401
OWNER=
GROUP=
MODE=444
diff --git a/mk/meta.stage.mk b/mk/meta.stage.mk
index 223421a51ece..7383aadec564 100644
--- a/mk/meta.stage.mk
+++ b/mk/meta.stage.mk
@@ -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 @@
# sjg@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
diff --git a/mk/meta2deps.py b/mk/meta2deps.py
index 8688213d75d3..6eee6a51e5b0 100755
--- a/mk/meta2deps.py
+++ b/mk/meta2deps.py
@@ -37,7 +37,7 @@ We only pay attention to a subset of the information in 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
diff --git a/mk/mkopt.sh b/mk/mkopt.sh
index c3a39c508ffc..ad58479c2bf0 100755
--- a/mk/mkopt.sh
+++ b/mk/mkopt.sh
@@ -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}}
diff --git a/str.c b/str.c
index 5e4e8f6cc1c9..4c56e15b78df 100644
--- a/str.c
+++ b/str.c
@@ -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 *pattern)
* 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)
}
++pattern;
}
+ if (nomatch)
+ return 0;
while ((*pattern != ']') && (*pattern != 0))
++pattern;
goto thisCharOK;
diff --git a/unit-tests/modmatch.exp b/unit-tests/modmatch.exp
index fcaf6c02ed69..73dbb6a87b8c 100644
--- a/unit-tests/modmatch.exp
+++ b/unit-tests/modmatch.exp
@@ -14,4 +14,6 @@ LIB=e X_LIBS:M${LIB${LIB:tu}} is "/tmp/libe.a"
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
diff --git a/unit-tests/modmatch.mk b/unit-tests/modmatch.mk
index 48a1befb58b6..2c0313884936 100644
--- a/unit-tests/modmatch.mk
+++ b/unit-tests/modmatch.mk
@@ -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]*}