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