Newer
Older
reStructuredText / makefile
@tundra tundra on 5 Feb 2013 1 KB Initial revision
# Produce Various Output Formats From A Restructured Text Source Document
# $Id: makefile,v 1.1 2013/02/05 18:59:26 tundra Exp $


#####
# Setup The Project Here
#####

# PROJECT  = NAMEOFPROJECT
# This is setup in the makefile that includes us

# List all the output files

1:     ${PROJECT}.1

dvi:   ${PROJECT}.dvi

html:  ${PROJECT}.html

latex: ${PROJECT}.latex

odt:   ${PROJECT}.odt

pdf:   ${PROJECT}.pdf

ps:    ${PROJECT}.ps

txt:   ${PROJECT}.txt


#####
# Things That May Have To Be Changed, Depending On System
#####


########################################################################
#          Nothing Below This Line Should Need To Be Changed           #
########################################################################



# RST Filter And Needed Program Locations

2HTML    = rst2html.py
2LATEX   = rst2latex.py --stylesheet=parskip
2ODT     = rst2odt.py
2MAN     = rst2man.py

DVIPS    = dvips
PDFLATEX = pdflatex
LATEX    = latex
NROFF    = nroff -c -man

# File Types

CLEAN    = .aux .log .out \~
DOCFILES = .1 .dvi .html .latex .odt .pdf .ps .txt

# Conversion Rules

%.dvi : %.latex
	${LATEX} $*.latex 
	${LATEX} $*.latex 

%.html : %.rst
	${2HTML} <$*.rst >$*.html

%.latex : %.rst
	${2LATEX} --latex-preamble="\usepackage{fullpage}" $*.rst >$*.latex

%.1 : %.rst
	${2MAN} <$*.rst >$*.1

%.odt : %.rst
	${2ODT} <$*.rst >$*.odt

%.pdf : %.latex
	${PDFLATEX} $*.latex

%.ps : %.dvi
	${DVIPS} $*.dvi

%.txt : %.1
	${NROFF} $*.1 >$*.txt


#####
# Packaging
#####

all: 1 dvi html latex odt pdf ps

pkg: all clean
	tar -czvf ${PROJECT}-docs.tar.gz ${PROJECT}.*


#####
# Cleanup stanzas
#####

clean:
	-@for type in ${CLEAN};\
     do\
         rm -v *$$type;\
     done

scrub: clean
	-@for type in ${DOCFILES};\
     do\
         rm -v *$$type;\
     done