summaryrefslogtreecommitdiff
path: root/Mk
diff options
context:
space:
mode:
authorGary Palmer <gpalmer@FreeBSD.org>1994-12-11 20:36:12 +0000
committerGary Palmer <gpalmer@FreeBSD.org>1994-12-11 20:36:12 +0000
commit94ba290d32f348474315e70fef8fae1c719f9d4f (patch)
tree02fb9b52a32b4b352765729fb76f2ecdbec06628 /Mk
parentLast gremlin-killer of the day. Typo fixed and missing .endif replaced. (diff)
Early md5-checksumming code. This seems to work fine on my machine
but needs more testing on more ports than I have on my box.
Notes
Notes: svn path=/head/; revision=551
Diffstat (limited to 'Mk')
-rw-r--r--Mk/bsd.port.mk33
1 files changed, 32 insertions, 1 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 8169a0370d15..de6edadddfcc 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -3,7 +3,7 @@
# bsd.port.mk - 940820 Jordan K. Hubbard.
# This file is in the public domain.
#
-# $Id: bsd.port.mk,v 1.77 1994/12/11 14:50:40 gpalmer Exp $
+# $Id: bsd.port.mk,v 1.78 1994/12/11 15:31:22 gpalmer Exp $
#
# Please view me with 4 column tabs!
@@ -142,6 +142,8 @@ DO_NADA?= echo -n
# Miscellaneous overridable commands:
GMAKE?= gmake
XMKMF?= xmkmf
+MD5?= md5
+MD5_FILE?= ${FILESDIR}/md5
MAKE_FLAGS?= -f
MAKEFILE?= Makefile
@@ -457,6 +459,35 @@ fetch: pre-fetch
done)
.endif
+.if !target(make-md5)
+make-md5: fetch
+ @if [ ! -d ${FILESDIR} ]; then mkdir -p ${FILESDIR}; fi
+ @if [ -f ${MD5_FILE} ]; then rm -f ${MD5_FILE}; fi
+
+ @(cd ${DISTDIR}; \
+ for file in ${DISTFILES}; do \
+ ${MD5} $$file >> ${MD5_FILE}; \
+ done)
+.endif
+
+.if !target(check-md5)
+check-md5: fetch
+ @if [ ! -f ${MD5_FILE} ]; then \
+ echo ">> No MD5 checksum file."; \
+ exit 1; \
+ fi
+ @(cd ${DISTDIR}; \
+ for file in ${DISTFILES}; do \
+ CKSUM=`${MD5} $$file | awk '{print $$4}'`; \
+ CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \
+ if [ "$$CKSUM" != "$$CKSUM2" ]; then \
+ echo ">> Checksum mismatch for $$file" \
+ exit 1;\
+ fi; \
+ done)
+ @echo "Checksums OK."
+.endif
+
.if !target(pre-extract)
pre-extract:
@${DO_NADA}