Newer
Older
twander / makefile
# Build a release of twander using 'make'
# $Id: makefile,v 1.113 2012/06/09 02:30:40 tundra Exp $

# Uncomment One Of The Following For Early Releases

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

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

PROGNAME  = twander
PROGMAIN  = twander.py

PROGFILES = ${PROGMAIN}
PROGDOCS  = ${PROGMAIN}.ps 

DOCS      = twander-license.txt     \
            .${PROGNAME}            \
            ${PROGNAME}.1.gz        \
            ${PROGNAME}.html        \
            ${PROGNAME}.pdf         \
            ${PROGNAME}.ps          \
            ${PROGNAME}.txt         \
            CHANGELOG.txt           \
            Makefile                \
            READ-1ST.txt            \



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


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


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

###
# Document Production
###

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

%.pdf: %.ps
	@gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=$@ $<

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

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

%.1.gz: %.1
	@gzip -c $< >$@


###
# 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
	@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} $@
	@emacs -nw $@
	@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  *~ *.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