diff options
| author | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-11-07 19:39:21 +0000 |
|---|---|---|
| committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-11-07 19:39:21 +0000 |
| commit | 302da1a3d35c15cb29d76e0a939f8bcb13f7ad80 (patch) | |
| tree | c2146dca82d530521c4d2cc46a95c26964311a2c /mk | |
| parent | 6bbc783f48498b808e19db4441299dc7d85a278b (diff) | |
Diffstat (limited to 'mk')
| -rw-r--r-- | mk/ChangeLog | 28 | ||||
| -rw-r--r-- | mk/dirdeps-cache-update.mk | 8 | ||||
| -rw-r--r-- | mk/dirdeps.mk | 16 | ||||
| -rw-r--r-- | mk/install-mk | 4 | ||||
| -rwxr-xr-x | mk/meta2deps.py | 3 | ||||
| -rwxr-xr-x | mk/meta2deps.sh | 21 | ||||
| -rw-r--r-- | mk/sys.vars.mk | 16 |
7 files changed, 78 insertions, 18 deletions
diff --git a/mk/ChangeLog b/mk/ChangeLog index 9ea9d42a7776..d72f9ff2bb6f 100644 --- a/mk/ChangeLog +++ b/mk/ChangeLog @@ -1,3 +1,31 @@ +2020-11-01 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20201101 + + * dirdeps.mk: most leaf makefiles are not suitable for building + dirdeps.cache so if RELDIR is not "." use dirdeps.mk + +2020-10-28 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20201028 + + * dirdeps.mk: if we don't have :range use equivalent of M_RANGE + when building dirdeps.cache for leaf directory use -f dirdeps.mk + + * sys.vars.mk: add M_JOT and M_RANGE + +2020-10-01 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20201001 + + * meta2deps.{py,sh}: throw an error if we don't see filemon version + +2020-09-09 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20200909 + + * dirdeps-cache-update.mk: use cache_update_dirdep as guard target + 2020-08-26 Simon J Gerraty <sjg@beast.crufty.net> * dirdeps.mk: ensure we cannot confuse a static cache for dynamic diff --git a/mk/dirdeps-cache-update.mk b/mk/dirdeps-cache-update.mk index eb992e936eb8..e442efd1d497 100644 --- a/mk/dirdeps-cache-update.mk +++ b/mk/dirdeps-cache-update.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps-cache-update.mk,v 1.21 2020/08/19 17:51:53 sjg Exp $ +# $Id: dirdeps-cache-update.mk,v 1.22 2020/09/10 00:14:38 sjg Exp $ # # @(#) Copyright (c) 2020, Simon J. Gerraty # @@ -86,7 +86,7 @@ _debug_cache = 0 .endif .if ${MK_STATIC_DIRDEPS_CACHE} == "yes" && defined(STATIC_DIRDEPS_CACHE) && exists(${STATIC_DIRDEPS_CACHE}) -.if !make(dirdeps) +.if !make(dirdeps) && !target(cache_update_dirdep) # We are using static cache and this is the only look we will get. # We want to generate an updated cache while we build # so need to hook cache-update to dirdeps now. @@ -99,12 +99,10 @@ _debug_cache = 0 cache_update_dirdep ?= $d.${TARGET_SPEC} .endif .endfor -.if !target(${cache_update_dirdep}) -dirdeps: ${cache_update_dirdep} +dirdeps cache_update_dirdep: ${cache_update_dirdep} ${cache_update_dirdep}: _DIRDEP_USE DYNAMIC_DIRDEPS_CACHE := ${OBJTOP}/dirdeps.cache.${STATIC_DIRDEPS_CACHE:H:T}-update .export DYNAMIC_DIRDEPS_CACHE STATIC_DIRDEPS_CACHE -.endif .endif # make(dirdeps) .endif # MK_* diff --git a/mk/dirdeps.mk b/mk/dirdeps.mk index 16673a04c07b..237d4c7e74aa 100644 --- a/mk/dirdeps.mk +++ b/mk/dirdeps.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.125 2020/08/26 21:49:45 sjg Exp $ +# $Id: dirdeps.mk,v 1.130 2020/11/02 00:34:30 sjg Exp $ # Copyright (c) 2010-2020, Simon J. Gerraty # Copyright (c) 2010-2018, Juniper Networks, Inc. @@ -209,12 +209,9 @@ DEP_$v ?= ${$v} # so we need to construct a set of modifiers to fill in the gaps. .if ${MAKE_VERSION} >= 20170130 _tspec_x := ${TARGET_SPEC_VARS:range} -.elif ${TARGET_SPEC_VARS:[#]} > 10 -# seriously? better have jot(1) or equivalent to produce suitable sequence -_tspec_x := ${${JOT:Ujot} ${TARGET_SPEC_VARS:[#]}:L:sh} .else -# we can provide the sequence ourselves -_tspec_x := ${1 2 3 4 5 6 7 8 9 10:L:[1..${TARGET_SPEC_VARS:[#]}]} +# do it the hard way +_tspec_x := ${TARGET_SPEC_VARS:[#]:@x@i=1;while [ $$i -le $x ]; do echo $$i; i=$$((i + 1)); done;@:sh} .endif # this handles unqualified entries M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC}; @@ -494,6 +491,11 @@ dirdeps-cached: ${DIRDEPS_CACHE} .MAKE @MAKELEVEL=${.MAKE.LEVEL} ${.MAKE} -C ${_CURDIR} -f ${DIRDEPS_CACHE} \ dirdeps MK_DIRDEPS_CACHE=no BUILD_DIRDEPS=no +# leaf makefiles rarely work for building DIRDEPS_CACHE +.if ${RELDIR} != "." +BUILD_DIRDEPS_MAKEFILE ?= -f dirdeps.mk +.endif + # these should generally do BUILD_DIRDEPS_MAKEFILE ?= BUILD_DIRDEPS_TARGETS ?= ${.TARGETS} @@ -517,6 +519,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP ${BUILD_DIRDEPS_MAKEFILE} \ ${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \ .MAKE.DEPENDFILE=.none \ + ${"${DEBUG_DIRDEPS:Nno}":?DEBUG_DIRDEPS='${DEBUG_DIRDEPS}':} \ ${.MAKEFLAGS:tW:S,-D ,-D,g:tw:M*WITH*} \ ${.MAKEFLAGS:tW:S,-d ,-d,g:tw:M-d*} \ 3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g;s,_{,$${,g' >> ${.TARGET}.new && \ @@ -627,6 +630,7 @@ __qual_depdirs += ${__hostdpadd} .endif .if ${_debug_reldir} +.info DEP_DIRDEPS_FILTER=${DEP_DIRDEPS_FILTER:ts:} .info depdirs=${__depdirs} .info qualified=${__qual_depdirs} .info unqualified=${__unqual_depdirs} diff --git a/mk/install-mk b/mk/install-mk index 66185e42cc6e..01680f401745 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.179 2020/08/26 21:49:45 sjg Exp $ +# $Id: install-mk,v 1.183 2020/11/02 16:34:12 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20200826 +MK_VERSION=20201101 OWNER= GROUP= MODE=444 diff --git a/mk/meta2deps.py b/mk/meta2deps.py index 9231003b70df..4627e08d7c11 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.33 2020/08/19 17:51:53 sjg Exp $ + $Id: meta2deps.py,v 1.34 2020/10/02 03:11:17 sjg Exp $ Copyright (c) 2011-2020, Simon J. Gerraty Copyright (c) 2011-2017, Juniper Networks, Inc. @@ -510,6 +510,7 @@ class MetaFile: continue self.parse_path(path, cwd, w[0], w) + assert(version > 0) if not file: f.close() diff --git a/mk/meta2deps.sh b/mk/meta2deps.sh index e56e52a89675..f01d54774a04 100755 --- a/mk/meta2deps.sh +++ b/mk/meta2deps.sh @@ -77,7 +77,7 @@ # RCSid: -# $Id: meta2deps.sh,v 1.13 2020/08/19 17:51:53 sjg Exp $ +# $Id: meta2deps.sh,v 1.14 2020/10/02 03:11:17 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -143,6 +143,11 @@ _excludes_f() { egrep -v "$EXCLUDES" } +error() { + echo "ERROR: $@" >&2 + exit 1 +} + meta2deps() { DPDEPS= SRCTOPS=$SRCTOP @@ -236,8 +241,8 @@ meta2deps() { ;; *) cat /dev/null "$@";; esac 2> /dev/null | - sed -e 's,^CWD,C C,;/^[CREFLM] /!d' -e "s,',,g" | - $_excludes | + sed -e 's,^CWD,C C,;/^[CREFLMV] /!d' -e "s,',,g" | + $_excludes | ( version=no while read op pid path junk do : op=$op pid=$pid path=$path @@ -249,6 +254,12 @@ meta2deps() { SB=`echo $CWD | sed 's,/obj.*,,'` fi SRCTOP=${SRCTOP:-$SB/src} + case "$verion" in + no) ;; # ignore + 0) error "no filemon data";; + *) ;; + esac + version=0 continue ;; $pid,$pid) ;; @@ -263,6 +274,7 @@ meta2deps() { esac case "$op,$path" in + V,*) version=$path; continue;; W,*srcrel|*.dirdep) continue;; C,*) case "$path" in @@ -368,6 +380,9 @@ meta2deps() { echo $dir;; esac done > $tf.dirdep + case "$version" in + 0) error "no filemon data";; + esac ) || exit 1 _nl=echo for f in $tf.dirdep $tf.qual $tf.srcdep do diff --git a/mk/sys.vars.mk b/mk/sys.vars.mk index 24e0ed26a15f..592cbdc644dc 100644 --- a/mk/sys.vars.mk +++ b/mk/sys.vars.mk @@ -1,4 +1,4 @@ -# $Id: sys.vars.mk,v 1.5 2020/08/19 17:51:53 sjg Exp $ +# $Id: sys.vars.mk,v 1.6 2020/10/28 20:50:04 sjg Exp $ # # @(#) Copyright (c) 2003-2009, Simon J. Gerraty # @@ -57,6 +57,20 @@ _type_sh = which M_type = @x@(${_type_sh:Utype} $$x) 2> /dev/null; echo;@:sh:[0]:N* found*:[@]:C,[()],,g M_whence = ${M_type}:M/*:[1] +# produce similar output to jot(1) +# eg. ${LIST:[#]:${M_JOT}} +# would be 1 2 3 4 5 if LIST has 5 words +# ${9:L:${M_JOT}} +# would be 1 2 3 4 5 6 7 8 9 +M_JOT = @x@i=1;while [ $$$$i -le $$x ]; do echo $$$$i; i=$$$$((i + 1)); done;@:sh + +# ${LIST:${M_RANGE}} is 1 2 3 4 5 if LIST has 5 words +.if ${MAKE_VERSION} >= 20170130 +M_RANGE = range +.else +M_RANGE = [#]:${M_JOT} +.endif + # convert a path to a valid shell variable M_P2V = tu:C,[./-],_,g |
