1292068Ssjg# $Id: rst2htm.mk,v 1.10 2015/09/08 22:17:46 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 25276305SngieRST2PDF ?= rst2pdf 26246149SsjgRST2S5 ?= rst2s5.py 27246149Ssjg# the following will run RST2S5 if the target name contains the word 'slides' 28246149Ssjg# otherwise it uses RST2HTML 29292068SsjgRST2HTM = ${"${.TARGET:T:M*slides*}":?${RST2S5}:${RST2HTML}} 30292068SsjgRST2HTM_SLIDES_FLAGS ?= ${RST2S5_FLAGS} 31292068SsjgRST2HTM_DOC_FLAGS ?= ${RST2HTML_FLAGS} 32292068SsjgRST2HTM_FLAGS ?= ${"${.TARGET:T:M*slides*}":?${RST2HTM_SLIDES_FLAGS}:${RST2HTM_DOC_FLAGS}} 33246149Ssjg 34292068SsjgRST2PDF_FLAGS ?= ${"${.TARGET:T:M*slides*}":?${RST2PDF_SLIDES_FLAGS}:${RST2PDF_DOC_FLAGS}} 35292068Ssjg 36246149SsjgRST_SUFFIXES ?= .rst .txt 37246149Ssjg 38246149SsjgCLEANFILES += ${HTMFILES} 39246149Ssjg 40246149Ssjghtml: ${HTMFILES} 41246149Ssjg 42276305Sngie.SUFFIXES: ${RST_SUFFIXES} .htm .pdf 43246149Ssjg 44246149Ssjg${RST_SUFFIXES:@s@$s.htm@}: 45292068Ssjg ${RST2HTM} ${RST2HTM_FLAGS} ${FLAGS.${.TARGET}} ${.IMPSRC} ${.TARGET} 46246149Ssjg 47276305Sngie${RST_SUFFIXES:@s@$s.pdf@}: 48292068Ssjg ${RST2PDF} ${RST2PDF_FLAGS} ${FLAGS.${.TARGET}} ${.IMPSRC} ${.TARGET} 49276305Sngie 50246149Ssjg.for s in ${RSTSRCS:O:u} 51246149Ssjg${s:R:T}.htm: $s 52276305Sngie${s:R:T}.pdf: $s 53246149Ssjg.endfor 54