You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

257 lines
7.7 KiB

  1. # -*- mode: makefile -*-
  2. ####################################
  3. # Everything below here is generic #
  4. ####################################
  5. if GTK_DOC_USE_LIBTOOL
  6. GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  7. GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
  8. GTKDOC_RUN = $(LIBTOOL) --mode=execute
  9. else
  10. GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  11. GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
  12. GTKDOC_RUN =
  13. endif
  14. # We set GPATH here; this gives us semantics for GNU make
  15. # which are more like other make's VPATH, when it comes to
  16. # whether a source that is a target of one rule is then
  17. # searched for in VPATH/GPATH.
  18. #
  19. GPATH = $(srcdir)
  20. TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
  21. SETUP_FILES = \
  22. $(content_files) \
  23. $(DOC_MAIN_SGML_FILE) \
  24. $(DOC_MODULE)-sections.txt \
  25. $(DOC_MODULE)-overrides.txt
  26. EXTRA_DIST = \
  27. $(HTML_IMAGES) \
  28. $(SETUP_FILES)
  29. DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \
  30. html-build.stamp pdf-build.stamp \
  31. sgml.stamp html.stamp pdf.stamp
  32. SCANOBJ_FILES = \
  33. $(DOC_MODULE).args \
  34. $(DOC_MODULE).hierarchy \
  35. $(DOC_MODULE).interfaces \
  36. $(DOC_MODULE).prerequisites \
  37. $(DOC_MODULE).signals
  38. REPORT_FILES = \
  39. $(DOC_MODULE)-undocumented.txt \
  40. $(DOC_MODULE)-undeclared.txt \
  41. $(DOC_MODULE)-unused.txt
  42. CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
  43. if ENABLE_GTK_DOC
  44. if GTK_DOC_BUILD_HTML
  45. HTML_BUILD_STAMP=html-build.stamp
  46. else
  47. HTML_BUILD_STAMP=
  48. endif
  49. if GTK_DOC_BUILD_PDF
  50. PDF_BUILD_STAMP=pdf-build.stamp
  51. else
  52. PDF_BUILD_STAMP=
  53. endif
  54. all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
  55. else
  56. all-local:
  57. endif
  58. docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
  59. $(REPORT_FILES): sgml-build.stamp
  60. #### setup ####
  61. setup-build.stamp:
  62. -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
  63. echo ' DOC Preparing build'; \
  64. files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \
  65. if test "x$$files" != "x" ; then \
  66. for file in $$files ; do \
  67. test -f $(abs_srcdir)/$$file && \
  68. cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \
  69. done; \
  70. fi; \
  71. fi
  72. @touch setup-build.stamp
  73. #### scan ####
  74. scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
  75. @echo ' DOC Scanning header files'
  76. @_source_dir='' ; \
  77. for i in $(DOC_SOURCE_DIR) ; do \
  78. _source_dir="$${_source_dir} --source-dir=$$i" ; \
  79. done ; \
  80. gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
  81. @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
  82. echo " DOC Introspecting gobjects"; \
  83. scanobj_options=""; \
  84. gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \
  85. if test "$(?)" = "0"; then \
  86. if test "x$(V)" = "x1"; then \
  87. scanobj_options="--verbose"; \
  88. fi; \
  89. fi; \
  90. CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
  91. gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \
  92. else \
  93. for i in $(SCANOBJ_FILES) ; do \
  94. test -f $$i || touch $$i ; \
  95. done \
  96. fi
  97. @touch scan-build.stamp
  98. $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
  99. @true
  100. #### xml ####
  101. sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
  102. @echo ' DOC Building XML'
  103. @_source_dir='' ; \
  104. for i in $(DOC_SOURCE_DIR) ; do \
  105. _source_dir="$${_source_dir} --source-dir=$$i" ; \
  106. done ; \
  107. gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS)
  108. @touch sgml-build.stamp
  109. sgml.stamp: sgml-build.stamp
  110. @true
  111. #### html ####
  112. html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
  113. @echo ' DOC Building HTML'
  114. @rm -rf html
  115. @mkdir html
  116. @mkhtml_options=""; \
  117. gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
  118. if test "$(?)" = "0"; then \
  119. if test "x$(V)" = "x1"; then \
  120. mkhtml_options="$$mkhtml_options --verbose"; \
  121. fi; \
  122. fi; \
  123. gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
  124. if test "$(?)" = "0"; then \
  125. mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
  126. fi; \
  127. cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
  128. -@test "x$(HTML_IMAGES)" = "x" || \
  129. for file in $(HTML_IMAGES) ; do \
  130. if test -f $(abs_srcdir)/$$file ; then \
  131. cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
  132. fi; \
  133. if test -f $(abs_builddir)/$$file ; then \
  134. cp $(abs_builddir)/$$file $(abs_builddir)/html; \
  135. fi; \
  136. done;
  137. @echo ' DOC Fixing cross-references'
  138. @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
  139. @touch html-build.stamp
  140. #### pdf ####
  141. pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
  142. @echo ' DOC Building PDF'
  143. @rm -f $(DOC_MODULE).pdf
  144. @mkpdf_options=""; \
  145. gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \
  146. if test "$(?)" = "0"; then \
  147. if test "x$(V)" = "x1"; then \
  148. mkpdf_options="$$mkpdf_options --verbose"; \
  149. fi; \
  150. fi; \
  151. if test "x$(HTML_IMAGES)" != "x"; then \
  152. for img in $(HTML_IMAGES); do \
  153. part=`dirname $$img`; \
  154. echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
  155. if test $$? != 0; then \
  156. mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
  157. fi; \
  158. done; \
  159. fi; \
  160. gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
  161. @touch pdf-build.stamp
  162. ##############
  163. clean-local:
  164. @rm -f *~ *.bak
  165. @rm -rf .libs
  166. distclean-local:
  167. @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
  168. $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
  169. @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
  170. rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
  171. fi
  172. maintainer-clean-local: clean
  173. @rm -rf xml html
  174. install-data-local:
  175. @installfiles=`echo $(builddir)/html/*`; \
  176. if test "$$installfiles" = '$(builddir)/html/*'; \
  177. then echo 1>&2 'Nothing to install' ; \
  178. else \
  179. if test -n "$(DOC_MODULE_VERSION)"; then \
  180. installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
  181. else \
  182. installdir="$(DESTDIR)$(TARGET_DIR)"; \
  183. fi; \
  184. $(mkinstalldirs) $${installdir} ; \
  185. for i in $$installfiles; do \
  186. echo ' $(INSTALL_DATA) '$$i ; \
  187. $(INSTALL_DATA) $$i $${installdir}; \
  188. done; \
  189. if test -n "$(DOC_MODULE_VERSION)"; then \
  190. mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
  191. $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
  192. fi; \
  193. $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
  194. fi
  195. uninstall-local:
  196. @if test -n "$(DOC_MODULE_VERSION)"; then \
  197. installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
  198. else \
  199. installdir="$(DESTDIR)$(TARGET_DIR)"; \
  200. fi; \
  201. rm -rf $${installdir}
  202. #
  203. # Require gtk-doc when making dist
  204. #
  205. if ENABLE_GTK_DOC
  206. dist-check-gtkdoc:
  207. else
  208. dist-check-gtkdoc:
  209. @echo "*** gtk-doc must be installed and enabled in order to make dist"
  210. @false
  211. endif
  212. dist-hook: dist-check-gtkdoc dist-hook-local
  213. @mkdir $(distdir)/html
  214. @cp ./html/* $(distdir)/html
  215. @-cp ./$(DOC_MODULE).pdf $(distdir)/
  216. @-cp ./$(DOC_MODULE).types $(distdir)/
  217. @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/
  218. @cd $(distdir) && rm -f $(DISTCLEANFILES)
  219. @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
  220. .PHONY : dist-hook-local docs