1 # -*- mode: makefile -*-
3 ####################################
4 # Everything below here is generic #
5 ####################################
8 GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
9 GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
10 GTKDOC_RUN = $(LIBTOOL) --mode=execute
12 GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
13 GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
17 # We set GPATH here; this gives us semantics for GNU make
18 # which are more like other make's VPATH, when it comes to
19 # whether a source that is a target of one rule is then
20 # searched for in VPATH/GPATH.
24 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
26 EXTRA_DIST= $(content_files) \
28 $(DOC_MAIN_SGML_FILE) \
29 $(DOC_MODULE)-sections.txt \
30 $(DOC_MODULE)-overrides.txt
32 DOC_STAMPS=scan-build.stamp sgml-build.stamp html-build.stamp pdf-build.stamp \
33 $(srcdir)/sgml.stamp $(srcdir)/html.stamp \
38 $(DOC_MODULE).hierarchy \
39 $(DOC_MODULE).interfaces \
40 $(DOC_MODULE).prerequisites \
44 $(DOC_MODULE)-undocumented.txt \
45 $(DOC_MODULE)-undeclared.txt \
46 $(DOC_MODULE)-unused.txt
48 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
52 HTML_BUILD_STAMP=html-build.stamp
57 PDF_BUILD_STAMP=pdf-build.stamp
62 all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
67 docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
69 $(REPORT_FILES): sgml-build.stamp
73 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
74 @echo 'gtk-doc: Scanning header files'
75 @-chmod -R u+w $(srcdir)
77 gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
78 @if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
79 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
82 for i in $(SCANOBJ_FILES) ; do \
83 test -f $$i || touch $$i ; \
86 @touch scan-build.stamp
88 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
93 sgml-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
94 @echo 'gtk-doc: Building XML'
95 @-chmod -R u+w $(srcdir)
97 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)
98 @touch sgml-build.stamp
100 sgml.stamp: sgml-build.stamp
105 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
106 @echo 'gtk-doc: Building HTML'
107 @-chmod -R u+w $(srcdir)
108 @rm -rf $(srcdir)/html
109 @mkdir $(srcdir)/html
110 @mkhtml_options=""; \
111 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
112 if test "$(?)" = "0"; then \
113 mkhtml_options=--path="$(srcdir)"; \
115 cd $(srcdir)/html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
116 @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
117 @echo 'gtk-doc: Fixing cross-references'
118 @cd $(srcdir) && gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
119 @touch html-build.stamp
123 pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
124 @echo 'gtk-doc: Building PDF'
125 @-chmod -R u+w $(srcdir)
126 @rm -rf $(srcdir)/$(DOC_MODULE).pdf
128 if test "x$(HTML_IMAGES)" != "x"; then \
129 for img in $(HTML_IMAGES); do \
130 part=`dirname $$img`; \
131 echo $$mkpdf_imgdirs | grep >/dev/null "\-\-imgdir=$$part "; \
132 if test $$? != 0; then \
133 mkpdf_imgdirs="$$mkpdf_imgdirs --imgdir=$$part"; \
137 cd $(srcdir) && gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_imgdirs $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
138 @touch pdf-build.stamp
148 rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \
149 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
151 maintainer-clean-local: clean
152 cd $(srcdir) && rm -rf html
155 @installfiles=`echo $(srcdir)/html/*`; \
156 if test "$$installfiles" = '$(srcdir)/html/*'; \
157 then echo '-- Nothing to install' ; \
159 if test -n "$(DOC_MODULE_VERSION)"; then \
160 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
162 installdir="$(DESTDIR)$(TARGET_DIR)"; \
164 $(mkinstalldirs) $${installdir} ; \
165 for i in $$installfiles; do \
166 echo '-- Installing '$$i ; \
167 $(INSTALL_DATA) $$i $${installdir}; \
169 if test -n "$(DOC_MODULE_VERSION)"; then \
170 mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
171 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
172 mv -f $${installdir}/$(DOC_MODULE).devhelp \
173 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \
175 $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
179 @if test -n "$(DOC_MODULE_VERSION)"; then \
180 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
182 installdir="$(DESTDIR)$(TARGET_DIR)"; \
184 rm -rf $${installdir}
187 # Require gtk-doc when making dist
193 @echo "*** gtk-doc must be installed and enabled in order to make dist"
197 dist-hook: dist-check-gtkdoc dist-hook-local
198 mkdir $(distdir)/html
199 cp $(srcdir)/html/* $(distdir)/html
200 -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/ 2> /dev/null
201 -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
202 -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
203 cd $(distdir) && rm -f $(DISTCLEANFILES)
204 $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
206 .PHONY : dist-hook-local docs