summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rw-r--r--mk/ChangeLog17
-rw-r--r--mk/dirdeps-targets.mk9
-rw-r--r--mk/init.mk25
-rw-r--r--mk/install-mk4
-rwxr-xr-xmk/meta2deps.py20
5 files changed, 62 insertions, 13 deletions
diff --git a/mk/ChangeLog b/mk/ChangeLog
index 9ce9b33f8f658..f061d43949e26 100644
--- a/mk/ChangeLog
+++ b/mk/ChangeLog
@@ -1,3 +1,20 @@
+2020-06-06 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20200606
+
+ * dirdeps-targets.mk: allow for filtering of .TARGETS
+
+ * meta2deps.py: fix bug in processing 'L'ink and 'M'ove
+ entries - and we don't care about 'W'rite entries.
+ Also ignore absolute paths that do not exist.
+
+2020-05-25 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20200525
+
+ * init.mk: expand and simplify handling of qualified vars
+ like CPPFLAGS.${.TARGET:T}
+
2020-05-15 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20200515
diff --git a/mk/dirdeps-targets.mk b/mk/dirdeps-targets.mk
index 49bfcf997f970..50a1970d62110 100644
--- a/mk/dirdeps-targets.mk
+++ b/mk/dirdeps-targets.mk
@@ -1,7 +1,7 @@
# RCSid:
-# $Id: dirdeps-targets.mk,v 1.9 2019/10/06 20:07:50 sjg Exp $
+# $Id: dirdeps-targets.mk,v 1.10 2020/06/06 22:41:02 sjg Exp $
#
-# @(#) Copyright (c) 2019 Simon J. Gerraty
+# @(#) Copyright (c) 2019-2020 Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
@@ -37,8 +37,11 @@ DIRDEPS_TARGETS_DIRS ?= targets targets/pseudo
# they need to be stripped when looking for target dirs
DIRDEPS_TARGETS_PREFIX_LIST ?= pkg- build-
+# some .TARGETS need filtering
+DIRDEPS_TARGETS_FILTER += Nall
+
# matching target dirs if any
-tdirs := ${.TARGETS:Nall:${DIRDEPS_TARGETS_PREFIX_LIST:@p@S,^$p,,@:ts:}:@t@${DIRDEPS_TARGETS_DIRS:@d@$d/$t@}@:@d@${exists(${SRCTOP}/$d):?$d:}@}
+tdirs := ${.TARGETS:${DIRDEPS_TARGETS_FILTER:ts:}:${DIRDEPS_TARGETS_PREFIX_LIST:@p@S,^$p,,@:ts:}:@t@${DIRDEPS_TARGETS_DIRS:@d@$d/$t@}@:@d@${exists(${SRCTOP}/$d):?$d:}@}
.if !empty(DEBUG_DIRDEPS_TARGETS)
.info tdirs=${tdirs}
diff --git a/mk/init.mk b/mk/init.mk
index 58a3183e2b1fa..d4ae45372d9cc 100644
--- a/mk/init.mk
+++ b/mk/init.mk
@@ -1,4 +1,4 @@
-# $Id: init.mk,v 1.16 2019/09/28 16:54:02 sjg Exp $
+# $Id: init.mk,v 1.17 2020/05/25 20:15:07 sjg Exp $
#
# @(#) Copyright (c) 2002, Simon J. Gerraty
#
@@ -36,8 +36,27 @@ CXX_SUFFIXES?= .cc .cpp .cxx .C
.include <warnings.mk>
.endif
-.for x in COPTS CPPFLAGS CPUFLAGS LDFLAGS
-$x += ${$x.${COMPILER_TYPE}:U} ${$x.${.IMPSRC:T}:U}
+# these are applied in order, least specific to most
+VAR_QUALIFIER_LIST += \
+ ${TARGET_SPEC_VARS:UMACHINE:@v@${$v}@} \
+ ${COMPILER_TYPE} \
+ ${.TARGET:T:R} \
+ ${.TARGET:T} \
+ ${.IMPSRC:T} \
+ ${VAR_QUALIFIER_XTRA_LIST}
+
+QUALIFIED_VAR_LIST += \
+ CFLAGS \
+ COPTS \
+ CPPFLAGS \
+ CPUFLAGS \
+ LDFLAGS \
+
+# a final :U avoids errors if someone uses :=
+.for V in ${QUALIFIED_VAR_LIST:O:u:@q@$q $q_LAST@}
+.for Q in ${VAR_QUALIFIER_LIST:u}
+$V += ${$V.$Q:U} ${$V.$Q.${COMPILER_TYPE}:U}
+.endfor
.endfor
CC_PG?= -pg
diff --git a/mk/install-mk b/mk/install-mk
index 8960f3b194018..4c29ef294bd60 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.170 2020/05/15 21:40:24 sjg Exp $
+# $Id: install-mk,v 1.172 2020/06/06 22:41:15 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@@ -70,7 +70,7 @@
# sjg@crufty.net
#
-MK_VERSION=20200515
+MK_VERSION=20200606
OWNER=
GROUP=
MODE=444
diff --git a/mk/meta2deps.py b/mk/meta2deps.py
index 7dbed28a58557..253287a87d1b0 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.28 2020/05/16 23:21:48 sjg Exp $
+ $Id: meta2deps.py,v 1.30 2020/06/08 23:05:00 sjg Exp $
Copyright (c) 2011-2019, Simon J. Gerraty
Copyright (c) 2011-2017, Juniper Networks, Inc.
@@ -81,7 +81,11 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
if path.endswith('/.'):
path = path[0:-2]
if len(path) > 0 and path[0] == '/':
- return path
+ if os.path.exists(path):
+ return path
+ if debug > 2:
+ print("skipping non-existent:", path, file=debug_out)
+ return None
if path == '.':
return cwd
if path.startswith('./'):
@@ -139,6 +143,8 @@ def abspath(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
rpath = resolve(path, cwd, last_dir, debug, debug_out)
if rpath:
path = rpath
+ elif len(path) > 0 and path[0] == '/':
+ return None
if (path.find('/') < 0 or
path.find('./') > 0 or
path.endswith('/..')):
@@ -475,6 +481,10 @@ class MetaFile:
continue
elif w[0] == 'C':
cwd = abspath(w[2], cwd, None, self.debug, self.debug_out)
+ if not cwd:
+ cwd = w[2]
+ if self.debug > 1:
+ print("missing cwd=", cwd, file=self.debug_out)
if cwd.endswith('/.'):
cwd = cwd[0:-2]
self.last_dir = pid_last_dir[pid] = cwd
@@ -491,8 +501,8 @@ class MetaFile:
if w[0] in 'ML':
# these are special, tread src as read and
# target as write
- self.parse_path(w[1].strip("'"), cwd, 'R', w)
- self.parse_path(w[2].strip("'"), cwd, 'W', w)
+ self.parse_path(w[2].strip("'"), cwd, 'R', w)
+ self.parse_path(w[3].strip("'"), cwd, 'W', w)
continue
elif w[0] in 'ERWS':
path = w[2]
@@ -563,7 +573,7 @@ class MetaFile:
print("ldir=", self.last_dir, file=self.debug_out)
return
- if op in 'ERW':
+ if op in 'ER':
# finally, we get down to it
if dir == self.cwd or dir == self.curdir:
return