NetBSD/usr.bin/make/unit-tests/archive.mk
rillig a0145b6eae make(1): fix archive test
Even though it is commented out in this Makefile, it is still run by
atf, on purpose.  This test is broken on FreeBSD, but on NetBSD it
should still be run.

Without removing the archive first, it could be left over from a
previous test failure and thus be newer than all its members, leading to
${.OODATE} being empty.
2020-08-15 01:49:07 +00:00

39 lines
885 B
Makefile

# $NetBSD: archive.mk,v 1.2 2020/08/15 01:49:07 rillig Exp $
#
# Very basic demonstration of handling archives, based on the description
# in PSD.doc/tutorial.ms.
ARCHIVE= libprog.${EXT.a}
FILES= archive.${EXT.mk} modmisc.${EXT.mk} varmisc.mk
EXT.a= a
EXT.mk= mk
MAKE_CMD= ${.MAKE} -f ${MAKEFILE}
RUN?= @set -eu;
all:
${RUN} ${MAKE_CMD} remove-archive
${RUN} ${MAKE_CMD} create-archive
${RUN} ${MAKE_CMD} list-archive
${RUN} ${MAKE_CMD} depend-on-existing-member
${RUN} ${MAKE_CMD} depend-on-nonexistent-member
${RUN} ${MAKE_CMD} remove-archive
create-archive: ${ARCHIVE}
${ARCHIVE}: ${ARCHIVE}(${FILES})
ar cru ${.TARGET} ${.OODATE}
ranlib ${.TARGET}
list-archive: ${ARCHIVE}
ar t ${.ALLSRC}
depend-on-existing-member: ${ARCHIVE}(archive.mk)
${RUN} echo $@
depend-on-nonexistent-member: ${ARCHIVE}(nonexistent.mk)
${RUN} echo $@
remove-archive:
rm ${ARCHIVE}