make INDEX a parameter so we can move it.

This commit is contained in:
espie 2018-11-16 09:24:09 +00:00
parent 560e048a00
commit 533d16aed3

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.80 2018/11/06 11:13:44 espie Exp $
# $OpenBSD: Makefile,v 1.81 2018/11/16 09:24:09 espie Exp $
.if !defined(BSD_OWN_MK)
. include <bsd.own.mk>
@ -6,13 +6,14 @@
PKGPATH =
DISTFILES_DB ?= ${.CURDIR}/infrastructure/db/locate.database
INDEX = ${.CURDIR}/INDEX
.if defined(SUBDIR)
# nothing to do
.elif defined(key) || defined(name) || defined(category) || defined(author)
# set up subdirs from the index, assume it's up-to-date
_CMD = perl ${.CURDIR}/infrastructure/bin/port-search-helper index='${.CURDIR}/INDEX'
_CMD = perl ${.CURDIR}/infrastructure/bin/port-search-helper index='${INDEX}'
. if defined(key)
_CMD += key='${key}'
. endif
@ -83,22 +84,22 @@ ${.CURDIR}/INDEX:
@${_MAKE} describe MACHINE_ARCH=amd64 ARCH=amd64 ECHO_MSG="echo 1>&2" > ${.CURDIR}/INDEX
@echo "Done."
print-index: ${.CURDIR}/INDEX
@awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nL-deps:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10); }' < ${.CURDIR}/INDEX
print-index: ${INDEX}
@awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nL-deps:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10); }' < ${INDEX}
print-licenses: ${.CURDIR}/INDEX
print-licenses: ${INDEX}
@printf "Port PC PF DC DF Maint\n"
@awk -F\| '{printf("%-40.39s%-3.2s%-3.2s%-3.2s%-3.2s%-25.25s\n",$$2,$$12,$$13,$$14,$$15,$$6);}' < ${.CURDIR}/INDEX
@awk -F\| '{printf("%-40.39s%-3.2s%-3.2s%-3.2s%-3.2s%-25.25s\n",$$2,$$12,$$13,$$14,$$15,$$6);}' < ${INDEX}
search: ${.CURDIR}/INDEX
search: ${INDEX}
.if !defined(key) && !defined(name)
@echo "The search target requires a keyword or name parameter,"
@echo "e.g.: \"make search key=somekeyword\" \"make search name=somename\""
.else
. if defined(key)
@egrep -i -- "${key}" ${.CURDIR}/INDEX | awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nL-deps:\t%s\nB-deps:\t%s\nR-deps:\t%s\nArchs:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10, $$11); }'
@egrep -i -- "${key}" ${INDEX} | awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nL-deps:\t%s\nB-deps:\t%s\nR-deps:\t%s\nArchs:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10, $$11); }'
. else
@awk -F\| '$$1 ~ /${name}/ { printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nL-deps:\t%s\nB-deps:\t%s\nR-deps:\t%s\nArchs:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10, $$11); }' ${.CURDIR}/INDEX
@awk -F\| '$$1 ~ /${name}/ { printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nL-deps:\t%s\nB-deps:\t%s\nR-deps:\t%s\nArchs:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10, $$11); }' ${INDEX}
. endif
.endif