Newer
Older
tsearchpath / makefile
  1. # Build a release of 'tsearchpath' using 'make'
  2. # $Id: makefile,v 1.108 2012/06/09 19:32:50 tundra Exp $
  3. # Requires a modern 'make' like GNU.
  4.  
  5. # Uncomment One Of The Following For Early Releases
  6.  
  7. #EARLY = Alpha
  8. #EARLY = Beta
  9. #EARLY = RC1
  10.  
  11. #####
  12. # Definitions Relevant To This Program
  13. #####
  14.  
  15. PROGNAME = tsearchpath
  16. PROGMAIN = tsearchpath.py
  17.  
  18. PROGFILES = ${PROGMAIN} setup.py testpath.py
  19. PROGDOCS = ${PROGMAIN}.ps
  20.  
  21. DOCS = tsearchpath-license.txt \
  22. ${PROGNAME}.3.gz \
  23. ${PROGNAME}.html \
  24. ${PROGNAME}.pdf \
  25. ${PROGNAME}.ps \
  26. ${PROGNAME}.rst \
  27. ${PROGNAME}.txt \
  28. testpath.py.ps \
  29. CHANGELOG.txt \
  30. Makefile \
  31.  
  32.  
  33. #####
  34. # Nothing Should Need To Change Below This Line
  35. #####
  36.  
  37.  
  38. DIR = ${PROGNAME}-${VERSION}
  39. HEADER1 = "WHATSNEW For '${PROGNAME}' ${VERSION} (`date`)"
  40. HEADER2 = "----------------------------------------------------------------------"
  41. RELEASES = "Releases"
  42. TARBALL = ${DIR}.tar.gz
  43. TMPFILE = tmpfile
  44. VERSION = $(shell cvs log ${PROGMAIN} | grep ^head\: | cut -f2 -d " ")${EARLY}
  45.  
  46.  
  47. #####
  48. # Pattern Rules
  49. #####
  50.  
  51. ###
  52. # Document Production
  53. ###
  54.  
  55. # Some Docutils installations keep the ".py" suffix for the various
  56. # frontend programs, and some do not. It's even possible there are
  57. # links from one to the other. Since the project can be checked out
  58. # on any platform, we have to check for this every time we run the
  59. # 'make'. This is irritating.
  60.  
  61. 2HTML = $(shell which rst2html.py rst2html 2>/dev/null | head -n 1)
  62. 2LATEX = $(shell which rst2latex.py rst2latex 2>/dev/null | head -n 1) --stylesheet=parskip
  63. 2ODT = $(shell which rst2odt.py rst2odt 2>/dev/null | head -n 1)
  64. 2MAN = $(shell which rst2man.py rst2man 2>/dev/null | head -n 1)
  65.  
  66. # TeX/LaTeX Processing
  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. %.3 : %.rst
  82. ${2MAN} <$*.rst >$*.3
  83.  
  84. %.3.gz: %.3
  85. @gzip -c <$*.3 >$*.3.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: %.3
  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. @emacs -nw $@
  128. @cvs commit -m${HEADER1} $@
  129.  
  130. docs: ${DOCS} ${PROGDOCS}
  131. @chmod 644 ${DOCS} ${PROGDOCS}
  132. @chmod 644 *.gz *.txt
  133.  
  134. release: docs WHATSNEW.txt ${PROGFILES}
  135. @mkdir ${DIR}
  136. -@mkdir ${RELEASES} 2>&1 >/dev/null
  137. @cp -pv WHATSNEW.txt ${PROGFILES} ${DOCS} ${PROGDOCS} ${DIR}
  138. @tar -czvf ${TARBALL} --exclude CVS ${DIR}
  139. @rm -rf ${DIR}
  140. @mv ${DIR}.tar.gz ${RELEASES}
  141.  
  142. #####
  143. # Housekeeping
  144. #####
  145.  
  146. clean:
  147. @rm -rf *~ *.3 *.3.gz *.aux *.core *.dvi *.latex *.log *.out tmpfile *.toc
  148.  
  149. version:
  150. @echo ${VERSION}
  151.  
  152. scrub: clean
  153. @rm -rf ${DIR} ${PROGFILES} ${DOCS} ${PROGDOCS} ${TARBALL} ${TMPFILE}
  154.  
  155. init: scrub
  156. cvs update
  157.