From a305a56ce15f5a95267a1851fd17239df4ee70a3 Mon Sep 17 00:00:00 2001 From: bdrewery Date: Thu, 22 Oct 2015 22:29:25 +0000 Subject: [PATCH] Fix installation of manpages with WITHOUT_COMPRESS broken since r284685. This partially reverts r284685. An attempt was made in r285295 to fix this but was not enough. There were still $${} vars in the code that should have been using the ${_page} and ${_sect} vars, but the bigger problem was that .for cannot be used on .ALLSRC as it is not defined when the .for is evaluated. Using ${MAN} here in a .for loop doesn't work either as the paths are not expanded right for lib/libc/ subdirs despite having a .PATH set for all of them. Add some comments around long .else and .endif as well. Sponsored by: EMC / Isilon Storage Division --- share/mk/bsd.man.mk | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk index 72aedfb5423e..d0992b630dfb 100644 --- a/share/mk/bsd.man.mk +++ b/share/mk/bsd.man.mk @@ -104,8 +104,8 @@ ${__target}: ${__page} .endfor .endif .endfor -.endif -.else +.endif # !empty(MAN) +.else # !defined(MANFILTER) .if defined(MAN) && !empty(MAN) CLEANFILES+= ${MAN:T:S/$/${CATEXT}/g} .if defined(MANBUILDCAT) && !empty(MANBUILDCAT) @@ -120,9 +120,9 @@ ${__target}: ${__page} _manpages: ${MAN} .endif .endif -.endif +.endif # defined(MANFILTER) -.else +.else # ${MK_MANCOMPRESS} == "yes" ZEXT= ${MCOMPRESS_EXT} @@ -169,7 +169,7 @@ ${__target}: ${__page} .endfor .endif -.endif +.endif # ${MK_MANCOMPRESS} == "no" maninstall: _maninstall _maninstall: @@ -185,20 +185,26 @@ _maninstall: ${MAN} ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page} .endif .endfor -.else -.for _page _sect in ${.ALLSRC:C/\.([^.]*)$/.\1 \1/} - @d=${DESTDIR}${MANDIR}${_sect}${MANSUBDIR}/; \ - ${ECHO} ${MINSTALL} ${_page} $${d}; \ - ${MINSTALL} $${page} $${d}; -.endfor +.else # !defined(MANFILTER) + @set ${.ALLSRC:C/\.([^.]*)$/.\1 \1/}; \ + while : ; do \ + case $$# in \ + 0) break;; \ + 1) echo "warn: missing extension: $$1"; break;; \ + esac; \ + page=$$1; shift; sect=$$1; shift; \ + d=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}; \ + ${ECHO} ${MINSTALL} $${page} $${d}; \ + ${MINSTALL} $${page} $${d}; \ + done .if defined(MANBUILDCAT) && !empty(MANBUILDCAT) .for __page in ${MAN} ${MINSTALL} ${__page:T:S/$/${CATEXT}/} \ ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T} .endfor .endif -.endif -.else +.endif # defined(MANFILTER) +.else # ${MK_MANCOMPRESS} == "yes" .for __page in ${MAN} ${MINSTALL} ${__page:T:S/$/${MCOMPRESS_EXT}/g} \ ${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}/ @@ -207,7 +213,7 @@ _maninstall: ${MAN} ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T:S/$/${MCOMPRESS_EXT}/} .endif .endfor -.endif +.endif # ${MK_MANCOMPRESS} == "no" .endif .if !defined(NO_MLINKS) && defined(MLINKS) && !empty(MLINKS)