Newer
Older
tmkproject / common / makefile
  1. # Build a release of '__PROJECTNAME__' using 'make'
  2. # Requires a modern 'make' like GNU.
  3. #
  4. # __COPYRIGHT__
  5. # __RESERVED__
  6. #
  7. # __UPDATES__
  8. #
  9. # __ID__
  10.  
  11.  
  12. # Uncomment One Of The Following For Early Releases
  13.  
  14. #EARLY = Alpha
  15. #EARLY = Beta
  16. #EARLY = RC1
  17.  
  18. #####
  19. # Definitions Relevant To This Program
  20. #####
  21.  
  22. PROGNAME = __PROJECTNAME__
  23. TYPE = __TYPE__
  24. PROGMAIN = __PROJECTNAME__.__TYPE__
  25.  
  26. PROGFILES = ${PROGMAIN}
  27. PROGDOCS = ${PROGMAIN}.ps
  28.  
  29. DOCS = __LICENSE__ \
  30. ${PROGNAME}.1.gz \
  31. ${PROGNAME}.html \
  32. ${PROGNAME}.pdf \
  33. ${PROGNAME}.ps \
  34. ${PROGNAME}.rst \
  35. ${PROGNAME}.txt \
  36. CHANGELOG.txt \
  37. Makefile \
  38.  
  39.  
  40. #####
  41. # Nothing Should Need To Change Below This Line
  42. #####
  43.  
  44.  
  45. DIR = ${PROGNAME}-${VERSION}
  46. HEADER1 = "WHATSNEW For '${PROGNAME}' ${VERSION} (`date`)"
  47. HEADER2 = "----------------------------------------------------------------------"
  48. RELEASES = "Releases"
  49. TARBALL = ${DIR}.tar.gz
  50. TMPFILE = tmpfile
  51. VERSION = $(shell cvs log ${PROGMAIN} | grep head | cut -f2 -d " ")${EARLY}
  52.  
  53.  
  54. #####
  55. # Pattern Rules
  56. #####
  57.  
  58. ###
  59. # Document Production
  60. ###
  61.  
  62. 2HTML = rst2html__PY__
  63. 2LATEX = rst2latex__PY__ --stylesheet=parskip
  64. 2ODT = rst2odt__PY__
  65. 2MAN = rst2man__PY__
  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. @__EDITOR__ __EDITARGS__ $@
  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.