aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2014-11-23 00:08:22 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2014-11-23 00:08:22 +0000
commitf1382cffe7703a142e8eea88242485a577c1aeb2 (patch)
tree4ab0fcd89330d47d7720e0b8c6453ae5b9fc587b
parent566bf19ac8cd78a36266c3b81c57051c40758289 (diff)
downloadsrc-f1382cffe7703a142e8eea88242485a577c1aeb2.tar.gz
src-f1382cffe7703a142e8eea88242485a577c1aeb2.zip
Leverage dirdeps.mk by tweaking _DIRDEP_USE_LEVEL
so we can have a 2nd stage of dependencies computed in parallel. Reviewed by: marcel
Notes
Notes: svn path=/projects/bmake/; revision=274902
-rw-r--r--pkgs/pseudo/hosttools/Makefile3
-rw-r--r--pkgs/pseudo/hosttools/Makefile.depend24
-rw-r--r--pkgs/pseudo/universe/Makefile73
-rw-r--r--pkgs/pseudo/universe/Makefile.depend15
4 files changed, 115 insertions, 0 deletions
diff --git a/pkgs/pseudo/hosttools/Makefile b/pkgs/pseudo/hosttools/Makefile
new file mode 100644
index 000000000000..265f86d1ed55
--- /dev/null
+++ b/pkgs/pseudo/hosttools/Makefile
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+.include "../Makefile.inc"
diff --git a/pkgs/pseudo/hosttools/Makefile.depend b/pkgs/pseudo/hosttools/Makefile.depend
new file mode 100644
index 000000000000..83c884853777
--- /dev/null
+++ b/pkgs/pseudo/hosttools/Makefile.depend
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+# This file is not autogenerated - take care!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ lib/clang/include.host \
+ lib/libc++.host \
+ lib/libcxxrt.host \
+ share/doc/llvm/clang.host \
+ usr.bin/clang/clang-tblgen.host \
+ usr.bin/clang/clang.host \
+ usr.bin/clang/tblgen.host \
+ usr.bin/lex/lib.host \
+ usr.bin/mkcsmapper_static.host \
+ usr.bin/mkesdb_static.host \
+ usr.bin/mkuzip.host \
+ usr.bin/xinstall.host \
+ usr.sbin/config.host \
+
+
+
+.include <dirdeps.mk>
diff --git a/pkgs/pseudo/universe/Makefile b/pkgs/pseudo/universe/Makefile
new file mode 100644
index 000000000000..85b6b7189477
--- /dev/null
+++ b/pkgs/pseudo/universe/Makefile
@@ -0,0 +1,73 @@
+# $FreeBSD$
+
+# This target is "special".
+#
+# The actual work is done via another target;
+# UNIVERSE_TARGET_RELDIR is used to identify it.
+#
+# We leverage dirdeps.mk to run a sub-make per
+# MACHINE/ARCH to each build ${UNIVERSE_TARGET_RELDIR}
+# in meta mode.
+#
+# We simply override the level at which dirdeps.mk normally does
+# its thing, and give it a DIRDEPS list that corresponds to
+# ${UNIVERSE_TARGET_RELDIR}.${TARGET_SPEC} for each TARGET_SPEC we
+# want.
+#
+# This allows the computation of dependencies for each ${TARGET_SPEC}
+# to happen in parallel - avoiding a very long startup time.
+# We can even export each sub-make to a different machine if using a
+# cluster.
+#
+# The above works fine so long as our sub-makes remain independent.
+# That is; none of them attempts to visit any directory for a machine
+# other than the TARGET_SPEC we gave it.
+# For example; to build some tool for the pseudo machine "host".
+# To avoid that, our Makefile.depend lists all the hosttools we might
+# need and these will thus be built before we launch the
+# ${UNIVERSE_TARGET_RELDIR} sub-makes.
+# Further we add a filter to skip any "host" dirdeps during those
+# sub-makes.
+#
+#
+
+# this is the RELDIR of the target we build
+UNIVERSE_TARGET_RELDIR?= pkgs/pseudo/the-lot
+
+# the list of machines
+TARGET_MACHINE_LIST = i386 amd64
+# some machines have more than one arch
+TARGET_ARCHES_arm?= arm armeb armv6 armv6hf
+
+# avoid ../Makefile.inc defining this
+all:
+
+.include "../Makefile.inc"
+
+.if ${.MAKE.LEVEL} > 0
+# ok our prerequisites have been built
+.if !defined(UNIVERSE_GUARD)
+# just incase we end up back here,
+# we cannot rely on .MAKE.LEVEL as we normally would
+UNIVERSE_GUARD=1
+.export UNIVERSE_GUARD
+
+# we want to re-use dirdeps
+_DIRDEP_USE_LEVEL = ${.MAKE.LEVEL}
+
+# we want our sub-makes to think they are level 0
+# and we don't want failure of one to stop all.
+DIRDEP_USE_ENV= \
+ MAKELEVEL=0 \
+ MAKE_JOB_ERROR_TOKEN=no
+
+
+_target_specs:= ${TARGET_MACHINE_LIST:@m@${TARGET_ARCHES_$m:U$m:@a@$m,$a@}@:O:u}
+
+DIRDEPS:= ${_target_specs:@t@${UNIVERSE_TARGET_RELDIR}.$t@}
+
+all: dirdeps
+
+.include <dirdeps.mk>
+.endif
+.endif
diff --git a/pkgs/pseudo/universe/Makefile.depend b/pkgs/pseudo/universe/Makefile.depend
new file mode 100644
index 000000000000..e9cbdb58b354
--- /dev/null
+++ b/pkgs/pseudo/universe/Makefile.depend
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+# This file is not autogenerated - take care!
+
+# this is not normally needed, but we are not normal
+.if ${.MAKE.LEVEL} == 0
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+# our role here is to build all the host tools etc.
+DIRDEPS = \
+ pkgs/pseudo/hosttools.host \
+
+
+.include <dirdeps.mk>
+.endif