summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-08-19 23:33:51 +0000
committerian <ian@FreeBSD.org>2014-08-19 23:33:51 +0000
commitc4195049f50843730d019b09549639061baee9f3 (patch)
tree375a82f239f7aa39dc334cde99023f70cfa8558a /share/mk
parent6dd00f0d038b910cb8c3db81357a3fc44742e55e (diff)
downloadFreeBSD-src-c4195049f50843730d019b09549639061baee9f3.zip
FreeBSD-src-c4195049f50843730d019b09549639061baee9f3.tar.gz
MFC r266473,267331,267511:
Use an intermediate target to associate with _SUBDIR which is marked .MAKE this allows make -n to do tree walks as expected without doing anything else (as intended). Use prefix _sub. to help avoid conflict with any real target. Put the test suite in its own tests.txz distribution file. Force all the contents of /usr/tests to go into a separate distribution file so that users of binary releases can easily choose to not install Create a mechanism for providing fine-grained build order dependencies during SUBDIR_PARALLEL builds. This augments the coarse .WAIT mechanism, which is still useful if you've got a situation such as "almost everything depends on A and B".
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.subdir.mk22
-rw-r--r--share/mk/bsd.test.mk9
2 files changed, 25 insertions, 6 deletions
diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk
index 1500947..f76d5e1 100644
--- a/share/mk/bsd.subdir.mk
+++ b/share/mk/bsd.subdir.mk
@@ -47,15 +47,15 @@ _SUBDIR: .USE .MAKE
.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
@${_+_}set -e; for entry in ${SUBDIR:N.WAIT}; do \
if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
- ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:realinstall=install})"; \
+ ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \
edir=$${entry}.${MACHINE_ARCH}; \
cd ${.CURDIR}/$${edir}; \
else \
- ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:realinstall=install})"; \
+ ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \
edir=$${entry}; \
cd ${.CURDIR}/$${edir}; \
fi; \
- ${MAKE} ${.TARGET:realinstall=install} \
+ ${MAKE} ${.TARGET:S,realinstall,install,:S,^_sub.,,} \
DIRPRFX=${DIRPRFX}$$edir/; \
done
.endif
@@ -80,7 +80,12 @@ __subdir_targets=
__subdir_targets+= .WAIT
.else
__subdir_targets+= ${__target}_subdir_${__dir}
-${__target}_subdir_${__dir}: .MAKE
+__deps=
+.for __dep in ${SUBDIR_DEPEND_${__dir}}
+__deps+= ${__target}_subdir_${__dep}
+.endfor
+${__target}_subdir_${__dir}: .MAKE ${__deps}
+.if !defined(NO_SUBDIR)
@${_+_}set -e; \
if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \
${ECHODIR} "===> ${DIRPRFX}${__dir}.${MACHINE_ARCH} (${__target:realinstall=install})"; \
@@ -94,10 +99,12 @@ ${__target}_subdir_${__dir}: .MAKE
${MAKE} ${__target:realinstall=install} \
DIRPRFX=${DIRPRFX}$$edir/
.endif
+.endif
.endfor
${__target}: ${__subdir_targets}
.else
-${__target}: _SUBDIR
+${__target}: _sub.${__target}
+_sub.${__target}: _SUBDIR
.endif
.endfor
@@ -105,11 +112,14 @@ ${__target}: _SUBDIR
.for __stage in build install
${__stage}${__target}:
.if make(${__stage}${__target})
-${__stage}${__target}: _SUBDIR
+${__stage}${__target}: _sub.${__stage}${__target}
+_sub.${__stage}${__target}: _SUBDIR
.endif
.endfor
+.if !target(${__target})
${__target}: .MAKE
${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target}
+.endif
.endfor
.if !target(install)
diff --git a/share/mk/bsd.test.mk b/share/mk/bsd.test.mk
index 2e4b49d..38e945e 100644
--- a/share/mk/bsd.test.mk
+++ b/share/mk/bsd.test.mk
@@ -27,6 +27,15 @@ TESTS_SUBDIRS?=
# List of variables to pass to the tests at run-time via the environment.
TESTS_ENV?=
+# Force all tests in a separate distribution file.
+#
+# We want this to be the case even when the distribution name is already
+# overriden. For example: we want the tests for programs in the 'games'
+# distribution to end up in the 'tests' distribution; the test programs
+# themselves have all the necessary logic to detect that the games are not
+# installed and thus won't cause false negatives.
+DISTRIBUTION:= tests
+
# Ordered list of directories to construct the PATH for the tests.
TESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \
${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin
OpenPOWER on IntegriCloud