Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests make(1): make individual targets in ...
details: https://anonhg.NetBSD.org/src/rev/0f36d9067a14
branches: trunk
changeset: 940512:0f36d9067a14
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Oct 08 18:37:26 2020 +0000
description:
make(1): make individual targets in test archive.mk visible
This test still fails on FreeBSD, printing the "ar cru, ranlib" lines
twice, and I don't know why.
To get more insights into the inner details, without activating the full
-dA logging, split the output into paragraphs, one per target.
This change reveals another interesting detail: Dependencies without any
commands (in this case create-archive) don't inherit the commands from
.USEBEFORE and .USE sources.
diffstat:
usr.bin/make/unit-tests/archive.exp | 14 ++++++++++++++
usr.bin/make/unit-tests/archive.mk | 27 ++++++++++++++++-----------
2 files changed, 30 insertions(+), 11 deletions(-)
diffs (97 lines):
diff -r acff39d67e75 -r 0f36d9067a14 usr.bin/make/unit-tests/archive.exp
--- a/usr.bin/make/unit-tests/archive.exp Thu Oct 08 17:54:20 2020 +0000
+++ b/usr.bin/make/unit-tests/archive.exp Thu Oct 08 18:37:26 2020 +0000
@@ -1,14 +1,28 @@
+Making remove-archive
rm -f libprog.a
+
+Making libprog.a out-of-date archive.mk modmisc.mk varmisc.mk
ar cru libprog.a archive.mk modmisc.mk varmisc.mk
ranlib libprog.a
+
+Making create-archive out-of-date libprog.a
+
+Making list-archive out-of-date libprog.a
ar t libprog.a
archive.mk
modmisc.mk
varmisc.mk
+
+Making list-archive-wildcard out-of-date ternary.mk archive-suffix.mk archive.mk
list-archive-wildcard: archive-suffix.mk
list-archive-wildcard: archive.mk
list-archive-wildcard: ternary.mk
+
+Making depend-on-existing-member out-of-date archive.mk
depend-on-existing-member
+
`depend-on-nonexistent-member' is up to date.
+Making remove-archive
rm -f libprog.a
+
exit status 0
diff -r acff39d67e75 -r 0f36d9067a14 usr.bin/make/unit-tests/archive.mk
--- a/usr.bin/make/unit-tests/archive.mk Thu Oct 08 17:54:20 2020 +0000
+++ b/usr.bin/make/unit-tests/archive.mk Thu Oct 08 18:37:26 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: archive.mk,v 1.8 2020/09/07 05:16:32 rillig Exp $
+# $NetBSD: archive.mk,v 1.9 2020/10/08 18:37:26 rillig Exp $
#
# Very basic demonstration of handling archives, based on the description
# in PSD.doc/tutorial.ms.
@@ -17,9 +17,9 @@
.if ${.PARSEDIR:tA} != ${.CURDIR:tA}
@cd ${MAKEFILE:H} && cp ${FILES} [at]*.mk ${.CURDIR}
.endif
-# The following targets are run in sub-makes to ensure that they get the
-# current state of the filesystem right, since they creating and removing
-# files.
+# The following targets create and remove files. The filesystem cache in
+# dir.c would probably not handle this correctly, therefore each of the
+# targets is run in its separate sub-make.
${RUN} ${MAKE_CMD} remove-archive
${RUN} ${MAKE_CMD} create-archive
${RUN} ${MAKE_CMD} list-archive
@@ -28,30 +28,35 @@
${RUN} ${MAKE_CMD} depend-on-nonexistent-member
${RUN} ${MAKE_CMD} remove-archive
-create-archive: ${ARCHIVE}
+create-archive: ${ARCHIVE} pre post
# The indirect references with the $$ cover the code in Arch_ParseArchive
# that calls Var_Parse. It's an esoteric scenario since at the point where
# Arch_ParseArchive is called, the dependency line is already fully expanded.
#
-${ARCHIVE}: $${:Ulibprog.a}(archive.mk modmisc.mk $${:Uvarmisc.mk})
+${ARCHIVE}: $${:Ulibprog.a}(archive.mk modmisc.mk $${:Uvarmisc.mk}) pre post
ar cru ${.TARGET} ${.OODATE}
ranlib ${.TARGET}
-list-archive: ${ARCHIVE}
+list-archive: ${ARCHIVE} pre post
ar t ${.ALLSRC}
# XXX: I had expected that this dependency would select all *.mk files from
# the archive. Instead, the globbing is done in the current directory.
# To prevent an overly long file list, the pattern is restricted to [at]*.mk.
-list-archive-wildcard: ${ARCHIVE}([at]*.mk)
+list-archive-wildcard: ${ARCHIVE}([at]*.mk) pre post
${RUN} printf '%s\n' ${.ALLSRC:O:@member@${.TARGET:Q}': '${member:Q}@}
-depend-on-existing-member: ${ARCHIVE}(archive.mk)
+depend-on-existing-member: ${ARCHIVE}(archive.mk) pre post
${RUN} echo $@
-depend-on-nonexistent-member: ${ARCHIVE}(nonexistent.mk)
+depend-on-nonexistent-member: ${ARCHIVE}(nonexistent.mk) pre post
${RUN} echo $@
-remove-archive:
+remove-archive: pre post
rm -f ${ARCHIVE}
+
+pre: .USEBEFORE
+ @echo Making ${.TARGET} ${.OODATE:C,.+,out-of-date,W} ${.OODATE}
+post: .USE
+ @echo
Home |
Main Index |
Thread Index |
Old Index