Module Name: src
Committed By: rillig
Date: Sat Apr 27 20:23:22 UTC 2024
Modified Files:
src/usr.bin/make/unit-tests: archive.exp archive.mk
Log Message:
tests/make: test detection of static library files
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/archive.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/archive.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/unit-tests/archive.exp
diff -u src/usr.bin/make/unit-tests/archive.exp:1.7 src/usr.bin/make/unit-tests/archive.exp:1.8
--- src/usr.bin/make/unit-tests/archive.exp:1.7 Fri Oct 9 06:44:42 2020
+++ src/usr.bin/make/unit-tests/archive.exp Sat Apr 27 20:23:22 2024
@@ -25,4 +25,12 @@ depend-on-existing-member
Making remove-archive
rm -f libprog.a
+begin library
+Examining libbad.a...up-to-date.
+Examining -lbad...up-to-date.
+Examining libgood.a...library...up-to-date.
+Examining -lgood...library...up-to-date.
+Examining library...nonexistent....PHONY node...out-of-date.
+Examining .END...nonexistent...nonexistent and no sources...out-of-date.
+end library
exit status 0
Index: src/usr.bin/make/unit-tests/archive.mk
diff -u src/usr.bin/make/unit-tests/archive.mk:1.12 src/usr.bin/make/unit-tests/archive.mk:1.13
--- src/usr.bin/make/unit-tests/archive.mk:1.12 Fri Apr 9 14:42:00 2021
+++ src/usr.bin/make/unit-tests/archive.mk Sat Apr 27 20:23:22 2024
@@ -1,4 +1,4 @@
-# $NetBSD: archive.mk,v 1.12 2021/04/09 14:42:00 christos Exp $
+# $NetBSD: archive.mk,v 1.13 2024/04/27 20:23:22 rillig Exp $
#
# Very basic demonstration of handling archives, based on the description
# in PSD.doc/tutorial.ms.
@@ -24,6 +24,12 @@ all:
@${MAKE} -f ${MAKEFILE} depend-on-existing-member
@${MAKE} -f ${MAKEFILE} depend-on-nonexistent-member
@${MAKE} -f ${MAKEFILE} remove-archive
+ @${MAKE} -f ${MAKEFILE} set-up-library
+ @${MAKE} -f ${MAKEFILE} -dm library 2>&1 \
+ | sed -n '/^Examining/p' \
+ | sed 's,\.\.\.modified[^.]*,,'
+ @${MAKE} -f ${MAKEFILE} tear-down-library
+
create-archive: ${ARCHIVE} pre post
@@ -58,3 +64,28 @@ pre: .USEBEFORE
@echo Making ${.TARGET} ${.OODATE:C,.+,out-of-date,W} ${.OODATE:O}
post: .USE
@echo
+
+
+set-up-library: .PHONY
+ @echo "member" > member.txt
+ @echo "not a library" > libbad.a
+ @ar cr libgood.a member.txt
+ @echo "begin library"
+
+.if make(library)
+.SUFFIXES: .a
+.LIBS: .a
+.endif
+# The two lines for libgood contain the word "library", the two lines for
+# libbad don't.
+#
+# expect: Examining libbad.a...up-to-date.
+# expect: Examining -lbad...up-to-date.
+# expect: Examining libgood.a...library...up-to-date.
+# expect: Examining -lgood...library...up-to-date.
+library: .PHONY libbad.a -lbad libgood.a -lgood
+ : Making ${.TARGET} from ${.ALLSRC}
+
+tear-down-library: .PHONY
+ @echo "end library"
+ @rm member.txt libbad.a libgood.a