svn commit: r355618 - in head: lib/libbsnmp/libbsnmp lib/libgcc_eh lib/libmagic lib/libpmc share/mk targets

Simon J. Gerraty sjg at FreeBSD.org
Wed Dec 11 17:38:19 UTC 2019


Author: sjg
Date: Wed Dec 11 17:38:15 2019
New Revision: 355618
URL: https://svnweb.freebsd.org/changeset/base/355618

Log:
  Update dirdeps.mk and gendirdeps.mk
  
  The env space consumed by exporting all libc's .meta files
  left little room for command line,
  so unexport when done.
  
  Update dirdeps.mk to latest and add
  dirdeps-targets.mk to simplify/update targets/Makefile
  
  Makefile changes to go with Makefile.depend changes in D22494
  
  Reviewed by:	 bdrewery
  MFC after:	1 week
  Sponsored by:   Juniper Networks
  Differential Revision:  https://reviews.freebsd.org/D22495

Added:
  head/share/mk/dirdeps-targets.mk   (contents, props changed)
  head/share/mk/local.dirdeps-options.mk   (contents, props changed)
Modified:
  head/lib/libbsnmp/libbsnmp/Makefile
  head/lib/libgcc_eh/Makefile
  head/lib/libmagic/Makefile
  head/lib/libpmc/Makefile
  head/share/mk/dirdeps.mk
  head/share/mk/gendirdeps.mk
  head/share/mk/local.dirdeps.mk
  head/share/mk/local.gendirdeps.mk
  head/share/mk/local.meta.sys.mk
  head/share/mk/meta.sys.mk
  head/targets/Makefile
  head/targets/Makefile.inc

Modified: head/lib/libbsnmp/libbsnmp/Makefile
==============================================================================
--- head/lib/libbsnmp/libbsnmp/Makefile	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/lib/libbsnmp/libbsnmp/Makefile	Wed Dec 11 17:38:15 2019	(r355618)
@@ -24,12 +24,17 @@ SRCS+=	snmptc.h
 INCS=	asn1.h snmp.h snmpagent.h snmpclient.h
 MAN=	asn1.3 bsnmpagent.3 bsnmpclient.3 bsnmplib.3
 
+.if ${MK_DIRDEPS_BUILD} == "yes"
+GENSNMPTREE?= ${HOST_OBJTOP}/usr.sbin/bsnmpd/gensnmptree/gensnmptree
+.endif
+GENSNMPTREE?= gensnmptree
+
 snmptc.h : tc.def
 	(\
 	echo "/* autogenerated from tc.def */";\
 	echo "#ifndef snmptc_h_1529923773";\
 	echo "#define snmptc_h_1529923773";\
-	gensnmptree -E -f <${.ALLSRC};\
+	${GENSNMPTREE} -E -f <${.ALLSRC};\
 	echo "#endif" ; \
 	) >${.TARGET}
 

Modified: head/lib/libgcc_eh/Makefile
==============================================================================
--- head/lib/libgcc_eh/Makefile	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/lib/libgcc_eh/Makefile	Wed Dec 11 17:38:15 2019	(r355618)
@@ -10,4 +10,10 @@ WARNS?=	2
 
 .include "Makefile.inc"
 
+.if ${.MAKE.LEVEL} > 0
+# avoid circular dependencies
+GENDIRDEPS_FILTER+= Nlib/msun
+CFLAGS+= -I${SRCTOP}/lib/msun/src
+.endif
+
 .include <bsd.lib.mk>

Modified: head/lib/libmagic/Makefile
==============================================================================
--- head/lib/libmagic/Makefile	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/lib/libmagic/Makefile	Wed Dec 11 17:38:15 2019	(r355618)
@@ -40,12 +40,18 @@ magic: ${MAGFILES}
 magic.mgc: mkmagic magic
 	${BTOOLSPATH:U.}/mkmagic magic
 
+.if ${MACHINE} == "host" || ${MK_DIRDEPS_BUILD} == "no"
 CLEANFILES+=	mkmagic
 DEPENDOBJS+=	mkmagic
 build-tools: mkmagic
 mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c ${INCS} ${BUILD_TOOLS_META}
 	${CC:N${CCACHE_BIN}} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} \
 	    ${.ALLSRC:N*.h:O:u} ${LDADD}
