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