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.
 
 
 
 
 
 

290 lines
9.2 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. gtkdoc-check.test: Makefile
  43. $(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
  44. echo "$(GTKDOC_CHECK_PATH) || exit 1" >> $@; \
  45. chmod +x $@
  46. CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) gtkdoc-check.test
  47. if GTK_DOC_BUILD_HTML
  48. HTML_BUILD_STAMP=html-build.stamp
  49. else
  50. HTML_BUILD_STAMP=
  51. endif
  52. if GTK_DOC_BUILD_PDF
  53. PDF_BUILD_STAMP=pdf-build.stamp
  54. else
  55. PDF_BUILD_STAMP=
  56. endif
  57. all-gtk-doc: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
  58. .PHONY: all-gtk-doc
  59. if ENABLE_GTK_DOC
  60. all-local: all-gtk-doc
  61. endif
  62. docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
  63. $(REPORT_FILES): sgml-build.stamp
  64. #### setup ####
  65. GTK_DOC_V_SETUP=$(GTK_DOC_V_SETUP_$(V))
  66. GTK_DOC_V_SETUP_=$(GTK_DOC_V_SETUP_$(AM_DEFAULT_VERBOSITY))
  67. GTK_DOC_V_SETUP_0=@echo " DOC Preparing build";
  68. setup-build.stamp:
  69. -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
  70. files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \
  71. if test "x$$files" != "x" ; then \
  72. for file in $$files ; do \
  73. destdir=`dirname $(abs_builddir)/$$file`; \
  74. test -d "$$destdir" || mkdir -p "$$destdir"; \
  75. test -f $(abs_srcdir)/$$file && \
  76. cp -pf $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \
  77. done; \
  78. fi; \
  79. fi
  80. $(AM_V_at)touch setup-build.stamp
  81. #### scan ####
  82. GTK_DOC_V_SCAN=$(GTK_DOC_V_SCAN_$(V))
  83. GTK_DOC_V_SCAN_=$(GTK_DOC_V_SCAN_$(AM_DEFAULT_VERBOSITY))
  84. GTK_DOC_V_SCAN_0=@echo " DOC Scanning header files";
  85. GTK_DOC_V_INTROSPECT=$(GTK_DOC_V_INTROSPECT_$(V))
  86. GTK_DOC_V_INTROSPECT_=$(GTK_DOC_V_INTROSPECT_$(AM_DEFAULT_VERBOSITY))
  87. GTK_DOC_V_INTROSPECT_0=@echo " DOC Introspecting gobjects";
  88. scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
  89. $(GTK_DOC_V_SCAN)_source_dir='' ; \
  90. for i in $(DOC_SOURCE_DIR) ; do \
  91. _source_dir="$${_source_dir} --source-dir=$$i" ; \
  92. done ; \
  93. gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
  94. $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
  95. scanobj_options=""; \
  96. gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \
  97. if test "$(?)" = "0"; then \
  98. if test "x$(V)" = "x1"; then \
  99. scanobj_options="--verbose"; \
  100. fi; \
  101. fi; \
  102. CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
  103. gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \
  104. else \
  105. for i in $(SCANOBJ_FILES) ; do \
  106. test -f $$i || touch $$i ; \
  107. done \
  108. fi
  109. $(AM_V_at)touch scan-build.stamp
  110. $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
  111. @true
  112. #### xml ####
  113. GTK_DOC_V_XML=$(GTK_DOC_V_XML_$(V))
  114. GTK_DOC_V_XML_=$(GTK_DOC_V_XML_$(AM_DEFAULT_VERBOSITY))
  115. GTK_DOC_V_XML_0=@echo " DOC Building XML";
  116. sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
  117. $(GTK_DOC_V_XML)_source_dir='' ; \
  118. for i in $(DOC_SOURCE_DIR) ; do \
  119. _source_dir="$${_source_dir} --source-dir=$$i" ; \
  120. done ; \
  121. 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)
  122. $(AM_V_at)touch sgml-build.stamp
  123. sgml.stamp: sgml-build.stamp
  124. @true
  125. #### html ####
  126. GTK_DOC_V_HTML=$(GTK_DOC_V_HTML_$(V))
  127. GTK_DOC_V_HTML_=$(GTK_DOC_V_HTML_$(AM_DEFAULT_VERBOSITY))
  128. GTK_DOC_V_HTML_0=@echo " DOC Building HTML";
  129. GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V))
  130. GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY))
  131. GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references";
  132. html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
  133. $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
  134. mkhtml_options=""; \
  135. gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
  136. if test "$(?)" = "0"; then \
  137. if test "x$(V)" = "x1"; then \
  138. mkhtml_options="$$mkhtml_options --verbose"; \
  139. fi; \
  140. fi; \
  141. gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
  142. if test "$(?)" = "0"; then \
  143. mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
  144. fi; \
  145. cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
  146. -@test "x$(HTML_IMAGES)" = "x" || \
  147. for file in $(HTML_IMAGES) ; do \
  148. if test -f $(abs_srcdir)/$$file ; then \
  149. cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
  150. fi; \
  151. if test -f $(abs_builddir)/$$file ; then \
  152. cp $(abs_builddir)/$$file $(abs_builddir)/html; \
  153. fi; \
  154. done;
  155. $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
  156. $(AM_V_at)touch html-build.stamp
  157. #### pdf ####
  158. GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V))
  159. GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY))
  160. GTK_DOC_V_PDF_0=@echo " DOC Building PDF";
  161. pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
  162. $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
  163. mkpdf_options=""; \
  164. gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \
  165. if test "$(?)" = "0"; then \
  166. if test "x$(V)" = "x1"; then \
  167. mkpdf_options="$$mkpdf_options --verbose"; \
  168. fi; \
  169. fi; \
  170. if test "x$(HTML_IMAGES)" != "x"; then \
  171. for img in $(HTML_IMAGES); do \
  172. part=`dirname $$img`; \
  173. echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
  174. if test $$? != 0; then \
  175. mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
  176. fi; \
  177. done; \
  178. fi; \
  179. gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
  180. $(AM_V_at)touch pdf-build.stamp
  181. ##############
  182. clean-local:
  183. @rm -f *~ *.bak
  184. @rm -rf .libs
  185. @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
  186. rm -f $(DOC_MODULE).types; \
  187. fi
  188. distclean-local:
  189. @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
  190. $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
  191. @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
  192. rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
  193. fi
  194. maintainer-clean-local:
  195. @rm -rf xml html
  196. install-data-local:
  197. @installfiles=`echo $(builddir)/html/*`; \
  198. if test "$$installfiles" = '$(builddir)/html/*'; \
  199. then echo 1>&2 'Nothing to install' ; \
  200. else \
  201. if test -n "$(DOC_MODULE_VERSION)"; then \
  202. installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
  203. else \
  204. installdir="$(DESTDIR)$(TARGET_DIR)"; \
  205. fi; \
  206. $(mkinstalldirs) $${installdir} ; \
  207. for i in $$installfiles; do \
  208. echo ' $(INSTALL_DATA) '$$i ; \
  209. $(INSTALL_DATA) $$i $${installdir}; \
  210. done; \
  211. if test -n "$(DOC_MODULE_VERSION)"; then \
  212. mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
  213. $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
  214. fi; \
  215. $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
  216. fi
  217. uninstall-local:
  218. @if test -n "$(DOC_MODULE_VERSION)"; then \
  219. installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
  220. else \
  221. installdir="$(DESTDIR)$(TARGET_DIR)"; \
  222. fi; \
  223. rm -rf $${installdir}
  224. #
  225. # Require gtk-doc when making dist
  226. #
  227. if HAVE_GTK_DOC
  228. dist-check-gtkdoc: docs
  229. else
  230. dist-check-gtkdoc:
  231. @echo "*** gtk-doc is needed to run 'make dist'. ***"
  232. @echo "*** gtk-doc was not found when 'configure' ran. ***"
  233. @echo "*** please install gtk-doc and rerun 'configure'. ***"
  234. @false
  235. endif
  236. dist-hook: dist-check-gtkdoc all-gtk-doc dist-hook-local
  237. @mkdir $(distdir)/html
  238. @cp ./html/* $(distdir)/html
  239. @-cp ./$(DOC_MODULE).pdf $(distdir)/
  240. @-cp ./$(DOC_MODULE).types $(distdir)/
  241. @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/
  242. @cd $(distdir) && rm -f $(DISTCLEANFILES)
  243. @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
  244. .PHONY : dist-hook-local docs