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