summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authordmcmahill <dmcmahill>2003-07-23 09:41:23 +0000
committerdmcmahill <dmcmahill>2003-07-23 09:41:23 +0000
commit084b1577b86d643784f8b1ba285df06ae90ebc50 (patch)
treeb87d783cb2dda0050f33813665088c4d11f50b76 /Makefile
parentd7f7397ec03fc976fbe184d43adf4966221efa48 (diff)
downloadpkgsrc-084b1577b86d643784f8b1ba285df06ae90ebc50.tar.gz
rework the INDEX file generation. The new approach speeds up things by
several orders of magnitude and 'make index' now takes 30 minutes or so instead of several days on my test machine. The approach now is to take one pass through every package and extract some key information including the explicitly listed dependencies. After the data is extracted, the dependencies are flattened in one step which avoids the extremely inefficient recursive make that was previously used.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile48
1 files changed, 41 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 2c088fd8689..02d18a53d5e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.55 2003/06/30 22:05:11 hubertf Exp $
+# $NetBSD: Makefile,v 1.56 2003/07/23 09:41:23 dmcmahill Exp $
#
.include "mk/bsd.prefs.mk"
@@ -101,14 +101,48 @@ README.html: .PRECIOUS
_PKGSRCDIR=${.CURDIR}
.endif
-index:
- @${RM} -f ${.CURDIR}/INDEX
- @${MAKE} ${.CURDIR}/INDEX
+.PHONY: index
+index: ${.CURDIR}/INDEX
${.CURDIR}/INDEX:
- @${ECHO} -n "Generating INDEX - please wait.."
- @${MAKE} describe ECHO_MSG="${ECHO} > /dev/null" > ${.CURDIR}/INDEX
- @${ECHO} " Done."
+ @${RM} -f ${.CURDIR}/DEPENDSDB
+ @${ECHO_MSG} "Extracting complete dependency database. This may take a while..."
+ @DB=${.CURDIR}/DEPENDSDB ; \
+ PKGSRCDIR=${.CURDIR} ; \
+ npkg=1; \
+ ${RM} -fr $$DB ; \
+ list=`${GREP} '^[[:space:]]*'SUBDIR */Makefile | sed 's,/Makefile.*=[[:space:]]*,/,'` ; \
+ for pkgdir in $$list ; do \
+ if [ ! -d $$pkgdir ]; then \
+ echo " " ; \
+ echo "WARNING: the package directory $pkgdir is listed in" > /dev/stderr ; \
+ echo $pkgdir | sed 's;/.*;/Makefile;g' > /dev/stderr ; \
+ echo "but the directory does not exist. Please fix this!" > /dev/stderr ; \
+ else \
+ cd $$pkgdir ; \
+ l=`${MAKE} print-summary-data` ; \
+ if [ $$? != 0 ]; then \
+ echo "WARNING (printdepends): the package in $$pkgdir had problem with" \
+ > /dev/stderr ; \
+ echo " ${MAKE} print-summary-data" > /dev/stderr ; \
+ echo " database information for this package" > /dev/stderr ; \
+ echo " will be dropped." > /dev/stderr ; \
+ ${MAKE} print-summary-data 2>&1 > /dev/stderr ; \
+ else \
+ echo "$$l" >> $$DB ; \
+ fi ; \
+ fi ; \
+ echo -n "." ; \
+ if [ `${EXPR} $$npkg % 100 = 0` -eq 1 ]; then \
+ echo " " ; \
+ echo "$$npkg" ; \
+ fi ; \
+ npkg=`${EXPR} $$npkg + 1` ; \
+ cd $$PKGSRCDIR ; \
+ done
+ @${RM} -f ${.CURDIR}/INDEX
+ @${AWK} -f ./mk/scripts/genindex.awk PKGSRCDIR=${.CURDIR} SORT=${SORT} ${.CURDIR}/DEPENDSDB
+ @${RM} -f ${.CURDIR}/DEPENDSDB
print-index: ${.CURDIR}/INDEX
@${AWK} -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\nArch:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10); }' < ${.CURDIR}/INDEX