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