Newer
Older
pystat / makefile
@tundra tundra on 17 Feb 2010 2 KB Initial Version
# Build a release of 'pystat' using 'make'
# $Id: makefile,v 1.100 2010/02/18 00:58:55 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  = pystat

PORTNAME  = ${PROGNAME}

PROGFILES = ${PROGNAME}.py

DOCSOURCES = ${PROGNAME}.rst ${PROGNAME}-license.txt  CHANGELOG.txt Makefile \
             READ-1ST.txt 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 rlog -v ${PROGNAME}.py | cut -f 2 -d " ")${EARLY}


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

###
# 'troff' Sources
###

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

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

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

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

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

###
# Restructured Text Sources
###

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

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

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

%.latex: %.rst
	rst2latex $< >$@

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

%.dvi: %.latex
	latex $<

%.pdf: %.dvi
	@dvipdf $< $@

%.ps: %.dvi
	dvips $< >$@

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

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

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


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


CHANGELOG.txt:
	@rlog ${PROGNAME}.py >CHANGELOG.txt

WHATSNEW.txt:
	@co -l $@
	@printf "%s\n%s\n\n" ${HEADER1} ${HEADER2} | cat - $@ >${TMPFILE}
	@mv ${TMPFILE} $@
	@emacs $@
	@ci -m${HEADER1} $@
	@co $@

clean:
	@rm -rf  ${DIR} ${DOCFILES} ${PORTNAME} ${PROGFILES} ${DOCSOURCES} ${TARBALL} ${TMPFILE} \
             *.1 *.aux *.dvi *.log *.out *.core *~

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

version:
	@echo ${VERSION}