]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/bmake/mk/rst2htm.mk
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / bmake / mk / rst2htm.mk
1 # $Id: rst2htm.mk,v 1.9 2014/02/22 01:52:41 sjg Exp $
2 #
3 #       @(#) Copyright (c) 2009, Simon J. Gerraty
4 #
5 #       This file is provided in the hope that it will
6 #       be of use.  There is absolutely NO WARRANTY.
7 #       Permission to copy, redistribute or otherwise
8 #       use this file is hereby granted provided that 
9 #       the above copyright notice and this notice are
10 #       left intact. 
11 #      
12 #       Please send copies of changes and bug-fixes to:
13 #       sjg@crufty.net
14 #
15
16 # convert reStructuredText to HTML, using rst2html.py from
17 # docutils - http://docutils.sourceforge.net/
18
19 .if empty(TXTSRCS)
20 TXTSRCS != 'ls' -1t ${.CURDIR}/*.txt ${.CURDIR}/*.rst 2>/dev/null; echo
21 .endif
22 RSTSRCS ?= ${TXTSRCS}
23 HTMFILES ?= ${RSTSRCS:R:T:O:u:%=%.htm}
24 RST2HTML ?= rst2html.py
25 RST2PDF ?= rst2pdf
26 RST2S5 ?= rst2s5.py
27 # the following will run RST2S5 if the target name contains the word 'slides'
28 # otherwise it uses RST2HTML
29 RST2HTM = ${"${.TARGET:T:M*slides*}":?${RST2S5} ${RST2S5_FLAGS}:${RST2HTML} ${RST2HTML_FLAGS}}
30
31 RST_SUFFIXES ?= .rst .txt
32
33 CLEANFILES += ${HTMFILES}
34
35 html:   ${HTMFILES}
36
37 .SUFFIXES: ${RST_SUFFIXES} .htm .pdf
38
39 ${RST_SUFFIXES:@s@$s.htm@}:
40         ${RST2HTM} ${.IMPSRC} ${.TARGET}
41
42 ${RST_SUFFIXES:@s@$s.pdf@}:
43         ${RST2PDF} ${.IMPSRC} ${.TARGET}
44
45 .for s in ${RSTSRCS:O:u}
46 ${s:R:T}.htm: $s
47 ${s:R:T}.pdf: $s
48 .endfor