Newer
Older
tren / makefile
@tundra tundra on 14 Jan 2010 2 KB Initial Version
  1. # Build a release of 'tren' using 'make'
  2. # $Id: makefile,v 1.100 2010/01/14 18:24:02 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 = tren
  17.  
  18. PORTNAME = ${PROGNAME}
  19.  
  20. PROGFILES = ${PROGNAME}.py
  21.  
  22. DOCSOURCES = ${PROGNAME}.rst ${PROGNAME}-license.txt CHANGELOG.txt Makefile \
  23. READ-1ST.txt WHATSNEW.txt setup.py
  24.  
  25. DOCFILES = ${PROGNAME}.html ${PROGNAME}.pdf ${PROGNAME}.ps ${PROGNAME}.py.ps \
  26. ${PROGNAME}.1.gz
  27.  
  28.  
  29. #####
  30. # Nothing Should Need To Change Below This Line
  31. #####
  32.  
  33.  
  34. DIR = ${PORTNAME}-${VERSION}
  35. HEADER1 = "WHATSNEW For '${PROGNAME}' ${VERSION} (`date`)"
  36. HEADER2 = "----------------------------------------------------------------------"
  37. TARBALL = ${DIR}.tar.gz
  38. TMPFILE = tmpfile
  39. VERSION = $(shell rlog -v ${PROGNAME}.py | cut -f 2 -d " ")${EARLY}
  40.  
  41.  
  42. #####
  43. # Pattern Rules
  44. #####
  45.  
  46. ###
  47. # 'troff' Sources
  48. ###
  49.  
  50. # %.1.gz: %.1
  51. # @gzip $<
  52.  
  53. # %.1: %.txt
  54. # @cp $< $@
  55.  
  56. # %.txt: %.1
  57. # @groff -man -Tascii $< | col -xb >$@
  58.  
  59. # %.html: %.1
  60. # @manserver $< >$@
  61.  
  62. # %.ps: %.1
  63. # @groff -man -Tps $< >$@
  64.  
  65. ###
  66. # Restructured Text Sources
  67. ###
  68.  
  69. %.html: %.rst
  70. rst2html $< >$@
  71.  
  72. %.1: %.html
  73. w3m -dump $< >$@
  74.  
  75. %.1.gz: %.1
  76. @gzip $<
  77.  
  78. %.latex: %.rst
  79. rst2latex $< >$@
  80.  
  81. ###
  82. # LaTeX, PostScript, & PDF
  83. ###
  84.  
  85. %.dvi: %.latex
  86. latex $<
  87.  
  88. %.pdf: %.dvi
  89. @dvipdf $< $@
  90.  
  91. %.ps: %.dvi
  92. dvips $< >$@
  93.  
  94. ###
  95. # Pretty Print Programs & Scripts
  96. ###
  97.  
  98. %.py.ps: %.py
  99. @enscript -Epython -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<
  100.  
  101. %.sh.ps: %
  102. @enscript -Esh -fCourier8 -i2 -L77 -C --mark-wrapped-lines=arrow -p$@ $<
  103.  
  104.  
  105. #####
  106. # Actual Build Rules
  107. #####
  108.  
  109.  
  110. CHANGELOG.txt:
  111. @rlog ${PROGNAME}.py >CHANGELOG.txt
  112.  
  113. WHATSNEW.txt:
  114. @co -l $@
  115. @printf "%s\n%s\n\n" ${HEADER1} ${HEADER2} | cat - $@ >${TMPFILE}
  116. @mv ${TMPFILE} $@
  117. @emacs $@
  118. @ci -m${HEADER1} $@
  119. @co $@
  120.  
  121. clean:
  122. @rm -rf ${DIR} ${DOCFILES} ${PORTNAME} ${PROGFILES} ${DOCSOURCES} ${TARBALL} ${TMPFILE} \
  123. *.1 *.aux *.dvi *.log *.out *.core *~
  124.  
  125. docs: ${DOCSOURCES} ${DOCFILES}
  126. @chmod 644 ${DOCFILES} ${DOCSOURCES}
  127. @chmod 644 *.gz *.txt
  128. @flip -u *txt
  129.  
  130. progs: ${PROGFILES}
  131. chmod 755 ${PROGFILES}
  132.  
  133. release: docs progs
  134. @mkdir ${DIR}
  135. @for f in `for f in ${DOCFILES} ${PROGFILES} ${DOCSOURCES};do echo $$f;done | sort`; do mv -v $$f ${DIR};done
  136. @tar -czvf ${TARBALL} ${DIR}
  137. @rm -rf ${DIR}
  138. @mv ${DIR}.tar.gz Releases
  139.  
  140. version:
  141. @echo ${VERSION}