Newer
Older
tren / makefile
# Build a release of 'tren' using 'make'
# $Id: makefile,v 1.107 2012/06/09 20:12:45 tundra Exp $
# Requires a modern 'make' like GNU.


# Uncomment One Of The Following For Early Releases

#EARLY     = Alpha
#EARLY     = Beta
#EARLY     = RC1

#####
# Definitions Relevant To This Program
#####

PROGNAME  = tren

PORTNAME  = ${PROGNAME}

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


#####
# Nothing Should Need To Change Below This Line
#####


DIR          = ${PORTNAME}-${VERSION}
HEADER1      = "WHATSNEW For '${PROGNAME}' ${VERSION}    (`date`)"
HEADER2      = "----------------------------------------------------------------------"
TARBALL      = ${DIR}.tar.gz
TMPFILE      = tmpfile
VERSION      = $(shell cvs log ${PROGNAME}.py | grep ^head\: | cut -f2 -d " ")${EARLY}


#####
# Pattern Rules
#####

###
# Old Rules
###

# %.1.gz: %.1
#	@gzip $<

# %.1: %.txt
#	@cp $< $@

# %.txt: %.1
#	@groff -man -Tascii $< | col -xb >$@

# %.html: %.1
#	@manserver $< >$@

#%.dvi: %.latex
#	latex $<

#%.ps: %.1
#	@groff -man -Tps $< >$@

#%.1: %.rst
#	@rst2man.py $< >$@


###
# Man & html Output
###

%.html: %.rst
	@rst2html $< >$@

%.1: %.html
	@w3m -dump $< >$@

%.1.gz: %.1
	@gzip $<


###
# LaTeX, PostScript, & PDF Output
###

%.latex: %.rst
	rst2latex --stylesheet=parskip $< >$@

%.pdf: %.latex
	@pdflatex $< $@
	@pdflatex $< $@
	@pdflatex $< $@

%.ps: %.pdf
	@pdftops $< >$@


###
# Pretty Print Programs & Scripts
###

%.py.ps: %.py
	@enscript -Epython --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<

%.sh.ps: %
	@enscript -Esh --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<


#####
# Actual Build Rules
#####

FORCE:

CHANGELOG.txt: FORCE
	@cvs log ${PROGNAME}.py >CHANGELOG.txt

WHATSNEW.txt: FORCE
	@printf "%s\n%s\n\n" ${HEADER1} ${HEADER2} | cat - $@ >${TMPFILE}
	@mv ${TMPFILE} $@
	@emacs -nw $@
	@cvs commit -m${HEADER1} $@

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

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


#####
# Housekeeping
#####

clean:
	@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