Makefile 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. # This variable contains a list of docbook sources separated by white space to
  2. # be processed by the docbook build system if the user did not specify any
  3. # document on the command line. Documents configure here are processed one
  4. # after another, each of them will be treated as a standalone documentation
  5. # file.
  6. docs ?= index.xml
  7. # Here you can specify the name of the file that will be used to generate a
  8. # module README file. You can override it in a module Makefile. This is
  9. # useful, for example, if you want to use a different docbook file to generate
  10. # README and a different docbook file to generate documentation in other
  11. # formats (HTML, TXT). If you omit this variable in your Makefile then the
  12. # first document specified in DOCS is used to generate module README file.
  13. readme_docs ?= $(docs)
  14. # This is the list of docbook files to be used to generate HTML
  15. # documentation. You can use this variable in your Makefile if you have
  16. # docbook documents that should be processed only when HTML documentation is
  17. # being generated (i.e. you want them to be ignored when plain-text
  18. # documentation is being generated). Multiple documents separated by white
  19. # space can be configured here and they will be processed one after
  20. # another. If you omit this variable then the documents specified in DOCS
  21. # variable will be converted to HTML when HTML documentation is being built.
  22. html_docs ?= $(docs)
  23. # This is the list of docbook files to be used to generate plain-text
  24. # documentation. You can use this variable in your Makefile if you have
  25. # docbook documents that should be processed only when plain-textdocumentation
  26. # is being generated (i.e. you want them to be ignored when HTML documentation
  27. # is being generated). Multiple documents separated by white space can be
  28. # configured here and they will be processed one after another. If you omit
  29. # this variable then the documents specified in DOCS variable will be
  30. # converted to plain-text when plain-text documentation is being built.
  31. txt_docs ?= $(docs)
  32. # Output directory where files produced by XSL stylesheets should be stored,
  33. # by default we output to the same directory, documents that are chunked may
  34. # choose to override this to write all chunks in a subdirectory instead.
  35. output_dir ?= .
  36. # Here you can configure the path to the directory which contains all
  37. # auxiliary files that are needed to convert docbook documentation to other
  38. # formats. You should not need to use this variable under normal
  39. # circumstances.
  40. docbook_dir ?= ../../../doc/docbook
  41. COREPATH ?= $(docbook_dir)/../../src
  42. # This is the stylesheet used to generate a list of dependencies for a docbook
  43. # source file. The stylesheet walks through the document and prints all files
  44. # that are included in the document. The list of files is then written in a
  45. # standalone file by this Makefile and the file can be included by the
  46. # Makefile.
  47. dep_xsl ?= $(docbook_dir)/dep.xsl
  48. # This is the stylesheet that is used to produce a single HTML file for every
  49. # docbook document being processed. This stylesheet contains configuration for
  50. # docbook XSL scripts that only applies when the build system generates a
  51. # single HTML file.
  52. single_html_xsl ?= $(docbook_dir)/html.xsl
  53. # This stylesheet is used to produce chunked HTML documention, the output will
  54. # be a set of HTML files. This stylesheet contains configuration for docbook
  55. # XSL scripts that only applies when multiple-file HTML documentation is being
  56. # generated.
  57. chunked_html_xsl ?= $(chunked_html_xls)/html.chunked.xsl
  58. # This stylesheet is used to produce plain-text documentation. Internally this
  59. # stylesheet includes the docbook XSL stylesheet used to produce single-file
  60. # HTML documentation and the output is then converted by lynx to a plain-text
  61. # file.
  62. txt_xsl ?= $(docbook_dir)/txt.xsl
  63. # This stylesheet is used when the docbook build system generates a module
  64. # README. The process is similar to the process of generating plain-text file,
  65. # but we use a separate stylesheet here because the configuration of docbook
  66. # XSL stylesheets can be a bit different for READMEs (i.e. we do not want to
  67. # have list of examples in READMES, etc.)
  68. readme_xsl ?= $(docbook_dir)/readme.xsl
  69. # Use this configuration variable to enable or disable docbook document
  70. # validation before the build system converts the document into another
  71. # format.
  72. validate ?= 0
  73. # A list of CSS stylesheets separated by whitespace to be included in HTML
  74. # files.
  75. html_css ?= /css/sr-doc.css
  76. # This is the catalog file used by xsltproc to locate docbook schema files
  77. # needed to validate docbook documents and docbook XSL stylesheets needed
  78. # convert docbook documents to other formats. All docbook documents in the
  79. # sip-router projects refer to schema files using public
  80. # identifiers. Similarly customization stylesheets refer to docbook XSL
  81. # stylesheets using public URIs. The catalog file is then used to convert
  82. # public identifiers and public URIs to files on local filesystem. The default
  83. # version of the catalog file only refers to file /etc/xml/catalog, this is
  84. # the site-wide catalog file present in Debian and possibly other systems
  85. # too. This file is updated by the package manager whenever docbook schema
  86. # file or docbook xsl stylesheets are being installed.
  87. catalog ?= $(docbook_dir)/catalog.xml
  88. # Use standard catalog from OS, set it to no to use the above path to a
  89. # custom catalog file.
  90. nocatalog ?= yes
  91. lynx ?= lynx
  92. dia ?= dia
  93. xsltproc ?= xsltproc
  94. xmllint ?= xmllint
  95. lynx_flags ?= -nolist
  96. dia_args ?=
  97. xsltproc_flags ?=
  98. xmllint_flags ?= --xinclude --postvalid --noout
  99. ifeq ($(validate), 0)
  100. override xsltproc_flags := $(xsltproc_flags) --novalid
  101. endif
  102. ifeq ($(nocatalog),yes)
  103. XMLCATALOGX=
  104. else
  105. XMLCATALOGX=XML_CATALOG_FILES=$(catalog)
  106. endif
  107. all_deps = Makefile $(docbook_dir)/Makefile $(docbook_dir)/entities.xml \
  108. $(dep_xsl) $(catalog) $(extra_deps)
  109. all: txt
  110. html_files = $(addprefix $(output_dir)/, $(addsuffix .html,\
  111. $(basename $(html_docs))))
  112. html_deps = $(addsuffix .d, $(basename $(html_docs)))
  113. txt_files = $(addprefix $(output_dir)/, $(addsuffix .txt,\
  114. $(basename $(txt_docs))))
  115. txt_deps = $(addsuffix .d, $(basename $(txt_docs)))
  116. readme_deps = $(addsuffix .d, $(basename $(readme_docs)))
  117. html xhtml single_html single_xhtml: $(html_files)
  118. txt text plaintext: $(txt_files)
  119. readme README: ../README
  120. ../README: $(readme_docs) $(readme_deps) $(readme_xsl) $(all_deps)
  121. $(XMLCATALOGX) $(xsltproc) $(xsltproc_flags) \
  122. --xinclude \
  123. $(readme_xsl) $< | $(lynx) $(lynx_flags) -stdin -dump > $@
  124. $(output_dir)/%.html: %.xml %.d $(single_html_xsl) $(all_deps)
  125. $(XMLCATALOGX) $(xsltproc) $(xsltproc_flags) \
  126. --xinclude \
  127. --stringparam base.dir "$(output_dir)/" \
  128. --stringparam root.filename "$(basename $<)" \
  129. --stringparam html.stylesheet "$(html_css)" \
  130. --stringparam html.ext ".html" \
  131. $(single_html_xsl) $<
  132. $(output_dir)/%.txt: %.xml %.d $(txt_xsl) $(all_deps)
  133. $(XMLCATALOGX) $(xsltproc) $(xsltproc_flags) \
  134. --xinclude \
  135. $(txt_xsl) $< | $(lynx) $(lynx_flags) -stdin -dump > $@
  136. %.png: %.dia $(all_dep)
  137. $(dia) $(dia_flags) -t png -e $@ $<
  138. %.d: %.xml $(all_dep)
  139. $(xsltproc) $(xsltproc_flags) \
  140. --nonet \
  141. --novalid \
  142. --stringparam output "$@" \
  143. $(dep_xsl) $<
  144. .PHONY: check
  145. check: $(docs) $(html_docs) $(txt_docs) $(readme_docs)
  146. $(XMLCATALOGX) $(xmllint) $(xmllint_flags) $<
  147. .PHONY: clean
  148. clean:
  149. -@rm -f $(html_files) $(txt_files)
  150. .PHONY: proper realclean distclean maintainer-clean
  151. proper realclean distclean maintainer-clean: clean
  152. -rm -f $(html_deps) $(txt_deps) $(readme_deps) *~
  153. maintainer-clean: clean-tmp
  154. .PHONY: clean-tmp
  155. clean-tmp:
  156. -rm -f TAGS tags *.dbg .*.swp
  157. ifeq (,$(MAKECMDGOALS))
  158. include $(html_deps) $(txt_deps) $(readme_deps)
  159. else
  160. ifeq (,$(strip $(nodep_targets)))
  161. include $(COREPATH)/Makefile.targets
  162. endif
  163. ifneq (,$(filter-out $(nodep_targets) check, $(MAKECMDGOALS)))
  164. include $(html_deps) $(txt_deps) $(readme_deps)
  165. endif
  166. endif