Newer
Older
tmkproject / common / makefile
@tundra tundra on 1 Jun 2012 2 KB Initial revision
  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. WHATSNEW.txt \
  39.  
  40.  
  41. #####
  42. # Nothing Should Need To Change Below This Line
  43. #####
  44.  
  45.  
  46. DIR = ${PROGNAME}-${VERSION}
  47. HEADER1 = "WHATSNEW For '${PROGNAME}' ${VERSION} (`date`)"
  48. HEADER2 = "----------------------------------------------------------------------"
  49. RELEASES = "Releases"
  50. TARBALL = ${DIR}.tar.gz
  51. TMPFILE = tmpfile
  52. VERSION = $(shell cvs log ${PROGMAIN} | grep head | cut -f2 -d " ")${EARLY}
  53.  
  54.  
  55. #####
  56. # Pattern Rules
  57. #####
  58.  
  59. ###
  60. # Document Production
  61. ###
  62.  
  63. 2HTML = rst2html
  64. 2LATEX = rst2latex --stylesheet=parskip
  65. 2ODT = rst2odt
  66. 2MAN = rst2man
  67.  
  68. DVIPS = dvips
  69. PDFLATEX = pdflatex
  70. LATEX = latex
  71.  
  72. %.dvi : %.latex
  73. ${LATEX} $*.latex
  74.  
  75. %.html : %.rst
  76. ${2HTML} <$*.rst >$*.html
  77.  
  78. %.latex : %.rst
  79. ${2LATEX} $*.rst >$*.latex
  80.  
  81. %.1 : %.rst
  82. ${2MAN} <$*.rst >$*.1
  83.  
  84. %.1.gz: %.1
  85. @gzip -c <$*.1 >$*.1.gz
  86.  
  87. %.odt : %.rst
  88. ${2ODT} <$*.rst >$*.odt
  89.  
  90. %.pdf : %.latex
  91. ${PDFLATEX} $*.latex
  92. ${PDFLATEX} $*.latex
  93. ${PDFLATEX} $*.latex
  94.  
  95. %.ps : %.dvi
  96. ${DVIPS} $*.dvi
  97.  
  98. %.txt: %.1
  99. @groff -man -Tascii $< | col -xb >$@
  100.  
  101. ###
  102. # Pretty Print Programs & Scripts
  103. ###
  104.  
  105. %.pl.ps: %.pl
  106. @enscript -Eperl --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<
  107.  
  108. %.py.ps: %.py
  109. @enscript -Epython --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<
  110.  
  111. %.sh.ps: %.sh
  112. @enscript -Esh --color -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<
  113.  
  114.  
  115. #####
  116. # Actual Build Rules
  117. #####
  118.  
  119. FORCE:
  120.  
  121. CHANGELOG.txt: FORCE
  122. @cvs log ${PROGMAIN} >CHANGELOG.txt
  123.  
  124. WHATSNEW.txt: FORCE
  125. @printf "%s\n%s\n\n" ${HEADER1} ${HEADER2} | cat - $@ >${TMPFILE}
  126. @mv ${TMPFILE} $@
  127. @__EDITOR__ __EDITARGS__ $@
  128. @cvs commit -m${HEADER1} $@
  129.  
  130. docs: ${DOCS} ${PROGDOCS}
  131. @chmod 644 ${DOCS} ${PROGDOCS}
  132. @chmod 644 *.gz *.txt
  133. @flip -u *txt
  134.  
  135. release: docs ${PROGFILES}
  136. @mkdir ${DIR}
  137. -@mkdir ${RELEASES} 2>&1 >/dev/null
  138. @cp -pv ${PROGFILES} ${DOCS} ${PROGDOCS} ${DIR}
  139. @tar -czvf ${TARBALL} --exclude CVS ${DIR}
  140. @rm -rf ${DIR}
  141. @mv ${DIR}.tar.gz ${RELEASES}
  142.  
  143. #####
  144. # Housekeeping
  145. #####
  146.  
  147. clean:
  148. @rm -rf *~ *.1 *.1.gz *.aux *.core *.dvi *.latex *.log *.out tmpfile *.toc
  149.  
  150. version:
  151. @echo ${VERSION}
  152.  
  153. scrub: clean
  154. @rm -rf ${DIR} ${PROGFILES} ${DOCS} ${PROGDOCS} ${TARBALL} ${TMPFILE}
  155.  
  156. init: scrub
  157. cvs update
  158.  
  159.