1b6209a9bSSimon J. Gerraty 2b6209a9bSSimon J. Gerraty# This target is "special". 3b6209a9bSSimon J. Gerraty# 4b6209a9bSSimon J. Gerraty# The actual work is done via another target; 5b6209a9bSSimon J. Gerraty# UNIVERSE_TARGET_RELDIR is used to identify it. 6b6209a9bSSimon J. Gerraty# 7b6209a9bSSimon J. Gerraty# We leverage dirdeps.mk to run a sub-make per 8b6209a9bSSimon J. Gerraty# MACHINE/ARCH to each build ${UNIVERSE_TARGET_RELDIR} 9b6209a9bSSimon J. Gerraty# in meta mode. 10b6209a9bSSimon J. Gerraty# 11b6209a9bSSimon J. Gerraty# We simply override the level at which dirdeps.mk normally does 12b6209a9bSSimon J. Gerraty# its thing, and give it a DIRDEPS list that corresponds to 13b6209a9bSSimon J. Gerraty# ${UNIVERSE_TARGET_RELDIR}.${TARGET_SPEC} for each TARGET_SPEC we 14b6209a9bSSimon J. Gerraty# want. 15b6209a9bSSimon J. Gerraty# 16b6209a9bSSimon J. Gerraty# This allows the computation of dependencies for each ${TARGET_SPEC} 17b6209a9bSSimon J. Gerraty# to happen in parallel - avoiding a very long startup time. 18b6209a9bSSimon J. Gerraty# We can even export each sub-make to a different machine if using a 19b6209a9bSSimon J. Gerraty# cluster. 20b6209a9bSSimon J. Gerraty# 21b6209a9bSSimon J. Gerraty# The above works fine so long as our sub-makes remain independent. 22b6209a9bSSimon J. Gerraty# That is; none of them attempts to visit any directory for a machine 23b6209a9bSSimon J. Gerraty# other than the TARGET_SPEC we gave it. 24b6209a9bSSimon J. Gerraty# For example; to build some tool for the pseudo machine "host". 25b6209a9bSSimon J. Gerraty# To avoid that, our Makefile.depend lists all the hosttools we might 26b6209a9bSSimon J. Gerraty# need and these will thus be built before we launch the 27b6209a9bSSimon J. Gerraty# ${UNIVERSE_TARGET_RELDIR} sub-makes. 28b6209a9bSSimon J. Gerraty# Further we add a filter to skip any "host" dirdeps during those 29b6209a9bSSimon J. Gerraty# sub-makes. 30b6209a9bSSimon J. Gerraty# 31b6209a9bSSimon J. Gerraty# 32b6209a9bSSimon J. Gerraty 33b6209a9bSSimon J. Gerraty# this is the RELDIR of the target we build 3461ad1ff5SSimon J. GerratyUNIVERSE_TARGET_RELDIR?= targets/pseudo/the-lot 35b6209a9bSSimon J. Gerraty 36b6209a9bSSimon J. Gerraty# the list of machines 37b6209a9bSSimon J. GerratyTARGET_MACHINE_LIST = i386 amd64 38b6209a9bSSimon J. Gerraty 39b6209a9bSSimon J. Gerraty# avoid ../Makefile.inc defining this 40b6209a9bSSimon J. Gerratyall: 41b6209a9bSSimon J. Gerraty 42b6209a9bSSimon J. Gerraty.include "../Makefile.inc" 43b6209a9bSSimon J. Gerraty 44b6209a9bSSimon J. Gerraty.if ${.MAKE.LEVEL} > 0 45b6209a9bSSimon J. Gerraty# ok our prerequisites have been built 46b6209a9bSSimon J. Gerraty.if !defined(UNIVERSE_GUARD) 47b6209a9bSSimon J. Gerraty# just incase we end up back here, 48b6209a9bSSimon J. Gerraty# we cannot rely on .MAKE.LEVEL as we normally would 49b6209a9bSSimon J. GerratyUNIVERSE_GUARD=1 50b6209a9bSSimon J. Gerraty.export UNIVERSE_GUARD 51b6209a9bSSimon J. Gerraty 52b6209a9bSSimon J. Gerraty# we want to re-use dirdeps 53b6209a9bSSimon J. Gerraty_DIRDEP_USE_LEVEL = ${.MAKE.LEVEL} 54b6209a9bSSimon J. Gerraty 55b6209a9bSSimon J. Gerraty# we want our sub-makes to think they are level 0 56b6209a9bSSimon J. Gerraty# and we don't want failure of one to stop all. 57b6209a9bSSimon J. GerratyDIRDEP_USE_ENV= \ 58b6209a9bSSimon J. Gerraty MAKELEVEL=0 \ 59b6209a9bSSimon J. Gerraty MAKE_JOB_ERROR_TOKEN=no 60b6209a9bSSimon J. Gerraty 61b6209a9bSSimon J. Gerraty 62b6209a9bSSimon J. Gerraty_target_specs:= ${TARGET_MACHINE_LIST:@m@${TARGET_ARCHES_$m:U$m:@a@$m,$a@}@:O:u} 63b6209a9bSSimon J. Gerraty 64b6209a9bSSimon J. GerratyDIRDEPS:= ${_target_specs:@t@${UNIVERSE_TARGET_RELDIR}.$t@} 65b6209a9bSSimon J. Gerraty 66b6209a9bSSimon J. Gerratyall: dirdeps 67b6209a9bSSimon J. Gerraty 68b6209a9bSSimon J. Gerraty.include <dirdeps.mk> 69b6209a9bSSimon J. Gerraty.endif 70b6209a9bSSimon J. Gerraty.endif 71