Module Name: src Committed By: lukem Date: Mon May 22 12:55:45 UTC 2023
Modified Files: src/share/man/man0: Makefile src/share/mk: bsd.own.mk Removed Files: src/share/man/man0: mkman Log Message: man0: support objdirs, tools, parallel builds man0 creates files, so write to the the OBJDIR instead of the source directory. Use TOOL_ appropriately. Add MAKEVERBOSE support. Add separate rules to generate: - all.files: the list of all man files to process (based on mkman) - manNpages.files: per-section files from all.files. (based on mkman) - manNpages.ps: per-section .ps from manNpages.files, with per-file MAKEVERBOSE messages to stderr (as before, just prettier). - manNpages.pdf: per-section .pdf from manNpages.ps. Remove the now-obsolete mkman script. Add TOOL_GROPS and _MKSHMSG_FORMAT to <bsd.own.mk> To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/share/man/man0/Makefile cvs rdiff -u -r1.5 -r0 src/share/man/man0/mkman cvs rdiff -u -r1.1324 -r1.1325 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man0/Makefile diff -u src/share/man/man0/Makefile:1.17 src/share/man/man0/Makefile:1.18 --- src/share/man/man0/Makefile:1.17 Tue Feb 7 19:13:31 2012 +++ src/share/man/man0/Makefile Mon May 22 12:55:44 2023 @@ -1,7 +1,9 @@ # from: @(#)Makefile 5.9 (Berkeley) 7/1/91 -# $NetBSD: Makefile,v 1.17 2012/02/07 19:13:31 joerg Exp $ +# $NetBSD: Makefile,v 1.18 2023/05/22 12:55:44 lukem Exp $ -NOOBJ= # defined +# +# Note: Needs ps2pdf to convert .ps to .pdf +# .include <bsd.own.mk> @@ -10,63 +12,97 @@ FILES= makewhatis.sed FILESDIR= /usr/share/man .endif -CLEANFILES+= man? -CLEANFILES+= man?pages.tmp -CLEANFILES+= man?pages.ps -CLEANFILES+= man?pages.pdf -CLEANFILES+= toc? tocx? - SECTIONS?= 1 2 3 4 5 6 7 8 9 +MANSRCDIRS= "${.CURDIR}/../../.." ../../.. + # Takes out some fluff from the PostScript files created by # grops which does some VM saving/restoring that bloats the # PDF file pdf2ps generates. By u...@netbsd.org. OPTIMIZE_PDF?= \ - -e '/^\/level0 0 def/d' \ - -e '/^\/level0 save/d' \ - -e '/^level0 restore/d' - -all: man man.ps man.pdf - -man: - ${HOST_SH} mkman - -man.ps: - for i in ${SECTIONS} ; \ - do \ - for f in `grep "$${i}\$$" intros` `cat man$${i}` ; \ - do \ - if [ ! -f $${f} ]; then \ - continue ; \ - fi ; \ - if grep -q ^\\.TS back ; \ - then \ - echo >&2 $${f} ; \ - cat $${f} | tbl | troff -msafer -man -Tps ; \ - else \ - echo >&2 $${f} "(tbl)" ; \ - cat $${f} | troff -msafer -man -Tps ; \ - fi ; \ - done >man$${i}pages.tmp ; \ - cat man$${i}pages.tmp \ - | grep -v '^x stop' \ - | grops >man$${i}pages.ps ; \ - rm man$${i}pages.tmp ; \ - done - -man.pdf: - for i in ${SECTIONS} ; \ - do \ - echo Chewing on man$${i}pages.pdf ; \ - ${TOOL_SED} \ - ${OPTIMIZE_PDF} \ - <man$${i}pages.ps >man$${i}pages.ps.tmp ; \ - ps2pdf man$${i}pages.ps.tmp man$${i}pages.pdf ; \ - rm man$${i}pages.ps.tmp ; \ - done + -e '/^\/level0 0 def/d' \ + -e '/^\/level0 save/d' \ + -e '/^level0 restore/d' + +MAN0SRCS= +.if ${MKMAN} != "no" +MAN0SRCS+= all.files +MAN0SRCS+= ${SECTIONS:@S@man${S}pages.files@} +MAN0SRCS+= ${SECTIONS:@S@man${S}pages.ps @} +MAN0SRCS+= ${SECTIONS:@S@man${S}pages.pdf@} +.endif + +CLEANFILES+= ${MAN0SRCS} +CLEANFILES+= *.tmp +CLEANFILES+= toc? tocx? + +all: ${MAN0SRCS} + +all.files: + ${_MKTARGET_CREATE} + find ${MANSRCDIRS} -name '*.[1-9]' -print \ + | xargs ${TOOL_MKMAGIC} \ + | ${TOOL_GREP} troff \ + | ${TOOL_SED} 's/:[ ]*.*$$//' \ + | ${TOOL_GREP} -F -v -f "${.CURDIR}/noman" \ + | ${TOOL_GREP} -v '#' \ + | ${TOOL_GREP} -v '/obj\.' \ + | ${TOOL_GREP} -v '/destdir\.' \ + | ${TOOL_GREP} -v '/tooldir\.' \ + > ${.TARGET}.tmp \ + && ${MV} ${.TARGET}.tmp ${.TARGET} ; \ + rm -f ${.TARGET}.tmp + + +.for _S in ${SECTIONS} + +man${_S}pages.files: all.files + ${_MKTARGET_CREATE} + cat ${.ALLSRC} \ + | ${TOOL_GREP} "${_S}\$$" \ + | ${TOOL_SED} 's,\(.*/\)\([^/]*\),\2 \1\2,' \ + | sort \ + | ${TOOL_SED} 's/^.* //' \ + > ${.TARGET}.tmp \ + && ${MV} ${.TARGET}.tmp ${.TARGET} ; \ + rm -f ${.TARGET}.tmp + +man${_S}pages.ps: man${_S}pages.files + ${_MKTARGET_CREATE} + for f in `${TOOL_GREP} "${_S}\$$" "${.CURDIR}/intros"` `cat ${.ALLSRC}` ; \ + do \ + if [ ! -f $${f} ]; then \ + continue ; \ + fi ; \ + if ${TOOL_GREP} -q ^\\.TS "${.CURDIR}/back" ; \ + then \ + ${_MKSHMSG_FORMAT} >&2 $${f} ; \ + cat $${f} | ${TOOL_TBL} | ${TOOL_GROFF} -Z -msafer -man -Tps ; \ + else \ + ${_MKSHMSG_FORMAT} >&2 $${f} "(tbl)"; \ + cat $${f} | ${TOOL_GROFF} -Z -msafer -man -Tps ; \ + fi ; \ + done > ${.TARGET}.troff.tmp \ + && cat ${.TARGET}.troff.tmp \ + | ${TOOL_GREP} -v '^x stop' \ + | ${TOOL_GROPS} \ + > ${.TARGET}.tmp \ + && ${MV} ${.TARGET}.tmp ${.TARGET} ; \ + rm -f ${.TARGET}.tmp ${.TARGET}.troff.tmp + +man${_S}pages.pdf: man${_S}pages.ps + ${_MKTARGET_CREATE} + cat ${.ALLSRC} \ + | ${TOOL_SED} ${OPTIMIZE_PDF} \ + | ps2pdf - - \ + > ${.TARGET}.tmp \ + && ${MV} ${.TARGET}.tmp ${.TARGET} ; \ + rm -f ${.TARGET}.tmp + +.endfor man.tgz: tar plzvcf manpages-ps.tgz man?pages.ps tar plzvcf manpages-pdf.tgz man?pages.pdf -.include <bsd.prog.mk> +.include <bsd.files.mk> Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1324 src/share/mk/bsd.own.mk:1.1325 --- src/share/mk/bsd.own.mk:1.1324 Mon May 15 16:12:39 2023 +++ src/share/mk/bsd.own.mk Mon May 22 12:55:45 2023 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1324 2023/05/15 16:12:39 christos Exp $ +# $NetBSD: bsd.own.mk,v 1.1325 2023/05/22 12:55:45 lukem Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -454,6 +454,7 @@ TOOL_GROFF_ENV= \ GROFF_FONT_PATH=${GROFF_SHARE_PATH}/site-font:${GROFF_SHARE_PATH}/font \ GROFF_TMAC_PATH=${GROFF_SHARE_PATH}/site-tmac:${GROFF_SHARE_PATH}/tmac TOOL_GROFF= ${TOOL_GROFF_ENV} ${TOOLDIR}/bin/${_TOOL_PREFIX}groff ${GROFF_FLAGS} +TOOL_GROPS= ${TOOL_GROFF_ENV} ${TOOLDIR}/lib/groff/grops TOOL_HEXDUMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}hexdump TOOL_HP300MKBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}hp300-mkboot @@ -571,6 +572,7 @@ TOOL_GMAKE= gmake TOOL_GPT= gpt TOOL_GREP= grep TOOL_GROFF= groff +TOOL_GROPS= grops TOOL_HEXDUMP= hexdump TOOL_HP300MKBOOT= hp300-mkboot TOOL_HPPAMKBOOT= hppa-mkboot @@ -1741,6 +1743,7 @@ _MKMSG_REMOVE?= ${_MKMSG} " remove " _MKMSG_YACC?= ${_MKMSG} " yacc " _MKSHMSG_CREATE?= ${_MKSHMSG} " create " +_MKSHMSG_FORMAT?= ${_MKSHMSG} " format " _MKSHMSG_INSTALL?= ${_MKSHMSG} "install " _MKTARGET_BUILD?= ${_MKMSG_BUILD} ${.CURDIR:T}/${.TARGET}