git: 62f3ada9497a - main - index: keep index file as long as possible

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 08 Nov 2021 12:59:14 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=62f3ada9497ac74c9fe7fe8e4207eebd43af0989

commit 62f3ada9497ac74c9fe7fe8e4207eebd43af0989
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2021-11-08 12:51:02 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2021-11-08 12:58:22 +0000

    index: keep index file as long as possible
    
    When generating the INDEX file, we are already building it in a
    temporary file and swap it last minute. make the index target now
    directly depend on the INDEX file generation target.
    Turn that target into a PHONY target so the file is always regenerated
    when someone calls make index.
    
    PR:             202070
---
 Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index ad4b13aec200..b32de32b747f 100644
--- a/Makefile
+++ b/Makefile
@@ -64,9 +64,7 @@ PORTSTOP=	yes
 
 .include <bsd.port.subdir.mk>
 
-index:
-	@rm -f ${INDEXDIR}/${INDEXFILE}
-	@cd ${.CURDIR} && ${MAKE} ${INDEXDIR}/${INDEXFILE}
+index: 	${INDEXDIR}/${INDEXFILE}
 
 fetchindex: ${INDEXDIR}/${INDEXFILE}.bz2
 	@bunzip2 < ${INDEXDIR}/${INDEXFILE}.bz2 > ${INDEXDIR}/${INDEXFILE} && \
@@ -110,7 +108,7 @@ MAKE_INDEX=	/usr/libexec/make_index /dev/stdin
 MAKE_INDEX=	perl ${.CURDIR}/Tools/make_index
 .endif
 
-${INDEXDIR}/${INDEXFILE}:
+${INDEXDIR}/${INDEXFILE}: .PHONY
 	@${INDEX_ECHO_1ST} "Generating ${INDEXFILE} - please wait.."; \
 	if [ "${INDEX_PRISTINE}" != "" ]; then \
 		export LOCALBASE=/nonexistentlocal; \