Newer
Older
tsshbatch / makefile
  1. # Build a release of 'tsshbatch' using 'make'
  2. # $Id: makefile,v 1.102 2012/06/09 03:04:20 tundra Exp $
  3. # Requires a modern 'make' like GNU.
  4.  
  5. # Uncomment One Of The Following For Early Releases
  6.  
  7. #EARLY = Alpha
  8. #EARLY = Beta
  9. #EARLY = RC1
  10.  
  11. #####
  12. # Definitions Relevant To This Program
  13. #####
  14.  
  15. PROGNAME = tsshbatch
  16. PROGMAIN = tsshbatch.py
  17.  
  18. PROGFILES = ${PROGMAIN}
  19. PROGDOCS = ${PROGMAIN}.ps
  20.  
  21. DOCS = tsshbatch-license.txt \
  22. ${PROGNAME}.1.gz \
  23. ${PROGNAME}.html \
  24. ${PROGNAME}.pdf \
  25. ${PROGNAME}.ps \
  26. ${PROGNAME}.rst \
  27. ${PROGNAME}.txt \
  28. CHANGELOG.txt \
  29. Makefile \
  30.  
  31.  
  32. #####
  33. # Nothing Should Need To Change Below This Line
  34. #####
  35.  
  36.  
  37. DIR = ${PROGNAME}-${VERSION}
  38. HEADER1 = "WHATSNEW For '${PROGNAME}' ${VERSION} (`date`)"
  39. HEADER2 = "----------------------------------------------------------------------"
  40. RELEASES = "Releases"
  41. TARBALL = ${DIR}.tar.gz
  42. TMPFILE = tmpfile
  43. VERSION = $(shell cvs log ${PROGMAIN} | grep ^head\: | cut -f2 -d " ")${EARLY}
  44.  
  45.  
  46. #####
  47. # Pattern Rules
  48. #####
  49.  
  50. ###
  51. # Document Production
  52. ###
  53.  
  54. # Some Docutils installations keep the ".py" suffix for the various
  55. # frontend programs, and some do not. It's even possible there are
  56. # links from one to the other. Since the project can be checked out
  57. # on any platform, we have to check for this every time we run the
  58. # 'make'. This is irritating.
  59.  
  60. 2HTML = $(shell which rst2html.py rst2html 2>/dev/null | head -n 1)
  61. 2LATEX = $(shell which rst2latex.py rst2latex 2>/dev/null | head -n 1) --stylesheet=parskip
  62. 2ODT = $(shell which rst2odt.py rst2odt 2>/dev/null | head -n 1)
  63. 2MAN = $(shell which rst2man.py rst2man 2>/dev/null | head -n 1)
  64.  
  65. # TeX/LaTeX Processing
  66.  
  67. DVIPS = dvips
  68. PDFLATEX = pdflatex
  69. LATEX = latex
  70.  
  71. %.dvi : %.latex
  72. ${LATEX} $*.latex
  73.  
  74. %.html : %.rst
  75. ${2HTML} <$*.rst >$*.html
  76.  
  77. %.latex : %.rst
  78. ${2LATEX} $*.rst >$*.latex
  79.  
  80. %.1 : %.rst
  81. ${2MAN} <$*.rst >$*.1
  82.  
  83. %.1.gz: %.1
  84. @gzip -c <$*.1 >$*.1.gz
  85.  
  86. %.odt : %.rst
  87. ${2ODT} <$*.rst >$*.odt
  88.  
  89. %.pdf : %.latex
  90. ${PDFLATEX} $*.latex
  91. ${PDFLATEX} $*.latex
  92. ${PDFLATEX} $*.latex
  93.  
  94. %.ps : %.dvi
  95. ${DVIPS} $*.dvi
  96.  
  97. %.txt: %.1
  98. @groff -man -Tascii $< | col -xb >$@
  99.  
  100. ###
  101. # Pretty Print Programs & Scripts
  102. ###
  103.  
  104. %.pl.ps: %.pl
  105. @enscript -Eperl --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<
  106.  
  107. %.py.ps: %.py
  108. @enscript -Epython --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<
  109.  
  110. %.sh.ps: %.sh
  111. @enscript -Esh --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<
  112.  
  113.  
  114. #####
  115. # Actual Build Rules
  116. #####
  117.  
  118. FORCE:
  119.  
  120. CHANGELOG.txt: FORCE
  121. @cvs log ${PROGMAIN} >CHANGELOG.txt
  122.  
  123. WHATSNEW.txt: FORCE
  124. @printf "%s\n%s\n\n" ${HEADER1} ${HEADER2} | cat - $@ >${TMPFILE}
  125. @mv ${TMPFILE} $@
  126. @emacs -nw $@
  127. @cvs commit -m${HEADER1} $@
  128.  
  129. docs: ${DOCS} ${PROGDOCS}
  130. @chmod 644 ${DOCS} ${PROGDOCS}
  131. @chmod 644 *.gz *.txt
  132.  
  133. release: docs WHATSNEW.txt ${PROGFILES}
  134. @mkdir ${DIR}
  135. -@mkdir ${RELEASES} 2>&1 >/dev/null
  136. @cp -pv WHATSNEW.txt ${PROGFILES} ${DOCS} ${PROGDOCS} ${DIR}
  137. @tar -czvf ${TARBALL} --exclude CVS ${DIR}
  138. @rm -rf ${DIR}
  139. @mv ${DIR}.tar.gz ${RELEASES}
  140.  
  141. #####
  142. # Housekeeping
  143. #####
  144.  
  145. clean:
  146. @rm -rf *~ *.1 *.1.gz *.aux *.core *.dvi *.latex *.log *.out tmpfile *.toc
  147.  
  148. version:
  149. @echo ${VERSION}
  150.  
  151. scrub: clean
  152. @rm -rf ${DIR} ${PROGFILES} ${DOCS} ${PROGDOCS} ${TARBALL} ${TMPFILE}
  153.  
  154. init: scrub
  155. cvs update
  156.  
  157.