1*6eef5f0cSAntonio Huete Jimenez# $Id: rst2htm.mk,v 1.12 2021/05/26 04:20:31 sjg Exp $ 25f1e34d9SAlexandre Perrin# 35f1e34d9SAlexandre Perrin# @(#) Copyright (c) 2009, Simon J. Gerraty 45f1e34d9SAlexandre Perrin# 55f1e34d9SAlexandre Perrin# This file is provided in the hope that it will 65f1e34d9SAlexandre Perrin# be of use. There is absolutely NO WARRANTY. 75f1e34d9SAlexandre Perrin# Permission to copy, redistribute or otherwise 85f1e34d9SAlexandre Perrin# use this file is hereby granted provided that 95f1e34d9SAlexandre Perrin# the above copyright notice and this notice are 105f1e34d9SAlexandre Perrin# left intact. 115f1e34d9SAlexandre Perrin# 125f1e34d9SAlexandre Perrin# Please send copies of changes and bug-fixes to: 135f1e34d9SAlexandre Perrin# sjg@crufty.net 145f1e34d9SAlexandre Perrin# 155f1e34d9SAlexandre Perrin 165f1e34d9SAlexandre Perrin# convert reStructuredText to HTML, using rst2html.py from 175f1e34d9SAlexandre Perrin# docutils - http://docutils.sourceforge.net/ 185f1e34d9SAlexandre Perrin 195f1e34d9SAlexandre Perrin.if empty(TXTSRCS) 205f1e34d9SAlexandre PerrinTXTSRCS != 'ls' -1t ${.CURDIR}/*.txt ${.CURDIR}/*.rst 2>/dev/null; echo 215f1e34d9SAlexandre Perrin.endif 225f1e34d9SAlexandre PerrinRSTSRCS ?= ${TXTSRCS} 235f1e34d9SAlexandre PerrinHTMFILES ?= ${RSTSRCS:R:T:O:u:%=%.htm} 24*6eef5f0cSAntonio Huete Jimenez# can be empty, 4 or 5 25*6eef5f0cSAntonio Huete JimenezHTML_VERSION ?= 26*6eef5f0cSAntonio Huete JimenezRST2HTML ?= rst2html${HTML_VERSION}.py 276a91b982SJohn MarinoRST2PDF ?= rst2pdf 285f1e34d9SAlexandre PerrinRST2S5 ?= rst2s5.py 295f1e34d9SAlexandre Perrin# the following will run RST2S5 if the target name contains the word 'slides' 305f1e34d9SAlexandre Perrin# otherwise it uses RST2HTML 31f445c897SJohn MarinoRST2HTM = ${"${.TARGET:T:M*slides*}":?${RST2S5}:${RST2HTML}} 32f445c897SJohn MarinoRST2HTM_SLIDES_FLAGS ?= ${RST2S5_FLAGS} 33f445c897SJohn MarinoRST2HTM_DOC_FLAGS ?= ${RST2HTML_FLAGS} 34f445c897SJohn MarinoRST2HTM_FLAGS ?= ${"${.TARGET:T:M*slides*}":?${RST2HTM_SLIDES_FLAGS}:${RST2HTM_DOC_FLAGS}} 35f445c897SJohn Marino 36f445c897SJohn MarinoRST2PDF_FLAGS ?= ${"${.TARGET:T:M*slides*}":?${RST2PDF_SLIDES_FLAGS}:${RST2PDF_DOC_FLAGS}} 375f1e34d9SAlexandre Perrin 385f1e34d9SAlexandre PerrinRST_SUFFIXES ?= .rst .txt 395f1e34d9SAlexandre Perrin 405f1e34d9SAlexandre PerrinCLEANFILES += ${HTMFILES} 415f1e34d9SAlexandre Perrin 425f1e34d9SAlexandre Perrinhtml: ${HTMFILES} 435f1e34d9SAlexandre Perrin 446a91b982SJohn Marino.SUFFIXES: ${RST_SUFFIXES} .htm .pdf 455f1e34d9SAlexandre Perrin 465f1e34d9SAlexandre Perrin${RST_SUFFIXES:@s@$s.htm@}: 47f445c897SJohn Marino ${RST2HTM} ${RST2HTM_FLAGS} ${FLAGS.${.TARGET}} ${.IMPSRC} ${.TARGET} 485f1e34d9SAlexandre Perrin 496a91b982SJohn Marino${RST_SUFFIXES:@s@$s.pdf@}: 50f445c897SJohn Marino ${RST2PDF} ${RST2PDF_FLAGS} ${FLAGS.${.TARGET}} ${.IMPSRC} ${.TARGET} 516a91b982SJohn Marino 525f1e34d9SAlexandre Perrin.for s in ${RSTSRCS:O:u} 535f1e34d9SAlexandre Perrin${s:R:T}.htm: $s 546a91b982SJohn Marino${s:R:T}.pdf: $s 555f1e34d9SAlexandre Perrin.endfor 56