+
+.endif
+.if ${MK_DIRDEPS_BUILD} == "yes"
+BTOOLSPATH= ${HOST_OBJTOP}/${RELDIR}
+.endif
 
 FILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \
 			${.CURDIR}/config.h

Modified: head/lib/libpmc/Makefile
==============================================================================
--- head/lib/libpmc/Makefile	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/lib/libpmc/Makefile	Wed Dec 11 17:38:15 2019	(r355618)
@@ -17,11 +17,19 @@ EVENT_ARCH="x86"
 EVENT_ARCH="powerpc"
 .endif
 
+.if ${MK_DIRDEPS_BUILD} == "yes"
+# avoid circular dependency
+CFLAGS+= -I${RELDIR:H}/libpmcstat
+GENDIRDEPS_FILTER+= N${RELDIR:H}/libpmcstat
+JEVENTS?= ${HOST_OBJTOP}/${RELDIR}/pmu-events/jevents
+.else
 JEVENTS= ${BTOOLSPATH:U.}/pmu-events/jevents
+
 # This file is built in a subdirectory so never try to rebuild it here.
 ${JEVENTS}: .PHONY
 .if make(*clean*)
 SUBDIR+= pmu-events
+.endif
 .endif
 
 libpmc_events.c: ${JEVENTS}

