diff --git a/makefile b/makefile index e29619b..1dbf178 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,7 @@ # Build a release of 'tsshbatch' using 'make' -# $Id: makefile,v 1.100 2011/06/17 17:02:16 tundra Exp $ +# $Id: makefile,v 1.101 2012/06/09 02:27:10 tundra Exp $ # Requires a modern 'make' like GNU. - # Uncomment One Of The Following For Early Releases #EARLY = Alpha @@ -14,16 +13,21 @@ ##### PROGNAME = tsshbatch +PROGMAIN = tsshbatch.py -PORTNAME = ${PROGNAME} +PROGFILES = ${PROGMAIN} +PROGDOCS = ${PROGMAIN}.ps -PROGFILES = ${PROGNAME}.py - -DOCSOURCES = ${PROGNAME}.rst ${PROGNAME}-license.txt CHANGELOG.txt Makefile \ - WHATSNEW.txt setup.py - -DOCFILES = ${PROGNAME}.html ${PROGNAME}.pdf ${PROGNAME}.ps ${PROGNAME}.py.ps \ - ${PROGNAME}.1.gz +DOCS = tsshbatch-license.txt \ + ${PROGNAME}.1.gz \ + ${PROGNAME}.html \ + ${PROGNAME}.pdf \ + ${PROGNAME}.ps \ + ${PROGNAME}.rst \ + ${PROGNAME}.txt \ + CHANGELOG.txt \ + Makefile \ + setup.py \ ##### @@ -31,12 +35,13 @@ ##### -DIR = ${PORTNAME}-${VERSION} +DIR = ${PROGNAME}-${VERSION} HEADER1 = "WHATSNEW For '${PROGNAME}' ${VERSION} (`date`)" HEADER2 = "----------------------------------------------------------------------" +RELEASES = "Releases" TARBALL = ${DIR}.tar.gz TMPFILE = tmpfile -VERSION = $(shell rlog -v ${PROGNAME}.py | cut -f 2 -d " ")${EARLY} +VERSION = $(shell cvs log ${PROGMAIN} | grep ^head\: | cut -f2 -d " ")${EARLY} ##### @@ -44,69 +49,66 @@ ##### ### -# Old Rules +# Document Production ### -# %.1.gz: %.1 -# @gzip $< +# 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. -# %.1: %.txt -# @cp $< $@ +2HTML = $(shell which rst2html.py rst2html 2>/dev/null | head -n 1) +2LATEX = $(shell which rst2latex.py rst2latex 2>/dev/null | head -n 1) --stylesheet=parskip +2ODT = $(shell which rst2odt.py rst2odt 2>/dev/null | head -n 1) +2MAN = $(shell which rst2man.py rst2man 2>/dev/null | head -n 1) -# %.txt: %.1 -# @groff -man -Tascii $< | col -xb >$@ +# TeX/LaTeX Processing -# %.html: %.1 -# @manserver $< >$@ +DVIPS = dvips +PDFLATEX = pdflatex +LATEX = latex -#%.dvi: %.latex -# latex $< +%.dvi : %.latex + ${LATEX} $*.latex -#%.ps: %.1 -# @groff -man -Tps $< >$@ +%.html : %.rst + ${2HTML} <$*.rst >$*.html -#%.1: %.rst -# @rst2man.py $< >$@ +%.latex : %.rst + ${2LATEX} $*.rst >$*.latex - -### -# Man & html Output -### - -%.html: %.rst - @rst2html $< >$@ - -%.1: %.html - @w3m -dump $< >$@ +%.1 : %.rst + ${2MAN} <$*.rst >$*.1 %.1.gz: %.1 - @gzip $< + @gzip -c <$*.1 >$*.1.gz +%.odt : %.rst + ${2ODT} <$*.rst >$*.odt -### -# LaTeX, PostScript, & PDF Output -### +%.pdf : %.latex + ${PDFLATEX} $*.latex + ${PDFLATEX} $*.latex + ${PDFLATEX} $*.latex -%.latex: %.rst - rst2latex --stylesheet=parskip $< >$@ +%.ps : %.dvi + ${DVIPS} $*.dvi -%.pdf: %.latex - @pdflatex $< $@ - @pdflatex $< $@ - @pdflatex $< $@ - -%.ps: %.pdf - @pdftops $< >$@ - +%.txt: %.1 + @groff -man -Tascii $< | col -xb >$@ ### # Pretty Print Programs & Scripts ### +%.pl.ps: %.pl + @enscript -Eperl --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $< + %.py.ps: %.py @enscript -Epython --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $< -%.sh.ps: % +%.sh.ps: %.sh @enscript -Esh --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $< @@ -114,36 +116,43 @@ # Actual Build Rules ##### +FORCE: -CHANGELOG.txt: - @rlog ${PROGNAME}.py >CHANGELOG.txt +CHANGELOG.txt: FORCE + @cvs log ${PROGMAIN} >CHANGELOG.txt -WHATSNEW.txt: - @co -l $@ +WHATSNEW.txt: FORCE @printf "%s\n%s\n\n" ${HEADER1} ${HEADER2} | cat - $@ >${TMPFILE} @mv ${TMPFILE} $@ @emacs -nw $@ - @ci -m${HEADER1} $@ - @co $@ + @cvs commit -m${HEADER1} $@ + +docs: ${DOCS} ${PROGDOCS} + @chmod 644 ${DOCS} ${PROGDOCS} + @chmod 644 *.gz *.txt + +release: docs WHATSNEW.txt ${PROGFILES} + @mkdir ${DIR} + -@mkdir ${RELEASES} 2>&1 >/dev/null + @cp -pv WHATSNEW.txt ${PROGFILES} ${DOCS} ${PROGDOCS} ${DIR} + @tar -czvf ${TARBALL} --exclude CVS ${DIR} + @rm -rf ${DIR} + @mv ${DIR}.tar.gz ${RELEASES} + +##### +# Housekeeping +##### clean: - @rm -rf ${DIR} ${DOCFILES} ${PORTNAME} ${PROGFILES} ${DOCSOURCES} ${TARBALL} ${TMPFILE} \ - *~ *.1 *.aux *.core *.dvi *.latex *.log *.out *.toc - -docs: ${DOCSOURCES} ${DOCFILES} - @chmod 644 ${DOCFILES} ${DOCSOURCES} - @chmod 644 *.gz *.txt - @flip -u *txt - -progs: ${PROGFILES} - chmod 755 ${PROGFILES} - -release: docs progs - @mkdir ${DIR} - @for f in `for f in ${DOCFILES} ${PROGFILES} ${DOCSOURCES};do echo $$f;done | sort`; do mv -v $$f ${DIR};done - @tar -czvf ${TARBALL} ${DIR} - @rm -rf ${DIR} - @mv ${DIR}.tar.gz Releases + @rm -rf *~ *.1 *.1.gz *.aux *.core *.dvi *.latex *.log *.out tmpfile *.toc version: @echo ${VERSION} + +scrub: clean + @rm -rf ${DIR} ${PROGFILES} ${DOCS} ${PROGDOCS} ${TARBALL} ${TMPFILE} + +init: scrub + cvs update + +