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