Added: head/share/mk/dirdeps-targets.mk
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/mk/dirdeps-targets.mk	Wed Dec 11 17:38:15 2019	(r355618)
@@ -0,0 +1,134 @@
+# $FreeBSD$
+# RCSid:
+#       $Id: dirdeps-targets.mk,v 1.9 2019/10/06 20:07:50 sjg Exp $
+#
+#       @(#) Copyright (c) 2019 Simon J. Gerraty
+#
+#       This file is provided in the hope that it will
+#       be of use.  There is absolutely NO WARRANTY.
+#       Permission to copy, redistribute or otherwise
+#       use this file is hereby granted provided that 
+#       the above copyright notice and this notice are
+#       left intact. 
+#      
+#       Please send copies of changes and bug-fixes to:
+#       sjg at crufty.net
+#
+
+##
+# This makefile is used to set initial DIRDEPS for top-level build
+# targets.
+#
+# The basic idea is that we have a list of directories in
+# DIRDEPS_TARGETS_DIRS which are relative to SRCTOP.
+# When asked to make 'foo' we look for any directory named 'foo'
+# under DIRDEPS_TARGETS_DIRS.
+# We then search those dirs for any Makefile.depend*
+# Finally we select any that match conditions like REQUESTED_MACHINE
+# or TARGET_SPEC and initialize DIRDEPS accordingly.
+# 
+
+.if ${.MAKE.LEVEL} == 0
+# pickup customizations
+.-include <local.dirdeps-targets.mk>
+
+# for DIRDEPS_BUILD this is how we prime the pump
+DIRDEPS_TARGETS_DIRS ?= targets targets/pseudo
+# these prefixes can modify how we behave
+# they need to be stripped when looking for target dirs
+DIRDEPS_TARGETS_PREFIX_LIST ?= pkg- build-
+
+# matching target dirs if any
+tdirs := ${.TARGETS:Nall:${DIRDEPS_TARGETS_PREFIX_LIST:@p at S,^$p,,@:ts:}:@t@${DIRDEPS_TARGETS_DIRS:@d@$d/$t@}@:@d@${exists(${SRCTOP}/$d):?$d:}@}
+
+.if !empty(DEBUG_DIRDEPS_TARGETS)
+.info tdirs=${tdirs}
+.endif
+
+.if !empty(tdirs)
+# some things we know we want to ignore
+DIRDEPS_TARGETS_SKIP_LIST += \
+	*~ \
+	*.bak \
+	*.inc \
+	*.old \
+	*.options \
+	*.orig \
+	*.rej \
+
+# the list of MACHINEs we consider
+DIRDEPS_TARGETS_MACHINE_LIST += \
+	${ALL_MACHINE_LIST:U} \
+	${PSEUDO_MACHINE_LIST:Ucommon host host32} \
+	${TARGET_MACHINE_LIST}
+
+DIRDEPS_TARGETS_MACHINE_LIST := ${DIRDEPS_TARGETS_MACHINE_LIST:O:u}
+
+# raw Makefile.depend* list
+tdeps != 'cd' ${SRCTOP} && 'ls' -1 ${tdirs:O:u:@d@$d/${.MAKE.DEPENDFILE_PREFIX}*@} 2> /dev/null; echo
+.if ${DEBUG_DIRDEPS_TARGETS:U:Mdep*} != ""
+.info tdeps=${tdeps}
+.endif
+# remove things we know we don't want
+tdeps := ${tdeps:${DIRDEPS_TARGETS_SKIP_LIST:${M_ListToSkip}}}
+.if ${DEBUG_DIRDEPS_TARGETS:U:Mdep*} != ""
+.info tdeps=${tdeps}
+.endif
+
+# plain entries (no qualifiers) these apply to any TARGET_SPEC
+ptdeps := ${tdeps:M*${.MAKE.DEPENDFILE_PREFIX}:S,/${.MAKE.DEPENDFILE_PREFIX},,}
+
+# MACHINE qualified entries
+mqtdeps := ${DIRDEPS_TARGETS_MACHINE_LIST:@m@${tdeps:M*.$m}@:S,/${.MAKE.DEPENDFILE_PREFIX},,}
+
+tqtdeps =
+.if ${TARGET_SPEC_VARS:[#]} > 1
+# TARGET_SPEC qualified entries
+.if !empty(TARGET_SPEC_LIST)
+# we have a list of valid TARGET_SPECS; use it
+tqtdeps := ${TARGET_SPEC_LIST:U:O:u:@t@${tdeps:M*.$t}@:S,/${.MAKE.DEPENDFILE_PREFIX},,}
+.else
+# do we have a list of valid tuple members for at least
+# the last tupple element? if so match on that
+TARGET_SPEC_LAST_LIST ?= ${${TARGET_SPEC_VARS:[-1]}_LIST}
+.if !empty(TARGET_SPEC_LAST_LIST)
+tqtdeps := ${TARGET_SPEC_LAST_LIST:U:O:u:@t@${tdeps:M*,$t}@:S,/${.MAKE.DEPENDFILE_PREFIX},,}
+.else
+# this is sub-optimal match MACHINE,
+tqtdeps := ${DIRDEPS_TARGETS_MACHINE_LIST:@m@${tdeps:M*.$m,*}@:S,/${.MAKE.DEPENDFILE_PREFIX},,}
+.endif
+.endif
+.endif
+
+# now work out what we want in DIRDEPS
+.if empty(REQUESTED_MACHINE)
+# we want them all just as found
+DIRDEPS = ${ptdeps} ${mqtdeps} ${tqtdeps}
+.else
+# we only want those that match REQUESTED_MACHINE/REQUESTED_TARGET_SPEC
+# or REQUESTED_TARGET_SPEC (TARGET_SPEC)
+DIRDEPS = \
+	${ptdeps:@d@$d.${REQUESTED_TARGET_SPEC:U${TARGET_SPEC:U${REQUESTED_MACHINE}}}@} \
+	${mqtdeps:M*.${REQUESTED_MACHINE}} \
+	${tqtdeps:M*.${REQUESTED_TARGET_SPEC:U${TARGET_SPEC}}}
+.endif
+# clean up
+DIRDEPS := ${DIRDEPS:O:u}
+
+.if !empty(DEBUG_DIRDEPS_TARGETS)
+.for x in tdeps ptdeps mqtdeps tqtdeps DIRDEPS
+.info $x=${$x}
+.endfor
+.endif
+.endif
+# if we got DIRDEPS get to work
+.if !empty(DIRDEPS)
+.include <dirdeps.mk>
+
+DIRDEPS_TARGETS_SKIP += all clean* destroy*
+
+.for t in ${.TARGETS:${DIRDEPS_TARGETS_SKIP:${M_ListToSkip}}}
+$t: dirdeps
+.endfor                                                                         
+.endif
+.endif

Modified: head/share/mk/dirdeps.mk
==============================================================================
--- head/share/mk/dirdeps.mk	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/share/mk/dirdeps.mk	Wed Dec 11 17:38:15 2019	(r355618)
@@ -1,5 +1,5 @@
 # $FreeBSD$
-# $Id: dirdeps.mk,v 1.96 2018/06/20 22:26:39 sjg Exp $
+# $Id: dirdeps.mk,v 1.100 2019/11/12 06:47:58 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -379,7 +379,8 @@ DIRDEPS_FILTER += M${_DEP_RELDIR}
 .endif
 
 # this is what we run below
-DIRDEP_MAKE?= ${.MAKE}
+DIRDEP_MAKE ?= ${.MAKE}
+DIRDEP_DIR ?= ${.TARGET:R}
 
 # we suppress SUBDIR when visiting the leaves
 # we assume sys.mk will set MACHINE_ARCH
@@ -389,10 +390,11 @@ _DIRDEP_USE:	.USE .MAKE
 	@for m in ${.MAKE.MAKEFILE_PREFERENCE}; do \
 		test -s ${.TARGET:R}/$$m || continue; \
 		echo "${TRACER}Checking ${.TARGET:R} for ${.TARGET:E} ..."; \
+		${DIRDEP_USE_PRELUDE} \
 		MACHINE_ARCH= NO_SUBDIR=1 ${DIRDEP_USE_ENV} \
 		TARGET_SPEC=${.TARGET:E} \
 		MACHINE=${.TARGET:E} \
-		${DIRDEP_MAKE} -C ${.TARGET:R} || exit 1; \
+		${DIRDEP_MAKE} -C ${DIRDEP_DIR} || exit 1; \
 		break; \
 	done
 
@@ -476,7 +478,7 @@ BUILD_DIRDEPS_TARGETS ?= ${.TARGETS}
 ${DIRDEPS_CACHE}:	.META .NOMETA_CMP
 	+@{ echo '# Autogenerated - do NOT edit!'; echo; \
 	echo 'BUILD_DIRDEPS=no'; echo; \
-	echo '.include <dirdeps.mk>'; \
+	echo '.include <dirdeps.mk>'; echo; \
 	} > ${.TARGET}.new
 	+ at MAKELEVEL=${.MAKE.LEVEL} DIRDEPS_CACHE=${DIRDEPS_CACHE} \
 	DIRDEPS="${DIRDEPS}" \
@@ -640,9 +642,15 @@ _build_all_dirs := ${_build_all_dirs:O:u}
 .if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS}} == ""
 .if !empty(_build_all_dirs)
 .if ${BUILD_DIRDEPS_CACHE} == "yes"
