1246149Ssjg# $Id: rst2htm.mk,v 1.8 2011/04/03 21:39:25 sjg Exp $
2246149Ssjg#
3246149Ssjg#	@(#) Copyright (c) 2009, Simon J. Gerraty
4246149Ssjg#
5246149Ssjg#	This file is provided in the hope that it will
6246149Ssjg#	be of use.  There is absolutely NO WARRANTY.
7246149Ssjg#	Permission to copy, redistribute or otherwise
8246149Ssjg#	use this file is hereby granted provided that 
9246149Ssjg#	the above copyright notice and this notice are
10246149Ssjg#	left intact. 
11246149Ssjg#      
12246149Ssjg#	Please send copies of changes and bug-fixes to:
13246149Ssjg#	sjg@crufty.net
14246149Ssjg#
15246149Ssjg
16246149Ssjg# convert reStructuredText to HTML, using rst2html.py from
17246149Ssjg# docutils - http://docutils.sourceforge.net/
18246149Ssjg
19246149Ssjg.if empty(TXTSRCS)
20246149SsjgTXTSRCS != 'ls' -1t ${.CURDIR}/*.txt ${.CURDIR}/*.rst 2>/dev/null; echo
21246149Ssjg.endif
22246149SsjgRSTSRCS ?= ${TXTSRCS}
23246149SsjgHTMFILES ?= ${RSTSRCS:R:T:O:u:%=%.htm}
24246149SsjgRST2HTML ?= rst2html.py
25246149SsjgRST2S5 ?= rst2s5.py
26246149Ssjg# the following will run RST2S5 if the target name contains the word 'slides'
27246149Ssjg# otherwise it uses RST2HTML
28246149SsjgRST2HTM = ${"${.TARGET:T:M*slides*}":?${RST2S5} ${RST2S5_FLAGS}:${RST2HTML} ${RST2HTML_FLAGS}}
29246149Ssjg
30246149SsjgRST_SUFFIXES ?= .rst .txt
31246149Ssjg
32246149SsjgCLEANFILES += ${HTMFILES}
33246149Ssjg
34246149Ssjghtml:	${HTMFILES}
35246149Ssjg
36246149Ssjg.SUFFIXES: ${RST_SUFFIXES} .htm
37246149Ssjg
38246149Ssjg${RST_SUFFIXES:@s@$s.htm@}:
39246149Ssjg	${RST2HTM} ${.IMPSRC} ${.TARGET}
40246149Ssjg
41246149Ssjg.for s in ${RSTSRCS:O:u}
42246149Ssjg${s:R:T}.htm: $s
43246149Ssjg.endfor
44