tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Optional mandoc(1) usage



Hi all,
the attached patch adds two triggers to select mandoc(1) as prefered man
page render. USEMANDOC enables the general use, e.g. makes it being
built as tool and used for all man pages where it has a chance to work.
Man pages can be individually selected as not supported with setting
NOMANDOC (per directory) or NOMANDOC.${manpage}=yes. Man pages using
tbl(1) are currently always processed with groff.

The tools part is conditional as I want to have some input on building
it on various platforms first. I expect some minor issues in that
department -- test results are welcome.

USEMANDOC should be considered as temporary bandaid for that purpose.
The lint mode is also not integrated yet, suggestions for a good flag to
disable? NOMANDOCLINT?

Joerg
Index: tools/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/src/tools/Makefile,v
retrieving revision 1.127
diff -u -p -r1.127 Makefile
--- tools/Makefile      25 Feb 2009 22:28:36 -0000      1.127
+++ tools/Makefile      13 Oct 2009 19:21:30 -0000
@@ -55,6 +55,9 @@ SUBDIR=       host-mkdep .WAIT compat .WAIT \
 
 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
 SUBDIR+=       groff
+.  if defined(USEMANDOC)
+SUBDIR+=       mandoc
+.  endif
 .endif
 
 .if ${MKMAINTAINERTOOLS:Uno} != "no"
Index: share/mk/bsd.man.mk
===================================================================
RCS file: /home/joerg/repo/netbsd/src/share/mk/bsd.man.mk,v
retrieving revision 1.100
diff -u -p -r1.100 bsd.man.mk
--- share/mk/bsd.man.mk 10 Apr 2009 16:16:12 -0000      1.100
+++ share/mk/bsd.man.mk 13 Oct 2009 21:32:22 -0000
@@ -131,6 +131,14 @@ ${_MNUMBERS:@N@.$N.cat$N${MANSUFFIX}@}: 
 .if defined(USETBL)
        ${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_ASCII} -mandoc ${MANCOMPRESS} \
            > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
+.elif defined(USEMANDOC) && !defined(NOMANDOC)
+       if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \
+               ${TOOL_MANDOC_ASCII} ${.IMPSRC} ${MANCOMPRESS} \
+                   > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \
+       else \
+               ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \
+                   > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \
+       fi
 .else
        ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \
            > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
@@ -188,8 +196,18 @@ realall:   ${HTMLPAGES}
 
 ${_MNUMBERS:@N@.$N.html$N@}: ${HTMLDEPS}                       # build rule
        ${_MKTARGET_FORMAT}
+.if defined(USEMANDOC) && !defined(NOMANDOC)
+       if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \
+               ${TOOL_MANDOC_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
+                   mv ${.TARGET}.tmp ${.TARGET}; \
+       else \
+               ${TOOL_ROFF_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
+                   mv ${.TARGET}.tmp ${.TARGET}; \
+       fi
+.else
        ${TOOL_ROFF_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
            mv ${.TARGET}.tmp ${.TARGET}
+.endif
 
 .for F in ${HTMLPAGES:O:u}
 # construct installed path


Home | Main Index | Thread Index | Old Index