-x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
-	echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo
-x!= { ${_build_all_dirs:@x@${target($x):?:echo '$x: _DIRDEP_USE';}@} echo; } >&3; echo
+# guard against _build_all_dirs being too big for a single command line
+# first get list of dirs that need _DIRDEP_USE
+# then export that and _build_all_dirs
+_new_dirdeps := ${_build_all_dirs:@x@${target($x):?:$x}@}
+.export _new_dirdeps _build_all_dirs
+x!= echo; { echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
+	echo "dirdeps: \\"; \
+	for x in $$_build_all_dirs; do echo "	$$x \\"; done; echo; \
+	for x in $$_new_dirdeps; do echo "$$x: _DIRDEP_USE"; done; echo; } >&3
 .if !empty(DEP_EXPORT_VARS)
 # Discouraged, but there are always exceptions.
 # Handle it here rather than explain how.
@@ -672,7 +680,10 @@ DEP_EXPORT_VARS=
 .info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$q}
 .endif
 .if ${BUILD_DIRDEPS_CACHE} == "yes"
-x!= { echo; echo '${_this_dir}.$m: ${_build_dirs:M*.$q:${M_oneperline}}'; echo; } >&3; echo
+_cache_deps := ${_build_dirs:M*.$q}
+.export _cache_deps
+x!= echo; { echo "${_this_dir}.$m: \\"; \
+	for x in $$_cache_deps; do echo "	$$x \\"; done; echo; } >&3
 .else
 ${_this_dir}.$m: ${_build_dirs:M*.$q}
 .endif
@@ -682,7 +693,10 @@ ${_this_dir}.$m: ${_build_dirs:M*.$q}
 .info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$m:N${_this_dir}.$m}
 .endif
 .if ${BUILD_DIRDEPS_CACHE} == "yes"
