Newer
Older
reStructuredText / makefile
  1. # Produce Various Output Formats From A Restructured Text Source Document
  2. # $Id: makefile,v 1.103 2014/08/23 00:36:10 tundra Exp $
  3.  
  4.  
  5. #####
  6. # Setup The Project Here
  7. #####
  8.  
  9. # PROJECT = NAMEOFPROJECT
  10. # This is setup in the makefile that includes us
  11.  
  12. # List all the output files
  13.  
  14. 1: ${PROJECT}.1
  15.  
  16. dvi: ${PROJECT}.dvi
  17.  
  18. html: ${PROJECT}.html
  19.  
  20. latex: ${PROJECT}.latex
  21.  
  22. odt: ${PROJECT}.odt
  23.  
  24. pdf: ${PROJECT}.pdf
  25.  
  26. ps: ${PROJECT}.ps
  27.  
  28. txt: ${PROJECT}.txt
  29.  
  30.  
  31. #####
  32. # Things That May Have To Be Changed, Depending On System
  33. #####
  34.  
  35.  
  36. ########################################################################
  37. # Nothing Below This Line Should Need To Be Changed #
  38. ########################################################################
  39.  
  40.  
  41.  
  42. ###
  43. # Document Production
  44. ###
  45.  
  46. # RST Filter And Needed Program Locations
  47.  
  48. # Some Docutils installations keep the ".py" suffix for the various
  49. # frontend programs, and some do not. It's even possible there are
  50. # links from one to the other. Since the project can be checked out
  51. # on any platform, we have to check for this every time we run the
  52. # 'make'. This is irritating.
  53.  
  54. 2HTML = $(shell which rst2html.py rst2html | tr '\012' ' ' | awk '{print $$1}') --no-compact-lists
  55. 2LATEX = $(shell which rst2latex.py rst2latex | tr '\012' ' ' | awk '{print $$1}') --stylesheet=parskip --latex-preamble="\usepackage{fullpage}"
  56. 2ODT = $(shell which rst2odt.py rst2odt | tr '\012' ' ' | awk '{print $$1}')
  57. 2MAN = $(shell which rst2man.py rst2man | tr '\012' ' ' | awk '{print $$1}')
  58.  
  59. DVIPS = dvips
  60. PDFLATEX = pdflatex
  61. LATEX = latex
  62. NROFF = nroff -c -man
  63.  
  64. # File Types
  65.  
  66. CLEAN = .aux .log .out \~
  67. DOCFILES = .1 .dvi .html .latex .odt .pdf .ps .txt
  68.  
  69. # Conversion Rules
  70.  
  71. %.dvi : %.latex
  72. ${LATEX} $*.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. %.odt : %.rst
  85. ${2ODT} <$*.rst >$*.odt
  86.  
  87. %.pdf : %.latex
  88. ${PDFLATEX} $*.latex
  89.  
  90. %.ps : %.dvi
  91. ${DVIPS} $*.dvi
  92.  
  93. %.txt : %.1
  94. ${NROFF} $*.1 >$*.txt
  95.  
  96.  
  97. #####
  98. # Packaging
  99. #####
  100.  
  101. all: 1 dvi html latex odt pdf ps
  102.  
  103. pkg: all clean
  104. tar -czvf ${PROJECT}-docs.tar.gz ${PROJECT}.*
  105.  
  106.  
  107. #####
  108. # Cleanup stanzas
  109. #####
  110.  
  111. clean:
  112. -@for type in ${CLEAN};\
  113. do\
  114. rm -v *$$type;\
  115. done
  116.  
  117. scrub: clean
  118. -@for type in ${DOCFILES};\
  119. do\
  120. rm -v *$$type;\
  121. done
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.