1 # Modified for cairo minimally:
3 # - Made it append to EXTRA_DIST and CLEANFILES
4 # - Instead of all-local, make "doc" build docs, and err if gtk-doc not enabled
6 # -*- mode: makefile -*-
8 ####################################
9 # Everything below here is generic #
10 ####################################
12 if GTK_DOC_USE_LIBTOOL
13 GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
14 GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
16 GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
17 GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
20 # We set GPATH here; this gives us semantics for GNU make
21 # which are more like other make's VPATH, when it comes to
22 # whether a source that is a target of one rule is then
23 # searched for in VPATH/GPATH.
27 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
32 $(DOC_MAIN_SGML_FILE) \
33 $(DOC_MODULE)-sections.txt \
34 $(DOC_MODULE)-overrides.txt
36 DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
37 $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
41 $(DOC_MODULE).hierarchy \
42 $(DOC_MODULE).interfaces \
43 $(DOC_MODULE).prerequisites \
47 $(DOC_MODULE)-undocumented.txt \
48 $(DOC_MODULE)-undeclared.txt \
49 $(DOC_MODULE)-unused.txt
51 CLEANFILES += $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
57 @echo "*** gtk-doc must be installed and enabled in order to make doc"
61 docs: html-build.stamp
65 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
66 @echo 'gtk-doc: Scanning header files'
67 @-chmod -R u+w $(srcdir)
69 gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
70 if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
71 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
74 for i in $(SCANOBJ_FILES) ; do \
75 test -f $$i || touch $$i ; \
78 touch scan-build.stamp
80 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
85 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
86 @echo 'gtk-doc: Rebuilding template files'
87 @-chmod -R u+w $(srcdir)
88 cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
89 touch tmpl-build.stamp
91 tmpl.stamp: tmpl-build.stamp
100 sgml-build.stamp: tmpl.stamp $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files)
101 @echo 'gtk-doc: Building XML'
102 @-chmod -R u+w $(srcdir)
104 gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS)
105 touch sgml-build.stamp
107 sgml.stamp: sgml-build.stamp
112 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
113 @echo 'gtk-doc: Building HTML'
114 @-chmod -R u+w $(srcdir)
115 rm -rf $(srcdir)/html
117 cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
118 test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
119 @echo 'gtk-doc: Fixing cross-references'
120 cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
121 touch html-build.stamp
131 rm -rf xml $(REPORT_FILES) \
132 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
134 maintainer-clean-local: clean
135 cd $(srcdir) && rm -rf xml html
138 -installfiles=`echo $(srcdir)/html/*`; \
139 if test "$$installfiles" = '$(srcdir)/html/*'; \
140 then echo '-- Nothing to install' ; \
142 $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
143 for i in $$installfiles; do \
144 echo '-- Installing '$$i ; \
145 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
147 echo '-- Installing $(srcdir)/html/index.sgml' ; \
148 $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \
149 which gtkdoc-rebase >/dev/null && \
150 gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR) ; \
155 rm -f $(DESTDIR)$(TARGET_DIR)/*
158 # Require gtk-doc when making dist
164 @echo "*** gtk-doc must be installed and enabled in order to make dist"
168 dist-hook: dist-check-gtkdoc dist-hook-local
169 mkdir $(distdir)/tmpl
171 mkdir $(distdir)/html
172 -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
173 -cp $(srcdir)/xml/*.xml $(distdir)/xml
174 cp $(srcdir)/html/* $(distdir)/html
175 -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
176 -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
177 cd $(distdir) && rm -f $(DISTCLEANFILES)
178 -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
180 .PHONY : dist-hook-local docs