-x!= { echo; echo '${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m:${M_oneperline}}'; echo; } >&3; echo
+_cache_deps := ${_build_dirs:M*.$m:N${_this_dir}.$m}
+.export _cache_deps
+x!= echo; { echo "${_this_dir}.$m: \\"; \
+	for x in $$_cache_deps; do echo "       $$x \\"; done; echo; } >&3
 .else
 ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
 .endif

Modified: head/share/mk/gendirdeps.mk
==============================================================================
--- head/share/mk/gendirdeps.mk	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/share/mk/gendirdeps.mk	Wed Dec 11 17:38:15 2019	(r355618)
@@ -1,5 +1,5 @@
 # $FreeBSD$
-# $Id: gendirdeps.mk,v 1.39 2018/06/08 01:25:31 sjg Exp $
+# $Id: gendirdeps.mk,v 1.41 2019/11/21 23:50:40 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -80,7 +80,6 @@ _DIRDEPS := ${DIRDEPS:U:O:u}
 .endif
 
 META_FILES := ${META_FILES:T:O:u}
-.export META_FILES
 
 # pickup customizations
 .-include <local.gendirdeps.mk>
@@ -184,6 +183,11 @@ x != cd ${_OBJDIR} && find . -name '*.meta' -print -o 
 .elif ${_meta_files:[#]} > 500
 .export _meta_files
 x != echo; for m in $$_meta_files; do echo $$m; done > meta.list
+# _meta_files is consuming a lot of env space
+# that can impact command line length,
+# and we do not need it any more
+.undef _meta_files
+.unexport _meta_files
 .else
 _meta_files_arg:= ${_meta_files}
 .endif
@@ -374,3 +378,6 @@ all ${_DEPENDFILE}:
 
 .endif
 ${_DEPENDFILE}: .PRECIOUS
+
+# don't waste time looking for ways to make .meta files
+.SUFFIXES:

Added: head/share/mk/local.dirdeps-options.mk
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/mk/local.dirdeps-options.mk	Wed Dec 11 17:38:15 2019	(r355618)
@@ -0,0 +1,29 @@
+# $FreeBSD$
+
+# avoid duplication
+DIRDEPS.AUDIT.yes= lib/libbsm
+DIRDEPS.BLACKLIST_SUPPORT.yes+= lib/libblacklist
+DIRDEPS.BSD_CRTBEGIN.no+= gnu/lib/csu
+DIRDEPS.CASPER.yes+= lib/libcasper/libcasper
+DIRDEPS.GSSAPI.yes+= lib/libgssapi
+DIRDEPS.JAIL.yes+= lib/libjail
+DIRDEPS.KERBEROS_SUPPORT.yes+= \
+	kerberos5/lib/libasn1 \
+	kerberos5/lib/libheimbase \
+	kerberos5/lib/libheimipcc \
+	kerberos5/lib/libhx509 \
+	kerberos5/lib/libkrb5 \
+	kerberos5/lib/libroken \
+	kerberos5/lib/libwind \
+
+DIRDEPS.NIS.yes+= \
+	include/rpc \
+	include/rpcsvc \
+	lib/librpcsvc
+
+DIRDEPS.OPENSSL.yes+= secure/lib/libcrypto
+DIRDEPS.OPENSSL.no+= lib/libmd
+DIRDEPS.PAM_SUPPORT.yes+= lib/libpam/libpam
+DIRDEPS.TCP_WRAPPERS.yes+= lib/libwrap
+
+

Modified: head/share/mk/local.dirdeps.mk
==============================================================================
--- head/share/mk/local.dirdeps.mk	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/share/mk/local.dirdeps.mk	Wed Dec 11 17:38:15 2019	(r355618)
@@ -148,7 +148,6 @@ _SRCS= ${SRCS} ${_PROGS_SRCS}
 
 # Has C files. The C_DIRDEPS are shared with C++ files as well.
 C_DIRDEPS= \
-	gnu/lib/csu \
 	include \
 	include/arpa \
 	include/protocols \
@@ -220,6 +219,11 @@ DIRDEPS+= ${_lib${_lib}reldir}
 .if ${DEP_RELDIR} != "targets/pseudo/stage"
 DIRDEPS += targets/pseudo/stage
 .endif
+.endif
+
+# this one is too pervasive
+.if ${MK_BSD_CRTBEGIN} == "no" && ${DEP_RELDIR} != "gnu/lib/csu"
+DIRDEPS+= gnu/lib/csu
 .endif
 
 DEP_MACHINE_ARCH = ${MACHINE_ARCH.${DEP_MACHINE}}

Modified: head/share/mk/local.gendirdeps.mk
==============================================================================
--- head/share/mk/local.gendirdeps.mk	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/share/mk/local.gendirdeps.mk	Wed Dec 11 17:38:15 2019	(r355618)
@@ -10,6 +10,7 @@ GENDIRDEPS_FILTER+= \
 	Ngnu/lib/libssp/libssp_nonshared \
 	Ncddl/usr.bin/ctf* \
 	Nlib/libc_nonshared \
+	Ngnu/lib/csu \
 	Ngnu/lib/libgcc \
 	Nlib/libgcc_eh \
 	Nlib/libgcc_s \

Modified: head/share/mk/local.meta.sys.mk
==============================================================================
--- head/share/mk/local.meta.sys.mk	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/share/mk/local.meta.sys.mk	Wed Dec 11 17:38:15 2019	(r355618)
@@ -96,7 +96,7 @@ TARGET_MACHINE= host
 OBJTOP := ${HOST_OBJTOP}
 .endif
 
-.if ${.MAKE.LEVEL} == 0
+.if ${.MAKE.LEVEL} == 0 || empty(PYTHON)
 PYTHON ?= /usr/local/bin/python
 .export PYTHON
 # this works best if share/mk is ready for it.
@@ -133,7 +133,9 @@ STAGE_TARGET_OBJTOP:= ${STAGE_ROOT}/${TARGET_OBJ_SPEC}
 STAGE_HOST_OBJTOP:= ${STAGE_ROOT}/${HOST_TARGET}
 # These are exported for hooking in out-of-tree builds.  They will always
 # be overridden in sub-makes above when building in-tree.
+.if ${.MAKE.LEVEL} > 0
 .export STAGE_OBJTOP STAGE_TARGET_OBJTOP STAGE_HOST_OBJTOP
+.endif
 
 # Use tools/install.sh which can avoid the need for xinstall for simple cases.
 INSTALL?=	sh ${SRCTOP}/tools/install.sh

Modified: head/share/mk/meta.sys.mk
==============================================================================
--- head/share/mk/meta.sys.mk	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/share/mk/meta.sys.mk	Wed Dec 11 17:38:15 2019	(r355618)
@@ -1,5 +1,5 @@
 # $FreeBSD$
-# $Id: meta.sys.mk,v 1.32 2017/06/11 03:24:04 sjg Exp $
+# $Id: meta.sys.mk,v 1.34 2019/01/24 19:36:25 sjg Exp $
 
 #
 #	@(#) Copyright (c) 2010, Simon J. Gerraty
@@ -62,13 +62,15 @@ META_MODE += silent=yes
 MACHINE = host
 .endif
 
-.if ${.MAKE.LEVEL} == 0
+.if !defined(MACHINE0)
 # it can be handy to know which MACHINE kicked off the build
 # for example, if using Makefild.depend for multiple machines,
 # allowing only MACHINE0 to update can keep things simple.
 MACHINE0 := ${MACHINE}
 .export MACHINE0
+.endif
 
+.if !defined(META2DEPS)
 .if defined(PYTHON) && exists(${PYTHON})
 # we prefer the python version of this - it is much faster
 META2DEPS ?= ${.PARSEDIR}/meta2deps.py

Modified: head/targets/Makefile
==============================================================================
--- head/targets/Makefile	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/targets/Makefile	Wed Dec 11 17:38:15 2019	(r355618)
@@ -38,75 +38,7 @@
 DIRDEPS_FILTER = Mtargets/*
 .endif
 
-# in theory, this is what we want
-target_dirs = targets targets/pseudo
-# these tweak how we do it
-target_prefix = pkg- build-
-DIRDEPS := ${.TARGETS:Nall:${target_prefix:@p at S,^$p,,@:ts:}:@t@${target_dirs:@d@$d/$t@}@:@d@${exists(${SRCTOP}/$d):?$d:}@}
 
-all_machine_list = ${ALL_MACHINE_LIST} host common
-
-.if ${DIRDEPS:Mtargets/pseudo/*} != ""
-# all bets are off
-PKG_MACHINE_LIST = ${all_machine_list}
-.endif
-
-.if make(check-commit)
-# a special case
-DIRDEPS = targets/pseudo/check-commit
-.if defined(ALL_MACHINES)
-CHECK_MACHINE_LIST = all
-.undef ALL_MACHINES
-.endif
-SHIPDIR = no
-
-.else
-
-.if defined(ALL_MACHINES)
-DIRDEPS := ${DIRDEPS:O:u:@d@${all_machine_list:O:u:@m@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE_PREFIX:T}.$m):?$d.$m:}@}@}
-.undef ALL_MACHINES
-PKG_MACHINE_LIST ?= ${DIRDEPS:E:O:u}
-.elif empty(REQUESTED_MACHINE)
-# the above may be insufficient.
-# some packages only support one machine which may not be ${MACHINE}
-# some support multiple, in which case unless ALL_MACHINES is defined
-# we only want ${MACHINE}
-plain := ${DIRDEPS:@d@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE_PREFIX:T}):?$d:}@}
-.if ${plain} != ${DIRDEPS}
-qual := ${DIRDEPS:${plain:${M_ListToSkip}}:@d@${all_machine_list:O:u:@m@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE_PREFIX:T}.$m):?$d.$m:}@}@}
-DIRDEPS := ${plain} ${qual}
-PKG_MACHINE_LIST ?= ${MACHINE} ${qual:E:O:u}
-.endif
-.else
-# check that a .MAKE.DEPENDFILE exists
-DIRDEPS := ${.MAKE.DEPENDFILE_PREFERENCE:T:@m@${DIRDEPS:@d@${exists(${SRCTOP}/$d/$m):?$d:}@}@:O:u}
-.endif
-.if !empty(PKG_MACHINE_LIST)
-.if ${PKG_MACHINE_LIST:Mdepend} != ""
-PKG_MACHINE_LIST = ${ALL_MACHINE_LIST}
-.endif
-PKG_MACHINE_LIST := ${PKG_MACHINE_LIST}
-.endif
-.endif
-
-# we don't use DIRDEPS_FILTER, since we only want it to 
-# apply to this initial list
-.if !empty(REQUESTED_MACHINE) && !empty(DIRDEPS)
-# this is a variant of the logic above, we want plain
-# but need to filter the qualified DIRDEPS to REQUESTED_MACHINE
-plain := ${DIRDEPS:@d@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE_PREFIX:T}):?$d:}@}
-.if !empty(plain) && ${plain} != ${DIRDEPS}
-qual := ${DIRDEPS:${plain:${M_ListToSkip}}:M*.${REQUESTED_MACHINE}}
-.if empty(qual)
-qual := ${DIRDEPS:@d@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE:T}):?$d.${.MAKE.DEPENDFILE:E}:}@}
-.endif
-DIRDEPS := ${plain} ${qual}
-.endif
-.if empty(DIRDEPS)
-.error ${REQUESTED_MACHINE} is not appropriate for ${.TARGETS}
-.endif
-.endif
-
 .if !empty(build_options)
 build_options := ${build_options:O:u}
 .for v in ${build_options}
@@ -114,6 +46,9 @@ $v = yes
 .endfor
 .export ${build_options}
 .endif
+
+# this does the work
+.include <dirdeps-targets.mk>
 
 .if !empty(DIRDEPS)
 # This is printed as we read the makefile

Modified: head/targets/Makefile.inc
==============================================================================
--- head/targets/Makefile.inc	Wed Dec 11 17:37:53 2019	(r355617)
+++ head/targets/Makefile.inc	Wed Dec 11 17:38:15 2019	(r355618)
@@ -20,11 +20,12 @@ PKG_METHOD = no
 .endif
 .endif
 
+.MAIN: all
+
 # The makefile in subdirs should set this to something useful
 # the default should do nothing.
 PKG_METHOD ?= none
-
-.MAIN: all
+none:
 
 .if ${build-*:${M_L_TARGETS}} != ""
 # just build the bits, skip packaging


More information about the svn-src-head mailing list