git: 08604a023dc1 - main - Auto-create bmake/unit-tests objdir if appropriate
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Jul 2022 20:24:42 UTC
The branch main has been updated by sjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=08604a023dc1b601289b7de20509462a3a3ed6ad
commit 08604a023dc1b601289b7de20509462a3a3ed6ad
Author: Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2022-07-26 20:24:34 +0000
Commit: Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2022-07-26 20:24:34 +0000
Auto-create bmake/unit-tests objdir if appropriate
Given the way bmake/unit-tests is visited, when doing 'test'
MK_AUTO_OBJ=yes will not be effective.
So create the objdir before running the sub-make.
Also ensure MAKEOBJDIR is passed to opt-m-include-dir
Reviewed by: deo
---
usr.bin/bmake/Makefile | 15 ++++++++++++++-
usr.bin/bmake/unit-tests/Makefile | 1 +
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile
index 14389de562dd..b6d741d30960 100644
--- a/usr.bin/bmake/Makefile
+++ b/usr.bin/bmake/Makefile
@@ -147,11 +147,24 @@ ${OBJS}: config.h
# A simple unit-test driver to help catch regressions
TEST_MAKE ?= ${.OBJDIR}/${PROG:T}
-accept test:
+accept test: .NOMETA
cd ${.CURDIR}/unit-tests && \
MAKEFLAGS= ${TEST_MAKE} -r -m / ${.TARGET} ${TESTS:DTESTS=${TESTS:Q}}
+.if make(test) && ${MK_AUTO_OBJ} == "yes"
+# because of the way unit-tests is visted for test
+# the objdir will not be auto-created as expected.
+.if defined(MAKEOBJDIRPREFIX) || ${MAKEOBJDIR:Uno:M*/*} != ""
+_utobj = ${.OBJDIR}/unit-tests
+.else
+_utobj = ${.CURDIR}/unit-tests/${MAKEOBJDIR:Uobj}
+.endif
+utobj: .NOMETA
+ mkdir -p ${_utobj}
+test: utobj
+.endif
+
# override some simple things
BINDIR= /usr/bin
MANDIR= /usr/share/man/man
diff --git a/usr.bin/bmake/unit-tests/Makefile b/usr.bin/bmake/unit-tests/Makefile
index 13967ae888a8..a4023c7a98fc 100644
--- a/usr.bin/bmake/unit-tests/Makefile
+++ b/usr.bin/bmake/unit-tests/Makefile
@@ -505,6 +505,7 @@ ENV.depsrc-optional+= TZ=UTC
ENV.deptgt-phony+= MAKESYSPATH=.
ENV.directive-undef= ENV_VAR=env-value
ENV.envfirst= FROM_ENV=value-from-env
+ENV.opt-m-include-dir= ${MAKEOBJDIR:DMAKEOBJDIR=${MAKEOBJDIR}}
ENV.varmisc= FROM_ENV=env
ENV.varmisc+= FROM_ENV_BEFORE=env
ENV.varmisc+= FROM_ENV_AFTER=env