diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2019-12-11 17:38:15 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2019-12-11 17:38:15 +0000 |
commit | 312809fe7fefbc8d5caa2b59089a5d9266378057 (patch) | |
tree | d27e6f766ba2a6b544e5529b800f0313971983b2 | |
parent | 2c9a9dfc187d171de6b92654d71b977f067ed641 (diff) |
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
Notes
Notes:
svn path=/head/; revision=355618
-rw-r--r-- | lib/libbsnmp/libbsnmp/Makefile | 7 | ||||
-rw-r--r-- | lib/libgcc_eh/Makefile | 6 | ||||
-rw-r--r-- | lib/libmagic/Makefile | 6 | ||||
-rw-r--r-- | lib/libpmc/Makefile | 8 | ||||
-rw-r--r-- | share/mk/dirdeps-targets.mk | 134 | ||||
-rw-r--r-- | share/mk/dirdeps.mk | 32 | ||||
-rw-r--r-- | share/mk/gendirdeps.mk | 11 | ||||
-rw-r--r-- | share/mk/local.dirdeps-options.mk | 29 | ||||
-rw-r--r-- | share/mk/local.dirdeps.mk | 6 | ||||
-rw-r--r-- | share/mk/local.gendirdeps.mk | 1 | ||||
-rw-r--r-- | share/mk/local.meta.sys.mk | 4 | ||||
-rw-r--r-- | share/mk/meta.sys.mk | 6 | ||||
-rw-r--r-- | targets/Makefile | 71 | ||||
-rw-r--r-- | targets/Makefile.inc | 5 |
14 files changed, 240 insertions, 86 deletions
diff --git a/lib/libbsnmp/libbsnmp/Makefile b/lib/libbsnmp/libbsnmp/Makefile index 94c72795a51c..c0a6cf2da643 100644 --- a/lib/libbsnmp/libbsnmp/Makefile +++ b/lib/libbsnmp/libbsnmp/Makefile @@ -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} diff --git a/lib/libgcc_eh/Makefile b/lib/libgcc_eh/Makefile index 9909e73c9375..bf018e16c9e0 100644 --- a/lib/libgcc_eh/Makefile +++ b/lib/libgcc_eh/Makefile @@ -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> diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile index b9a0e8676768..522574f28e79 100644 --- a/lib/libmagic/Makefile +++ b/lib/libmagic/Makefile @@ -40,6 +40,7 @@ magic: ${MAGFILES} magic.mgc: mkmagic magic ${BTOOLSPATH:U.}/mkmagic magic +.if ${MACHINE} == "host" || ${MK_DIRDEPS_BUILD} == "no" CLEANFILES+= mkmagic DEPENDOBJS+= mkmagic build-tools: mkmagic @@ -47,6 +48,11 @@ mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c ${INCS} ${BU ${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 CLEANFILES+= ${MAN} diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index 47f82a6f7cc9..cb3ea17c3831 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -17,12 +17,20 @@ 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} ${JEVENTS} ${EVENT_ARCH} ${.CURDIR}/pmu-events/arch libpmc_events.c diff --git a/share/mk/dirdeps-targets.mk b/share/mk/dirdeps-targets.mk new file mode 100644 index 000000000000..179c38b53fff --- /dev/null +++ b/share/mk/dirdeps-targets.mk @@ -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@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@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 diff --git a/share/mk/dirdeps.mk b/share/mk/dirdeps.mk index 5cb936003fcb..68ddd2155647 100644 --- a/share/mk/dirdeps.mk +++ b/share/mk/dirdeps.mk @@ -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 +@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 diff --git a/share/mk/gendirdeps.mk b/share/mk/gendirdeps.mk index ee7898a29a17..96681fc7d9d3 100644 --- a/share/mk/gendirdeps.mk +++ b/share/mk/gendirdeps.mk @@ -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 \( -type d ! -name . -prun .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: diff --git a/share/mk/local.dirdeps-options.mk b/share/mk/local.dirdeps-options.mk new file mode 100644 index 000000000000..67b30f351f9f --- /dev/null +++ b/share/mk/local.dirdeps-options.mk @@ -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 + + diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk index 6fb2ca5ed4f0..cb01719c6045 100644 --- a/share/mk/local.dirdeps.mk +++ b/share/mk/local.dirdeps.mk @@ -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 \ @@ -222,6 +221,11 @@ 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}} CSU_DIR.${DEP_MACHINE_ARCH} ?= csu/${DEP_MACHINE_ARCH} CSU_DIR := ${CSU_DIR.${DEP_MACHINE_ARCH}} diff --git a/share/mk/local.gendirdeps.mk b/share/mk/local.gendirdeps.mk index 6ec79b56f92a..71a7a3cbc00f 100644 --- a/share/mk/local.gendirdeps.mk +++ b/share/mk/local.gendirdeps.mk @@ -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 \ diff --git a/share/mk/local.meta.sys.mk b/share/mk/local.meta.sys.mk index 18734ba5bae9..8286f43a4cc8 100644 --- a/share/mk/local.meta.sys.mk +++ b/share/mk/local.meta.sys.mk @@ -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 diff --git a/share/mk/meta.sys.mk b/share/mk/meta.sys.mk index 597b7fbaa7f1..8c39757e15af 100644 --- a/share/mk/meta.sys.mk +++ b/share/mk/meta.sys.mk @@ -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 diff --git a/targets/Makefile b/targets/Makefile index 8040953c6d1a..7dcec18125a5 100644 --- a/targets/Makefile +++ b/targets/Makefile @@ -38,74 +38,6 @@ 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@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} @@ -115,6 +47,9 @@ $v = yes .export ${build_options} .endif +# this does the work +.include <dirdeps-targets.mk> + .if !empty(DIRDEPS) # This is printed as we read the makefile # so provides a useful clue as to when we really started. diff --git a/targets/Makefile.inc b/targets/Makefile.inc index 2dc3b8155824..9ef94473f647 100644 --- a/targets/Makefile.inc +++ b/targets/Makefile.inc @@ -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 |