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)
29 $(DOC_MAIN_SGML_FILE) \
30 $(DOC_MODULE)-sections.txt \
31 $(DOC_MODULE)-overrides.txt
33 DOC_STAMPS=scan-build.stamp sgml-build.stamp html-build.stamp pdf-build.stamp \
34 $(srcdir)/sgml.stamp $(srcdir)/html.stamp \
39 $(DOC_MODULE).hierarchy \
40 $(DOC_MODULE).interfaces \
41 $(DOC_MODULE).prerequisites \
45 $(DOC_MODULE)-undocumented.txt \
46 $(DOC_MODULE)-undeclared.txt \
47 $(DOC_MODULE)-unused.txt
49 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
53 HTML_BUILD_STAMP=html-build.stamp
58 PDF_BUILD_STAMP=pdf-build.stamp
63 all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
68 docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
70 $(REPORT_FILES): sgml-build.stamp
74 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
75 @echo 'gtk-doc: Scanning header files'
76 @-chmod -R u+w $(srcdir)
77 @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \
78 _source_dir="$${_source_dir} --source-dir=$$i" ; \
81 gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
82 @if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
83 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) ; \
86 for i in $(SCANOBJ_FILES) ; do \
87 test -f $$i || touch $$i ; \
90 @touch scan-build.stamp
92 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
97 sgml-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
98 @echo 'gtk-doc: Building XML'
99 @-chmod -R u+w $(srcdir)
100 @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \
101 _source_dir="$${_source_dir} --source-dir=$$i" ; \
104 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)
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
116 @mkdir $(srcdir)/html
117 @mkhtml_options=""; \
118 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
119 if test "$(?)" = "0"; then \
120 mkhtml_options=--path="$(srcdir)"; \
122 cd $(srcdir)/html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
123 @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
124 @echo 'gtk-doc: Fixing cross-references'
125 @cd $(srcdir) && gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
126 @touch html-build.stamp
130 pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
131 @echo 'gtk-doc: Building PDF'
132 @-chmod -R u+w $(srcdir)
133 @rm -rf $(srcdir)/$(DOC_MODULE).pdf
135 if test "x$(HTML_IMAGES)" != "x"; then \
136 for img in $(HTML_IMAGES); do \
137 part=`dirname $$img`; \
138 echo $$mkpdf_imgdirs | grep >/dev/null "\-\-imgdir=$$part "; \
139 if test $$? != 0; then \
140 mkpdf_imgdirs="$$mkpdf_imgdirs --imgdir=$$part"; \
144 cd $(srcdir) && gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_imgdirs $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
145 @touch pdf-build.stamp
155 rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \
156 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
158 maintainer-clean-local: clean
159 cd $(srcdir) && rm -rf html
162 @installfiles=`echo $(srcdir)/html/*`; \
163 if test "$$installfiles" = '$(srcdir)/html/*'; \
164 then echo '-- Nothing to install' ; \
166 if test -n "$(DOC_MODULE_VERSION)"; then \
167 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
169 installdir="$(DESTDIR)$(TARGET_DIR)"; \
171 $(mkinstalldirs) $${installdir} ; \
172 for i in $$installfiles; do \
173 echo '-- Installing '$$i ; \
174 $(INSTALL_DATA) $$i $${installdir}; \
176 if test -n "$(DOC_MODULE_VERSION)"; then \
177 mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
178 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
179 mv -f $${installdir}/$(DOC_MODULE).devhelp \
180 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \
182 $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
186 @if test -n "$(DOC_MODULE_VERSION)"; then \
187 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
189 installdir="$(DESTDIR)$(TARGET_DIR)"; \
191 rm -rf $${installdir}
194 # Require gtk-doc when making dist
200 @echo "*** gtk-doc must be installed and enabled in order to make dist"
204 dist-hook: dist-check-gtkdoc dist-hook-local
205 mkdir $(distdir)/html
206 cp $(srcdir)/html/* $(distdir)/html
207 -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/
208 -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
209 -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
210 cd $(distdir) && rm -f $(DISTCLEANFILES)
211 $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
213 .PHONY : dist-hook-local docs