configura.ac: remove comment
[gtk-doc.git] / gtk-doc.make
blobb091d8871ce556bc0cca85ae00cc42cedc650141
1 # -*- mode: makefile -*-
3 ####################################
4 # Everything below here is generic #
5 ####################################
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
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.
22 GPATH = $(srcdir)
24 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
26 SETUP_FILES = \
27 $(content_files) \
28 $(expand_content_files) \
29 $(DOC_MAIN_SGML_FILE) \
30 $(DOC_MODULE)-sections.txt \
31 $(DOC_MODULE)-overrides.txt
33 EXTRA_DIST = \
34 $(HTML_IMAGES) \
35 $(SETUP_FILES)
37 DOC_STAMPS=setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \
38 html-build.stamp pdf-build.stamp \
39 tmpl.stamp sgml.stamp html.stamp pdf.stamp
41 SCANOBJ_FILES = \
42 $(DOC_MODULE).args \
43 $(DOC_MODULE).hierarchy \
44 $(DOC_MODULE).interfaces \
45 $(DOC_MODULE).prerequisites \
46 $(DOC_MODULE).signals
48 REPORT_FILES = \
49 $(DOC_MODULE)-undocumented.txt \
50 $(DOC_MODULE)-undeclared.txt \
51 $(DOC_MODULE)-unused.txt
53 gtkdoc-check.test: Makefile
54 $(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
55 echo "$(GTKDOC_CHECK_PATH) || exit 1" >> $@; \
56 chmod +x $@
58 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) gtkdoc-check.test
60 if GTK_DOC_BUILD_HTML
61 HTML_BUILD_STAMP=html-build.stamp
62 else
63 HTML_BUILD_STAMP=
64 endif
65 if GTK_DOC_BUILD_PDF
66 PDF_BUILD_STAMP=pdf-build.stamp
67 else
68 PDF_BUILD_STAMP=
69 endif
71 all-gtk-doc: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
72 .PHONY: all-gtk-doc
74 if ENABLE_GTK_DOC
75 all-local: all-gtk-doc
76 endif
78 docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
80 $(REPORT_FILES): sgml-build.stamp
82 #### setup ####
84 GTK_DOC_V_SETUP=$(GTK_DOC_V_SETUP_$(V))
85 GTK_DOC_V_SETUP_=$(GTK_DOC_V_SETUP_$(AM_DEFAULT_VERBOSITY))
86 GTK_DOC_V_SETUP_0=@echo " DOC Preparing build";
88 setup-build.stamp:
89 -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
90 files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
91 if test "x$$files" != "x" ; then \
92 for file in $$files ; do \
93 destdir=`dirname $(abs_builddir)/$$file`; \
94 test -d "$$destdir" || mkdir -p "$$destdir"; \
95 test -f $(abs_srcdir)/$$file && \
96 cp -pf $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \
97 done; \
98 fi; \
99 test -d $(abs_srcdir)/tmpl && \
100 { cp -pR $(abs_srcdir)/tmpl $(abs_builddir)/; \
101 chmod -R u+w $(abs_builddir)/tmpl; } \
103 $(AM_V_at)touch setup-build.stamp
105 #### scan ####
107 GTK_DOC_V_SCAN=$(GTK_DOC_V_SCAN_$(V))
108 GTK_DOC_V_SCAN_=$(GTK_DOC_V_SCAN_$(AM_DEFAULT_VERBOSITY))
109 GTK_DOC_V_SCAN_0=@echo " DOC Scanning header files";
111 GTK_DOC_V_INTROSPECT=$(GTK_DOC_V_INTROSPECT_$(V))
112 GTK_DOC_V_INTROSPECT_=$(GTK_DOC_V_INTROSPECT_$(AM_DEFAULT_VERBOSITY))
113 GTK_DOC_V_INTROSPECT_0=@echo " DOC Introspecting gobjects";
115 scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
116 $(GTK_DOC_V_SCAN)_source_dir='' ; \
117 for i in $(DOC_SOURCE_DIR) ; do \
118 _source_dir="$${_source_dir} --source-dir=$$i" ; \
119 done ; \
120 gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
121 $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
122 scanobj_options=""; \
123 gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \
124 if test "$$?" = "0"; then \
125 if test "x$(V)" = "x1"; then \
126 scanobj_options="--verbose"; \
127 fi; \
128 fi; \
129 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
130 gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \
131 else \
132 for i in $(SCANOBJ_FILES) ; do \
133 test -f $$i || touch $$i ; \
134 done \
136 $(AM_V_at)touch scan-build.stamp
138 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
139 @true
141 #### templates ####
143 GTK_DOC_V_TMPL=$(GTK_DOC_V_TMPL_$(V))
144 GTK_DOC_V_TMPL_=$(GTK_DOC_V_TMPL_$(AM_DEFAULT_VERBOSITY))
145 GTK_DOC_V_TMPL_0=@echo " DOC Rebuilding template files";
147 tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
148 $(GTK_DOC_V_TMPL)gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
149 $(AM_V_at)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
150 if test -w $(abs_srcdir) ; then \
151 cp -pR $(abs_builddir)/tmpl $(abs_srcdir)/; \
152 fi \
154 $(AM_V_at)touch tmpl-build.stamp
156 tmpl.stamp: tmpl-build.stamp
157 @true
159 $(srcdir)/tmpl/*.sgml:
160 @true
162 #### xml ####
164 GTK_DOC_V_XML=$(GTK_DOC_V_XML_$(V))
165 GTK_DOC_V_XML_=$(GTK_DOC_V_XML_$(AM_DEFAULT_VERBOSITY))
166 GTK_DOC_V_XML_0=@echo " DOC Building XML";
168 sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) xml/gtkdocentities.ent
169 -$(GTK_DOC_V_XML)chmod -R u+w $(srcdir) && _source_dir='' ; \
170 for i in $(DOC_SOURCE_DIR) ; do \
171 _source_dir="$${_source_dir} --source-dir=$$i" ; \
172 done ; \
173 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)
174 $(AM_V_at)touch sgml-build.stamp
176 sgml.stamp: sgml-build.stamp
177 @true
179 xml/gtkdocentities.ent: Makefile
180 $(GTK_DOC_V_XML)$(MKDIR_P) $(@D) && ( \
181 echo "<!ENTITY package \"$(PACKAGE)\">"; \
182 echo "<!ENTITY package_bugreport \"$(PACKAGE_BUGREPORT)\">"; \
183 echo "<!ENTITY package_name \"$(PACKAGE_NAME)\">"; \
184 echo "<!ENTITY package_string \"$(PACKAGE_STRING)\">"; \
185 echo "<!ENTITY package_tarname \"$(PACKAGE_TARNAME)\">"; \
186 echo "<!ENTITY package_url \"$(PACKAGE_URL)\">"; \
187 echo "<!ENTITY package_version \"$(PACKAGE_VERSION)\">"; \
188 ) > $@
190 #### html ####
192 GTK_DOC_V_HTML=$(GTK_DOC_V_HTML_$(V))
193 GTK_DOC_V_HTML_=$(GTK_DOC_V_HTML_$(AM_DEFAULT_VERBOSITY))
194 GTK_DOC_V_HTML_0=@echo " DOC Building HTML";
196 GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V))
197 GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY))
198 GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references";
200 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
201 $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
202 mkhtml_options=""; \
203 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
204 if test "$$?" = "0"; then \
205 if test "x$(V)" = "x1"; then \
206 mkhtml_options="$$mkhtml_options --verbose"; \
207 fi; \
208 fi; \
209 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
210 if test "$$?" = "0"; then \
211 mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
212 fi; \
213 cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
214 -@test "x$(HTML_IMAGES)" = "x" || \
215 for file in $(HTML_IMAGES) ; do \
216 test -f $(abs_srcdir)/$$file && cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
217 test -f $(abs_builddir)/$$file && cp $(abs_builddir)/$$file $(abs_builddir)/html; \
218 done;
219 $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
220 $(AM_V_at)touch html-build.stamp
222 #### pdf ####
224 GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V))
225 GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY))
226 GTK_DOC_V_PDF_0=@echo " DOC Building PDF";
228 pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
229 $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
230 mkpdf_options=""; \
231 gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \
232 if test "$$?" = "0"; then \
233 if test "x$(V)" = "x1"; then \
234 mkpdf_options="$$mkpdf_options --verbose"; \
235 fi; \
236 fi; \
237 if test "x$(HTML_IMAGES)" != "x"; then \
238 for img in $(HTML_IMAGES); do \
239 part=`dirname $$img`; \
240 echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
241 if test $$? != 0; then \
242 mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
243 fi; \
244 done; \
245 fi; \
246 gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
247 $(AM_V_at)touch pdf-build.stamp
249 ##############
251 clean-local:
252 @rm -f *~ *.bak
253 @rm -rf .libs
254 @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
255 rm -f $(DOC_MODULE).types; \
257 @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \
258 rm -f $(DOC_MODULE)-sections.txt; \
261 distclean-local:
262 @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
263 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
264 @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
265 rm -f $(SETUP_FILES) $(DOC_MODULE).types; \
266 rm -rf tmpl; \
269 maintainer-clean-local:
270 @rm -rf xml html
272 install-data-local:
273 @installfiles=`echo $(builddir)/html/*`; \
274 if test "$$installfiles" = '$(builddir)/html/*'; \
275 then echo 1>&2 'Nothing to install' ; \
276 else \
277 if test -n "$(DOC_MODULE_VERSION)"; then \
278 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
279 else \
280 installdir="$(DESTDIR)$(TARGET_DIR)"; \
281 fi; \
282 $(mkinstalldirs) $${installdir} ; \
283 for i in $$installfiles; do \
284 echo ' $(INSTALL_DATA) '$$i ; \
285 $(INSTALL_DATA) $$i $${installdir}; \
286 done; \
287 if test -n "$(DOC_MODULE_VERSION)"; then \
288 mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
289 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
290 fi; \
291 $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
294 uninstall-local:
295 @if test -n "$(DOC_MODULE_VERSION)"; then \
296 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
297 else \
298 installdir="$(DESTDIR)$(TARGET_DIR)"; \
299 fi; \
300 rm -rf $${installdir}
303 # Require gtk-doc when making dist
305 if HAVE_GTK_DOC
306 dist-check-gtkdoc: docs
307 else
308 dist-check-gtkdoc:
309 @echo "*** gtk-doc is needed to run 'make dist'. ***"
310 @echo "*** gtk-doc was not found when 'configure' ran. ***"
311 @echo "*** please install gtk-doc and rerun 'configure'. ***"
312 @false
313 endif
315 dist-hook: dist-check-gtkdoc all-gtk-doc dist-hook-local
316 @mkdir $(distdir)/tmpl
317 @mkdir $(distdir)/html
318 @-cp ./tmpl/*.sgml $(distdir)/tmpl
319 @cp ./html/* $(distdir)/html
320 @-cp ./$(DOC_MODULE).pdf $(distdir)/
321 @-cp ./$(DOC_MODULE).types $(distdir)/
322 @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/
323 @cd $(distdir) && rm -f $(DISTCLEANFILES)
324 @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
326 .PHONY : dist-hook-local docs