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