Adding 02-Fix-potential-access-violation.patch from upstream (Closes: #862570).
[debian/menu-cache.git] / gtk-doc.make
CommitLineData
75445cf1
AG
1# -*- mode: makefile -*-
2
3####################################
4# Everything below here is generic #
5####################################
6
7if GTK_DOC_USE_LIBTOOL
8GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
9GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
10GTKDOC_RUN = $(LIBTOOL) --mode=execute
11else
12GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
13GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
14GTKDOC_RUN =
15endif
16
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.
21#
22GPATH = $(srcdir)
23
24TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
25
26SETUP_FILES = \
27 $(content_files) \
28 $(DOC_MAIN_SGML_FILE) \
29 $(DOC_MODULE)-sections.txt \
30 $(DOC_MODULE)-overrides.txt
31
32EXTRA_DIST = \
33 $(HTML_IMAGES) \
34 $(SETUP_FILES)
35
36DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \
37 html-build.stamp pdf-build.stamp \
38 sgml.stamp html.stamp pdf.stamp
39
40SCANOBJ_FILES = \
41 $(DOC_MODULE).args \
42 $(DOC_MODULE).hierarchy \
43 $(DOC_MODULE).interfaces \
44 $(DOC_MODULE).prerequisites \
45 $(DOC_MODULE).signals
46
47REPORT_FILES = \
48 $(DOC_MODULE)-undocumented.txt \
49 $(DOC_MODULE)-undeclared.txt \
50 $(DOC_MODULE)-unused.txt
51
b94f3144
AG
52gtkdoc-check.test: Makefile
53 $(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
54 echo "$(GTKDOC_CHECK_PATH) || exit 1" >> $@; \
55 chmod +x $@
56
57CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) gtkdoc-check.test
75445cf1 58
75445cf1
AG
59if GTK_DOC_BUILD_HTML
60HTML_BUILD_STAMP=html-build.stamp
61else
62HTML_BUILD_STAMP=
63endif
64if GTK_DOC_BUILD_PDF
65PDF_BUILD_STAMP=pdf-build.stamp
66else
67PDF_BUILD_STAMP=
68endif
69
b94f3144
AG
70all-gtk-doc: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
71.PHONY: all-gtk-doc
72
73if ENABLE_GTK_DOC
74all-local: all-gtk-doc
75445cf1
AG
75endif
76
77docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
78
79$(REPORT_FILES): sgml-build.stamp
80
81#### setup ####
82
b94f3144
AG
83GTK_DOC_V_SETUP=$(GTK_DOC_V_SETUP_$(V))
84GTK_DOC_V_SETUP_=$(GTK_DOC_V_SETUP_$(AM_DEFAULT_VERBOSITY))
85GTK_DOC_V_SETUP_0=@echo " DOC Preparing build";
86
75445cf1 87setup-build.stamp:
b94f3144 88 -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
75445cf1
AG
89 files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \
90 if test "x$$files" != "x" ; then \
91 for file in $$files ; do \
b94f3144
AG
92 destdir=`dirname $(abs_builddir)/$$file`; \
93 test -d "$$destdir" || mkdir -p "$$destdir"; \
75445cf1 94 test -f $(abs_srcdir)/$$file && \
b94f3144 95 cp -pf $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \
75445cf1
AG
96 done; \
97 fi; \
98 fi
b94f3144 99 $(AM_V_at)touch setup-build.stamp
75445cf1
AG
100
101
102#### scan ####
103
b94f3144
AG
104GTK_DOC_V_SCAN=$(GTK_DOC_V_SCAN_$(V))
105GTK_DOC_V_SCAN_=$(GTK_DOC_V_SCAN_$(AM_DEFAULT_VERBOSITY))
106GTK_DOC_V_SCAN_0=@echo " DOC Scanning header files";
107
108GTK_DOC_V_INTROSPECT=$(GTK_DOC_V_INTROSPECT_$(V))
109GTK_DOC_V_INTROSPECT_=$(GTK_DOC_V_INTROSPECT_$(AM_DEFAULT_VERBOSITY))
110GTK_DOC_V_INTROSPECT_0=@echo " DOC Introspecting gobjects";
111
112scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
113 $(GTK_DOC_V_SCAN)_source_dir='' ; \
75445cf1
AG
114 for i in $(DOC_SOURCE_DIR) ; do \
115 _source_dir="$${_source_dir} --source-dir=$$i" ; \
116 done ; \
117 gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
b94f3144 118 $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
75445cf1
AG
119 scanobj_options=""; \
120 gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \
121 if test "$(?)" = "0"; then \
122 if test "x$(V)" = "x1"; then \
123 scanobj_options="--verbose"; \
124 fi; \
125 fi; \
126 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
127 gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \
128 else \
129 for i in $(SCANOBJ_FILES) ; do \
130 test -f $$i || touch $$i ; \
131 done \
132 fi
b94f3144 133 $(AM_V_at)touch scan-build.stamp
75445cf1
AG
134
135$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
136 @true
137
138#### xml ####
139
b94f3144
AG
140GTK_DOC_V_XML=$(GTK_DOC_V_XML_$(V))
141GTK_DOC_V_XML_=$(GTK_DOC_V_XML_$(AM_DEFAULT_VERBOSITY))
142GTK_DOC_V_XML_0=@echo " DOC Building XML";
143
75445cf1 144sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
b94f3144 145 $(GTK_DOC_V_XML)_source_dir='' ; \
75445cf1
AG
146 for i in $(DOC_SOURCE_DIR) ; do \
147 _source_dir="$${_source_dir} --source-dir=$$i" ; \
148 done ; \
149 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)
b94f3144 150 $(AM_V_at)touch sgml-build.stamp
75445cf1
AG
151
152sgml.stamp: sgml-build.stamp
153 @true
154
155#### html ####
156
b94f3144
AG
157GTK_DOC_V_HTML=$(GTK_DOC_V_HTML_$(V))
158GTK_DOC_V_HTML_=$(GTK_DOC_V_HTML_$(AM_DEFAULT_VERBOSITY))
159GTK_DOC_V_HTML_0=@echo " DOC Building HTML";
160
161GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V))
162GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY))
163GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references";
164
75445cf1 165html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
b94f3144
AG
166 $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
167 mkhtml_options=""; \
75445cf1
AG
168 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
169 if test "$(?)" = "0"; then \
170 if test "x$(V)" = "x1"; then \
171 mkhtml_options="$$mkhtml_options --verbose"; \
172 fi; \
173 fi; \
174 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
175 if test "$(?)" = "0"; then \
176 mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
177 fi; \
178 cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
179 -@test "x$(HTML_IMAGES)" = "x" || \
180 for file in $(HTML_IMAGES) ; do \
181 if test -f $(abs_srcdir)/$$file ; then \
182 cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
183 fi; \
184 if test -f $(abs_builddir)/$$file ; then \
185 cp $(abs_builddir)/$$file $(abs_builddir)/html; \
186 fi; \
187 done;
b94f3144
AG
188 $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
189 $(AM_V_at)touch html-build.stamp
75445cf1
AG
190
191#### pdf ####
192
b94f3144
AG
193GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V))
194GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY))
195GTK_DOC_V_PDF_0=@echo " DOC Building PDF";
196
75445cf1 197pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
b94f3144
AG
198 $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
199 mkpdf_options=""; \
75445cf1
AG
200 gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \
201 if test "$(?)" = "0"; then \
202 if test "x$(V)" = "x1"; then \
203 mkpdf_options="$$mkpdf_options --verbose"; \
204 fi; \
205 fi; \
206 if test "x$(HTML_IMAGES)" != "x"; then \
207 for img in $(HTML_IMAGES); do \
208 part=`dirname $$img`; \
209 echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
210 if test $$? != 0; then \
211 mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
212 fi; \
213 done; \
214 fi; \
215 gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
b94f3144 216 $(AM_V_at)touch pdf-build.stamp
75445cf1
AG
217
218##############
219
220clean-local:
221 @rm -f *~ *.bak
222 @rm -rf .libs
b94f3144
AG
223 @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
224 rm -f $(DOC_MODULE).types; \
225 fi
75445cf1
AG
226
227distclean-local:
228 @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
229 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
230 @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
231 rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
232 fi
233
b94f3144 234maintainer-clean-local:
75445cf1
AG
235 @rm -rf xml html
236
237install-data-local:
238 @installfiles=`echo $(builddir)/html/*`; \
239 if test "$$installfiles" = '$(builddir)/html/*'; \
240 then echo 1>&2 'Nothing to install' ; \
241 else \
242 if test -n "$(DOC_MODULE_VERSION)"; then \
243 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
244 else \
245 installdir="$(DESTDIR)$(TARGET_DIR)"; \
246 fi; \
247 $(mkinstalldirs) $${installdir} ; \
248 for i in $$installfiles; do \
249 echo ' $(INSTALL_DATA) '$$i ; \
250 $(INSTALL_DATA) $$i $${installdir}; \
251 done; \
252 if test -n "$(DOC_MODULE_VERSION)"; then \
253 mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
254 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
255 fi; \
256 $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
257 fi
258
259uninstall-local:
260 @if test -n "$(DOC_MODULE_VERSION)"; then \
261 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
262 else \
263 installdir="$(DESTDIR)$(TARGET_DIR)"; \
264 fi; \
265 rm -rf $${installdir}
266
267#
268# Require gtk-doc when making dist
269#
b94f3144
AG
270if HAVE_GTK_DOC
271dist-check-gtkdoc: docs
75445cf1
AG
272else
273dist-check-gtkdoc:
b94f3144
AG
274 @echo "*** gtk-doc is needed to run 'make dist'. ***"
275 @echo "*** gtk-doc was not found when 'configure' ran. ***"
276 @echo "*** please install gtk-doc and rerun 'configure'. ***"
75445cf1
AG
277 @false
278endif
279
b94f3144 280dist-hook: dist-check-gtkdoc all-gtk-doc dist-hook-local
75445cf1
AG
281 @mkdir $(distdir)/html
282 @cp ./html/* $(distdir)/html
283 @-cp ./$(DOC_MODULE).pdf $(distdir)/
284 @-cp ./$(DOC_MODULE).types $(distdir)/
285 @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/
286 @cd $(distdir) && rm -f $(DISTCLEANFILES)
287 @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
288
289.PHONY : dist-hook-local docs