Return to Makefile.inc CVS log | Up to [cvsweb.bsd.lv] / pod2mdoc / Regress |
File: [cvsweb.bsd.lv] / pod2mdoc / Regress / Makefile.inc (download)
Revision 1.2, Fri Jul 18 05:09:33 2014 UTC (10 years, 2 months ago) by schwarze
Proper translation of POD escape sequences into mdoc macros, including correct whitespace handling. This is surprisingly hard to get right. The main idea is to not write Ns at the end of formatcode(), but instead clear the wantws state and let the caller parse ahead (in the manner required by the context) to see what is following, then break the line or print Ns as appropriate. Also use the following logic throughout: * Clear wantws after writing a non-whitespace character. * Switch to text state after flushing text output. * Switch back to OUST_NL/wantws after a line break. |
# --- utilities --- POD2MAN = pod2man -c 'OpenBSD Reference Manual' -d 'July 13, 2014' -r 'OpenBSD ports' GROFF = groff -Tascii -P -c MANDOC = mandoc -Tascii DIFF = diff -u POD2MDOC = /co/pod2mdoc/pod2mdoc -d 'July 13, 2014' # --- lists --- PREMANS = ${TARGETS:S/$/.preman/} MANS = ${TARGETS:S/$/.man/} GROFFMANS = ${TARGETS:S/$/.groff_man/} MANDOCMANS = ${TARGETS:S/$/.mandoc_man/} MANDOCMANMS = ${TARGETS:S/$/.mandoc_manm/} DIFFMANS = ${TARGETS:S/$/.diff_man/} MDOCS = ${TARGETS:S/$/.mdoc/} GROFFMDOCS = ${TARGETS:S/$/.groff_mdoc/} MANDOCMDOCS = ${TARGETS:S/$/.mandoc_mdoc/} DIFFMDOCS = ${TARGETS:S/$/.diff_mdoc/} DIFFS = ${TARGETS:S/$/.diff/} # --- production targets --- all: manall mdoc groffmdoc mandocmdoc diffmdoc maindiff clean: mdoc-clean groffmdoc-clean mandocmdoc-clean rm -f *.part *.core mdoc: ${MDOCS} mdoc-clean: rm -f ${MDOCS} groffmdoc: ${GROFFMDOCS} groffmdoc-clean: rm -f ${GROFFMDOCS} mandocmdoc: ${MANDOCMDOCS} mandocmdoc-clean: rm -f ${MANDOCMDOCS} diffmdoc: ${DIFFMDOCS} maindiff: ${DIFFS} # --- maintainer targets --- manall: man groffman mandocman mandocmanm diffman allclean: clean preman-clean man-clean \ groffman-clean mandocman-clean mandocmanm-clean preman: ${PREMANS} preman-clean: rm -f ${PREMANS} man: ${MANS} man-clean: rm -f ${MANS} groffman: ${GROFFMANS} groffman-clean: rm -f ${GROFFMANS} mandocman: ${MANDOCMANS} mandocman-clean: rm -f ${MANDOCMANS} mandocmanm: ${MANDOCMANMS} mandocmanm-clean: rm -f ${MANDOCMANMS} diffman: ${DIFFMANS} .for t in ${TARGETS} ${t}.diff_man: ${t}.groff_man ${t}.mandoc_man ${DIFF} $? ${t}.diff_mdoc: ${t}.groff_mdoc ${t}.mandoc_mdoc ${DIFF} $? ${t}.diff: ${t}.mandoc_manm ${t}.mandoc_mdoc ${DIFF} $? ${t}:${t}.diff .endfor # --- suffix rules --- .SUFFIXES: .pod .preman .man .groff_man .mandoc_man .mandoc_manm .diff_man .SUFFIXES: .mdoc .groff_mdoc .mandoc_mdoc .pod.preman: -${POD2MAN} $< > $@ .preman.man: ../p2m_postproc.pl < $< > $@.part @mv $@.part $@ .man.groff_man: ${GROFF} -man $< > $@.part @mv $@.part $@ .man.mandoc_man: ${MANDOC} -man $< > $@.part @mv $@.part $@ .man.mandoc_manm: ${MANDOC} -man -Omdoc $< > $@.part @mv $@.part $@ .pod.mdoc: ${POD2MDOC} $< > $@.part @mv $@.part $@ .mdoc.groff_mdoc: ${GROFF} -mdoc $< > $@.part @mv $@.part $@ .mdoc.mandoc_mdoc: ${MANDOC} -mdoc -Ios='OpenBSD ports' $< > $@.part @mv $@.part $@