2020-09-05 16:11:04 +00:00
|
|
|
# $Id: rst2htm.mk,v 1.11 2020/08/19 17:51:53 sjg Exp $
|
2013-01-31 16:44:23 +00:00
|
|
|
#
|
|
|
|
# @(#) Copyright (c) 2009, Simon J. Gerraty
|
|
|
|
#
|
|
|
|
# This file is provided in the hope that it will
|
|
|
|
# be of use. There is absolutely NO WARRANTY.
|
|
|
|
# Permission to copy, redistribute or otherwise
|
2020-09-05 16:11:04 +00:00
|
|
|
# use this file is hereby granted provided that
|
2013-01-31 16:44:23 +00:00
|
|
|
# the above copyright notice and this notice are
|
2020-09-05 16:11:04 +00:00
|
|
|
# left intact.
|
|
|
|
#
|
2013-01-31 16:44:23 +00:00
|
|
|
# Please send copies of changes and bug-fixes to:
|
|
|
|
# sjg@crufty.net
|
|
|
|
#
|
|
|
|
|
|
|
|
# convert reStructuredText to HTML, using rst2html.py from
|
|
|
|
# docutils - http://docutils.sourceforge.net/
|
|
|
|
|
|
|
|
.if empty(TXTSRCS)
|
|
|
|
TXTSRCS != 'ls' -1t ${.CURDIR}/*.txt ${.CURDIR}/*.rst 2>/dev/null; echo
|
|
|
|
.endif
|
|
|
|
RSTSRCS ?= ${TXTSRCS}
|
|
|
|
HTMFILES ?= ${RSTSRCS:R:T:O:u:%=%.htm}
|
|
|
|
RST2HTML ?= rst2html.py
|
2014-07-02 21:24:54 +00:00
|
|
|
RST2PDF ?= rst2pdf
|
2013-01-31 16:44:23 +00:00
|
|
|
RST2S5 ?= rst2s5.py
|
|
|
|
# the following will run RST2S5 if the target name contains the word 'slides'
|
|
|
|
# otherwise it uses RST2HTML
|
2015-10-21 22:14:23 +00:00
|
|
|
RST2HTM = ${"${.TARGET:T:M*slides*}":?${RST2S5}:${RST2HTML}}
|
|
|
|
RST2HTM_SLIDES_FLAGS ?= ${RST2S5_FLAGS}
|
|
|
|
RST2HTM_DOC_FLAGS ?= ${RST2HTML_FLAGS}
|
|
|
|
RST2HTM_FLAGS ?= ${"${.TARGET:T:M*slides*}":?${RST2HTM_SLIDES_FLAGS}:${RST2HTM_DOC_FLAGS}}
|
|
|
|
|
|
|
|
RST2PDF_FLAGS ?= ${"${.TARGET:T:M*slides*}":?${RST2PDF_SLIDES_FLAGS}:${RST2PDF_DOC_FLAGS}}
|
2013-01-31 16:44:23 +00:00
|
|
|
|
|
|
|
RST_SUFFIXES ?= .rst .txt
|
|
|
|
|
|
|
|
CLEANFILES += ${HTMFILES}
|
|
|
|
|
|
|
|
html: ${HTMFILES}
|
|
|
|
|
2014-07-02 21:24:54 +00:00
|
|
|
.SUFFIXES: ${RST_SUFFIXES} .htm .pdf
|
2013-01-31 16:44:23 +00:00
|
|
|
|
|
|
|
${RST_SUFFIXES:@s@$s.htm@}:
|
2015-10-21 22:14:23 +00:00
|
|
|
${RST2HTM} ${RST2HTM_FLAGS} ${FLAGS.${.TARGET}} ${.IMPSRC} ${.TARGET}
|
2013-01-31 16:44:23 +00:00
|
|
|
|
2014-07-02 21:24:54 +00:00
|
|
|
${RST_SUFFIXES:@s@$s.pdf@}:
|
2015-10-21 22:14:23 +00:00
|
|
|
${RST2PDF} ${RST2PDF_FLAGS} ${FLAGS.${.TARGET}} ${.IMPSRC} ${.TARGET}
|
2014-07-02 21:24:54 +00:00
|
|
|
|
2013-01-31 16:44:23 +00:00
|
|
|
.for s in ${RSTSRCS:O:u}
|
|
|
|
${s:R:T}.htm: $s
|
2014-07-02 21:24:54 +00:00
|
|
|
${s:R:T}.pdf: $s
|
2013-01-31 16:44:23 +00:00
|
|
|
.endfor
|