git: 4d08b569a01e - main - bsd.man.mk allow staging compressed pages

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Sat, 30 Dec 2023 17:11:21 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=4d08b569a01efec69319d9d22c7e361b8270a21d

commit 4d08b569a01efec69319d9d22c7e361b8270a21d
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2023-12-30 17:10:03 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2023-12-30 17:10:03 +0000

    bsd.man.mk allow staging compressed pages
    
    In the DIRDEPS_BUILD we use staging.
    The staging logic in bsd.man.mk was in the wrong place, shift it
    and add compressed man pages to the stage set if appropriate.
    
    Reviewed by:    stevek
    Differential Revision:  https://reviews.freebsd.org/D43238
---
 share/mk/bsd.man.mk | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk
index 25a0edcc7bc5..c80c618e48db 100644
--- a/share/mk/bsd.man.mk
+++ b/share/mk/bsd.man.mk
@@ -130,22 +130,6 @@ all-man: ${MAN}
 ZEXT=		${MCOMPRESS_EXT}
 
 .if defined(MAN) && !empty(MAN)
-.if ${MK_STAGING_MAN} == "yes"
-STAGE_TARGETS+= stage_files
-_mansets:= ${MAN:E:O:u:M*[1-9]:@s@man$s@}
-STAGE_SETS+= ${_mansets}
-.for _page in ${MAN}
-stage_files.man${_page:T:E}: ${_page}
-STAGE_DIR.man${_page:T:E}?= ${STAGE_OBJTOP}${MANDIR}${_page:T:E}${MANSUBDIR}
-.endfor
-.if !empty(MLINKS)
-STAGE_SETS+= mlinks
-STAGE_TARGETS+= stage_links
-STAGE_LINKS.mlinks:= ${MLINKS:M*.[1-9]:@f@${f:S,^,${MANDIR}${f:E}${MANSUBDIR}/,}@}
-stage_links.mlinks: ${_mansets:@s@stage_files.$s@}
-.endif
-.endif
-
 CLEANFILES+=	${MAN:T:S/$/${MCOMPRESS_EXT}/g}
 CLEANFILES+=	${MAN:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g}
 .for __page in ${MAN}
@@ -185,6 +169,27 @@ _MANLINKS+=	${CATDIR}${_osect}${MANSUBDIR}/${_oname} \
 .endfor
 .endif
 
+.if defined(MAN) && !empty(MAN)
+.if ${MK_STAGING_MAN} == "yes"
+STAGE_TARGETS+= stage_files
+_mansets:= ${MAN:E:O:u:M*[1-9]:@s@man$s@}
+STAGE_SETS+= ${_mansets}
+.for _page in ${MAN}
+stage_files.man${_page:T:E}: ${_page}
+.if target(${_page}${MCOMPRESS_EXT})
+stage_files.man${_page:T:E}: ${_page}${MCOMPRESS_EXT}
+.endif
+STAGE_DIR.man${_page:T:E}?= ${STAGE_OBJTOP}${MANDIR}${_page:T:E}${MANSUBDIR}
+.endfor
+.if !defined(NO_MLINKS) && !empty(MLINKS)
+STAGE_SETS+= mlinks
+STAGE_TARGETS+= stage_links
+STAGE_LINKS.mlinks:= ${MLINKS:M*.[1-9]:@f@${f:S,^,${MANDIR}${f:E}${MANSUBDIR}/,}@}
+stage_links.mlinks: ${_mansets:@s@stage_files.$s@}
+.endif
+.endif
+.endif
+
 maninstall:
 .if defined(MAN) && !empty(MAN)
 maninstall: ${MAN}