/share/mk/bsd.doc.mk

https://bitbucket.org/freebsd/freebsd-head/ · Makefile · 194 lines · 127 code · 21 blank · 46 comment · 3 complexity · b474d6c70478c4cac27be1ee42494503 MD5 · raw file

  1. # from: @(#)bsd.doc.mk 5.3 (Berkeley) 1/2/91
  2. # $FreeBSD$
  3. #
  4. # The include file <bsd.doc.mk> handles installing BSD troff documents.
  5. #
  6. #
  7. # +++ variables +++
  8. #
  9. # DCOMPRESS_CMD Program to compress troff documents. Output is to stdout.
  10. # [${COMPRESS_CMD}]
  11. #
  12. # DESTDIR Change the tree where the documents get installed. [not set]
  13. #
  14. # DOC Document name. [paper]
  15. #
  16. # EXTRA Extra files (not SRCS) that make up the document. [not set]
  17. #
  18. # LPR Printer command. [lpr]
  19. #
  20. # MACROS Macro packages used to build the document. [not set]
  21. #
  22. # NO_DOCCOMPRESS If you do not want formatted troff documents to be
  23. # compressed when they are installed. [not set]
  24. #
  25. # PRINTERDEVICE Indicates which output formats will be generated
  26. # (ascii, ps, html). [ascii]
  27. #
  28. # SRCDIR Directory where source files live. [${.CURDIR}]
  29. #
  30. # SRCS List of source files. [not set]
  31. #
  32. # TRFLAGS Additional flags to groff(1). [not set]
  33. #
  34. # USE_EQN If set, preprocess with eqn(1). [not set]
  35. #
  36. # USE_PIC If set, preprocess with pic(1). [not set]
  37. #
  38. # USE_REFER If set, preprocess with refer(1). [not set]
  39. #
  40. # USE_SOELIM If set, preprocess with soelim(1). [not set]
  41. #
  42. # USE_TBL If set, preprocess with tbl(1). [not set]
  43. #
  44. # VOLUME Volume the document belongs to. [not set]
  45. .include <bsd.init.mk>
  46. PRINTERDEVICE?= ascii
  47. BIB?= bib
  48. GREMLIN?= grn
  49. GRIND?= vgrind -f
  50. INDXBIB?= indxbib
  51. PIC?= pic
  52. REFER?= refer
  53. .for _dev in ${PRINTERDEVICE:Mascii}
  54. ROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1}
  55. .endfor
  56. .for _dev in ${PRINTERDEVICE:Nascii}
  57. ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1}
  58. .endfor
  59. SOELIM?= soelim
  60. TBL?= tbl
  61. DOC?= paper
  62. LPR?= lpr
  63. .if defined(USE_EQN)
  64. TRFLAGS+= -e
  65. .endif
  66. .if defined(USE_PIC)
  67. TRFLAGS+= -p
  68. .endif
  69. .if defined(USE_REFER)
  70. TRFLAGS+= -R
  71. .endif
  72. .if defined(USE_SOELIM)
  73. TRFLAGS+= -I${SRCDIR}
  74. .endif
  75. .if defined(USE_TBL)
  76. TRFLAGS+= -t
  77. .endif
  78. DCOMPRESS_EXT?= ${COMPRESS_EXT}
  79. DCOMPRESS_CMD?= ${COMPRESS_CMD}
  80. .for _dev in ${PRINTERDEVICE:Mhtml}
  81. DFILE.html= ${DOC}.html
  82. .endfor
  83. .for _dev in ${PRINTERDEVICE:Nhtml}
  84. .if defined(NO_DOCCOMPRESS)
  85. DFILE.${_dev}= ${DOC}.${_dev}
  86. .else
  87. DFILE.${_dev}= ${DOC}.${_dev}${DCOMPRESS_EXT}
  88. .endif
  89. .endfor
  90. UNROFF?= unroff
  91. HTML_SPLIT?= yes
  92. UNROFFFLAGS?= -fhtml
  93. .if ${HTML_SPLIT} == "yes"
  94. UNROFFFLAGS+= split=1
  95. .endif
  96. # Compatibility mode flag for groff. Use this when formatting documents with
  97. # Berkeley me macros (orig_me(7)).
  98. COMPAT?= -C
  99. .PATH: ${.CURDIR} ${SRCDIR}
  100. .for _dev in ${PRINTERDEVICE}
  101. all: ${DFILE.${_dev}}
  102. .endfor
  103. .if !target(print)
  104. .for _dev in ${PRINTERDEVICE}
  105. print: ${DFILE.${_dev}}
  106. .endfor
  107. print:
  108. .for _dev in ${PRINTERDEVICE}
  109. .if defined(NO_DOCCOMPRESS)
  110. ${LPR} ${DFILE.${_dev}}
  111. .else
  112. ${DCOMPRESS_CMD} -d ${DFILE.${_dev}} | ${LPR}
  113. .endif
  114. .endfor
  115. .endif
  116. .for _dev in ${PRINTERDEVICE:Nascii:Nps:Nhtml}
  117. CLEANFILES+= ${DOC}.${_dev} ${DOC}.${_dev}${DCOMPRESS_EXT}
  118. .endfor
  119. CLEANFILES+= ${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
  120. ${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
  121. ${DOC}.html ${DOC}-*.html
  122. realinstall:
  123. .for _dev in ${PRINTERDEVICE:Mhtml}
  124. cd ${SRCDIR}; \
  125. ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
  126. ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
  127. .endfor
  128. .for _dev in ${PRINTERDEVICE:Nhtml}
  129. ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
  130. ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME}
  131. .endfor
  132. spell: ${SRCS}
  133. (cd ${.CURDIR}; spell ${SRCS} ) | sort | \
  134. comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
  135. BINDIR?= /usr/share/doc
  136. BINMODE= 444
  137. SRCDIR?= ${.CURDIR}
  138. .if defined(EXTRA) && !empty(EXTRA)
  139. _stamp.extra: ${EXTRA}
  140. touch ${.TARGET}
  141. .endif
  142. CLEANFILES+= _stamp.extra
  143. .for _dev in ${PRINTERDEVICE:Nhtml}
  144. .if !target(${DFILE.${_dev}})
  145. .if target(_stamp.extra)
  146. ${DFILE.${_dev}}: _stamp.extra
  147. .endif
  148. ${DFILE.${_dev}}: ${SRCS}
  149. .if defined(NO_DOCCOMPRESS)
  150. ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} > ${.TARGET}
  151. .else
  152. ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} | ${DCOMPRESS_CMD} > ${.TARGET}
  153. .endif
  154. .endif
  155. .endfor
  156. .for _dev in ${PRINTERDEVICE:Mhtml}
  157. .if !target(${DFILE.html})
  158. .if target(_stamp.extra)
  159. ${DFILE.html}: _stamp.extra
  160. .endif
  161. ${DFILE.html}: ${SRCS}
  162. .if defined(MACROS) && !empty(MACROS)
  163. cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
  164. document=${DOC} ${SRCS}
  165. .else # unroff(1) requires a macro package as an argument
  166. cd ${SRCDIR}; ${UNROFF} -ms ${UNROFFFLAGS} \
  167. document=${DOC} ${SRCS}
  168. .else
  169. .endif
  170. .endif
  171. .endfor
  172. DISTRIBUTION?= doc
  173. .include <bsd.obj.mk>