diff --git a/Makefile b/Makefile deleted file mode 100644 index bc0c72f..0000000 --- a/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# FreeBSD Ports Makefile For 'tperimeter' -# $Id: Makefile,v 1.101 2006/05/01 01:15:21 tundra Exp $ - -all: # Do nothing - there is nothing to compile it's all html, python, & sh - -install: - ${BSD_INSTALL_SCRIPT} tperimeter.py ${PREFIX}/etc/tperimeter - ${BSD_INSTALL_SCRIPT} tperimeter-ui.html ${PREFIX}/etc/tperimeter - ${BSD_INSTALL_SCRIPT} rebuild-hosts.allow.sh ${PREFIX}/etc/tperimeter - ${BSD_INSTALL_MAN} tperimeter.1.gz ${PREFIX}/man/cat1 - chown www:www ${PREFIX}/etc/tperimeter/tperimeter.py ${PREFIX}/etc/tperimeter/tperimiter-ui.html diff --git a/makefile b/makefile index c66d4c3..f7ea5c9 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ # Build a release of tperimeter using 'make' -# $Id: makefile,v 1.116 2010/11/18 16:12:05 tundra Exp $ +# $Id: makefile,v 1.117 2012/06/09 20:54:41 tundra Exp $ # Requires a modern 'make' like GNU. @@ -14,15 +14,22 @@ ##### PROGNAME = tperimeter +PROGMAIN = tperimeter.py -PORTNAME = ${PROGNAME} +PROGFILES = ${PROGMAIN} ${PROGNAME}-ui.html rebuild-hosts.allow.sh +PROGDOCS = ${PROGMAIN}.ps -PROGFILES = ${PROGNAME}.py ${PROGNAME}-ui.html rebuild-hosts.allow.sh - -SUPPFILES = ${PROGNAME}-license.txt CHANGELOG.txt WHATSNEW.txt - -DOCFILES = ${PROGNAME}.latex ${PROGNAME}.dvi ${PROGNAME}.html ${PROGNAME}.pdf ${PROGNAME}.ps ${PROGNAME}.py.ps ${PROGNAME}.1.gz \ - ${PROGNAME}-ui.html.ps rebuild-hosts.allow.sh.ps +DOCS = tperimeter-license.txt \ + ${PROGNAME}.1.gz \ + ${PROGNAME}.html \ + ${PROGNAME}.pdf \ + ${PROGNAME}.ps \ + ${PROGNAME}.rst \ + ${PROGNAME}.txt \ + rebuild-hosts.allow.sh.ps \ + ${PROGNAME}-ui.html.ps \ + CHANGELOG.txt \ + Makefile \ SAMPLE = ${PROGNAME}-sample.tar.gz @@ -32,106 +39,125 @@ ##### -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} ##### # Pattern Rules ##### -%.dvi: %.latex - latex $< +### +# Document Production +### -%.html: %.1 - @manserver $< >$@ +# 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. -%.html: %.txt - rst2html $< >$@ +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) -%.latex: %.txt - rst2latex $< >$@ +# TeX/LaTeX Processing -%.pdf: %.dvi - @dvipdf $< $@ +DVIPS = dvips +PDFLATEX = pdflatex +LATEX = latex -%.pdf: %.ps - @gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=$@ $< +%.dvi : %.latex + ${LATEX} $*.latex -%.ps: %.1 - @groff -man -Tps $< >$@ +%.html : %.rst + ${2HTML} <$*.rst >$*.html -%.ps: %.dvi - dvips $< >$@ +%.latex : %.rst + ${2LATEX} $*.rst >$*.latex -%.html.ps: %.html - @enscript -Ehtml -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $< +%.1 : %.rst + ${2MAN} <$*.rst >$*.1 -%.py.ps: %.py - @enscript -Epython -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $< +%.1.gz: %.1 + @gzip -c <$*.1 >$*.1.gz -%.sh.ps: %.sh - @enscript -Esh -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $< +%.odt : %.rst + ${2ODT} <$*.rst >$*.odt + +%.pdf : %.latex + ${PDFLATEX} $*.latex + ${PDFLATEX} $*.latex + ${PDFLATEX} $*.latex + +%.ps : %.dvi + ${DVIPS} $*.dvi %.txt: %.1 @groff -man -Tascii $< | col -xb >$@ -%.txt: %.3 - @groff -man -Tascii $< | col -xb >$@ +### +# Pretty Print Programs & Scripts +### -%.1.gz: %.1 - @gzip $< +%.pl.ps: %.pl + @enscript -Eperl --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $< -%.1: %.txt - cat $< >$@ +%.py.ps: %.py + @enscript -Epython --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $< -%.3.gz: %.3 - @gzip $< +%.sh.ps: %.sh + @enscript -Esh --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $< ##### # Actual Build Rules ##### +FORCE: + +CHANGELOG.txt: FORCE + @cvs log ${PROGMAIN} >CHANGELOG.txt + +WHATSNEW.txt: FORCE + @printf "%s\n%s\n\n" ${HEADER1} ${HEADER2} | cat - $@ >${TMPFILE} + @mv ${TMPFILE} $@ + @__EDITOR__ __EDITARGS__ $@ + @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} + @cd ${DIR} && tar -xzvf ../${SAMPLE} + @tar -czvf ${TARBALL} --exclude CVS ${DIR} + @rm -rf ${DIR} + @mv ${DIR}.tar.gz ${RELEASES} + +##### +# Housekeeping +##### + clean: - @rm -rf ${DIR} ${DOCFILES} ${PORTNAME} ${PROGFILES} ${SUPPFILES} ${TMPFILE} *.aux *.dvi *.log *.out *.core *.tar.gz *.txt *~ + @rm -rf *~ *.1 *.1.gz *.aux *.core *.dvi *.latex *.log *.out tmpfile *.toc version: @echo ${VERSION} -CHANGELOG.txt: - @rlog ${PROGNAME}.py >CHANGELOG.txt - @rlog ${PROGNAME}-ui.html >>CHANGELOG.txt - @rlog rebuild-hosts.allow.sh >>CHANGELOG.txt +scrub: clean + @rm -rf ${DIR} ${PROGFILES} ${DOCS} ${PROGDOCS} ${TARBALL} ${TMPFILE} -WHATSNEW.txt: - @co -l $@ - @printf "%s\n%s\n\n" ${HEADER1} ${HEADER2} | cat - $@ >${TMPFILE} - @mv ${TMPFILE} $@ - @emacs $@ - @ci -m${HEADER1} $@ - @co $@ +init: scrub + cvs update -docs: ${DOCFILES} ${SUPPFILES} - @chmod 644 ${DOCFILES} ${SUPPFILES} - @chmod 644 *.gz *.txt - @flip -u *txt - -progs: ${PROGFILES} - chmod 740 ${PROGFILES} - -release: docs progs - @mkdir -p ${DIR}/docs ${DIR}/progs - @mv ${DOCFILES} ${DIR}/docs - @mv ${PROGFILES} ${DIR}/progs - @mv ${SUPPFILES} ${DIR} - co ${SAMPLE} && cd ${DIR} && tar -xzvf ../${SAMPLE} - @tar -czvf ${TARBALL} ${DIR} - @rm -rf ${DIR} - @mv ${DIR}.tar.gz Releases - @gmake clean