# Produce Various Output Formats From A Restructured Text Source Document
# $Id: makefile,v 1.102 2013/03/25 19:27:08 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 #
########################################################################
###
# Document Production
###
# RST Filter And Needed Program Locations
# Some Docutils installations keep the ".py" suffix for the various
# frontend programs, and some do not. It's even possible there are
# links from one to the other. Since the project can be checked out
# on any platform, we have to check for this every time we run the
# 'make'. This is irritating.
2HTML = $(shell which rst2html.py rst2html | tr '\012' ' ' | awk '{print $$1}')
2LATEX = $(shell which rst2latex.py rst2latex | tr '\012' ' ' | awk '{print $$1}') --stylesheet=parskip --latex-preamble="\usepackage{fullpage}"
2ODT = $(shell which rst2odt.py rst2odt | tr '\012' ' ' | awk '{print $$1}')
2MAN = $(shell which rst2man.py rst2man | tr '\012' ' ' | awk '{print $$1}')
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} $*.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