1 # -*- mode: makefile -*-
3 # gtk-doc.make - make rules for gtk-doc
4 # Copyright (C) 2003 James Henstridge
5 # 2004-2007 Damon Chaplin
6 # 2007-2017 Stefan Sauer
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ####################################
22 # Everything below here is generic #
23 ####################################
25 if GTK_DOC_USE_LIBTOOL
26 GTKDOC_CC
= $(LIBTOOL
) --tag
=CC
--mode
=compile
$(CC
) $(INCLUDES
) $(GTKDOC_DEPS_CFLAGS
) $(AM_CPPFLAGS
) $(CPPFLAGS
) $(AM_CFLAGS
) $(CFLAGS
)
27 GTKDOC_LD
= $(LIBTOOL
) --tag
=CC
--mode
=link
$(CC
) $(GTKDOC_DEPS_LIBS
) $(AM_CFLAGS
) $(CFLAGS
) $(AM_LDFLAGS
) $(LDFLAGS
)
28 GTKDOC_RUN
= $(LIBTOOL
) --mode
=execute
30 GTKDOC_CC
= $(CC
) $(INCLUDES
) $(GTKDOC_DEPS_CFLAGS
) $(AM_CPPFLAGS
) $(CPPFLAGS
) $(AM_CFLAGS
) $(CFLAGS
)
31 GTKDOC_LD
= $(CC
) $(GTKDOC_DEPS_LIBS
) $(AM_CFLAGS
) $(CFLAGS
) $(AM_LDFLAGS
) $(LDFLAGS
)
35 # We set GPATH here; this gives us semantics for GNU make
36 # which are more like other make's VPATH, when it comes to
37 # whether a source that is a target of one rule is then
38 # searched for in VPATH/GPATH.
42 TARGET_DIR
=$(HTML_DIR
)/$(DOC_MODULE
)
46 $(expand_content_files
) \
47 $(DOC_MAIN_SGML_FILE
) \
48 $(DOC_MODULE
)-sections.txt \
49 $(DOC_MODULE
)-overrides.txt
55 DOC_STAMPS
=setup-build.stamp scan-build.stamp sgml-build.stamp \
56 html-build.stamp pdf-build.stamp \
57 sgml.stamp html.stamp pdf.stamp
61 $(DOC_MODULE
).hierarchy \
62 $(DOC_MODULE
).interfaces \
63 $(DOC_MODULE
).prerequisites \
67 $(DOC_MODULE
)-undocumented.txt \
68 $(DOC_MODULE
)-undeclared.txt \
69 $(DOC_MODULE
)-unused.txt
71 gtkdoc-check.
test: Makefile
72 $(AM_V_GEN
)echo
"#!/bin/sh -e" > $@
; \
73 echo
"$(GTKDOC_CHECK_PATH) || exit 1" >> $@
; \
76 CLEANFILES
= $(SCANOBJ_FILES
) $(REPORT_FILES
) $(DOC_STAMPS
) gtkdoc-check.
test
79 HTML_BUILD_STAMP
=html-build.stamp
84 PDF_BUILD_STAMP
=pdf-build.stamp
89 all-gtk-doc
: $(HTML_BUILD_STAMP
) $(PDF_BUILD_STAMP
)
93 all-local
: all-gtk-doc
96 docs
: $(HTML_BUILD_STAMP
) $(PDF_BUILD_STAMP
)
98 $(REPORT_FILES
): sgml-build.stamp
102 GTK_DOC_V_SETUP
=$(GTK_DOC_V_SETUP_@AM_V@
)
103 GTK_DOC_V_SETUP_
=$(GTK_DOC_V_SETUP_@AM_DEFAULT_V@
)
104 GTK_DOC_V_SETUP_0
=@echo
" DOC Preparing build";
107 -$(GTK_DOC_V_SETUP
)if
test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
108 files
=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
109 if
test "x$$files" != "x" ; then \
110 for file in
$$files ; do \
111 destdir
=`dirname $(abs_builddir)/$$file`; \
112 test -d
"$$destdir" || mkdir
-p
"$$destdir"; \
113 test -f
$(abs_srcdir
)/$$file && \
114 cp
-pf
$(abs_srcdir
)/$$file $(abs_builddir
)/$$file || true
; \
118 $(AM_V_at
)touch setup-build.stamp
122 GTK_DOC_V_SCAN
=$(GTK_DOC_V_SCAN_@AM_V@
)
123 GTK_DOC_V_SCAN_
=$(GTK_DOC_V_SCAN_@AM_DEFAULT_V@
)
124 GTK_DOC_V_SCAN_0
=@echo
" DOC Scanning header files";
126 GTK_DOC_V_INTROSPECT
=$(GTK_DOC_V_INTROSPECT_@AM_V@
)
127 GTK_DOC_V_INTROSPECT_
=$(GTK_DOC_V_INTROSPECT_@AM_DEFAULT_V@
)
128 GTK_DOC_V_INTROSPECT_0
=@echo
" DOC Introspecting gobjects";
130 scan-build.stamp
: setup-build.stamp
$(HFILE_GLOB
) $(CFILE_GLOB
)
131 $(GTK_DOC_V_SCAN
)_source_dir
='' ; \
132 for i in
$(DOC_SOURCE_DIR
) ; do \
133 _source_dir
="$${_source_dir} --source-dir=$$i" ; \
135 gtkdoc-scan
--module
=$(DOC_MODULE
) --ignore-headers
="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS
) $(EXTRA_HFILES
)
136 $(GTK_DOC_V_INTROSPECT
)if grep
-l
'^..*$$' $(DOC_MODULE
).types
> /dev
/null
2>&1 ; then \
137 scanobj_options
=""; \
138 gtkdoc-scangobj
2>&1 --help | grep
>/dev
/null
"\-\-verbose"; \
139 if
test "$$?" = "0"; then \
140 if
test "x$(V)" = "x1"; then \
141 scanobj_options
="--verbose"; \
144 CC
="$(GTKDOC_CC)" LD
="$(GTKDOC_LD)" RUN
="$(GTKDOC_RUN)" CFLAGS
="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS
="$(GTKDOC_LIBS) $(LDFLAGS)" \
145 gtkdoc-scangobj
$(SCANGOBJ_OPTIONS
) $$scanobj_options --module
=$(DOC_MODULE
); \
147 for i in
$(SCANOBJ_FILES
) ; do \
148 test -f
$$i || touch
$$i ; \
151 $(AM_V_at
)touch scan-build.stamp
153 $(DOC_MODULE
)-decl.txt
$(SCANOBJ_FILES
) $(DOC_MODULE
)-sections.txt
$(DOC_MODULE
)-overrides.txt
: scan-build.stamp
158 GTK_DOC_V_XML
=$(GTK_DOC_V_XML_@AM_V@
)
159 GTK_DOC_V_XML_
=$(GTK_DOC_V_XML_@AM_DEFAULT_V@
)
160 GTK_DOC_V_XML_0
=@echo
" DOC Building XML";
162 sgml-build.stamp
: setup-build.stamp
$(DOC_MODULE
)-decl.txt
$(SCANOBJ_FILES
) $(HFILE_GLOB
) $(CFILE_GLOB
) $(DOC_MODULE
)-sections.txt
$(DOC_MODULE
)-overrides.txt
$(expand_content_files
) xml
/gtkdocentities.ent
163 $(GTK_DOC_V_XML
)_source_dir
='' ; \
164 for i in
$(DOC_SOURCE_DIR
) ; do \
165 _source_dir
="$${_source_dir} --source-dir=$$i" ; \
167 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
)
168 $(AM_V_at
)touch sgml-build.stamp
170 sgml.stamp
: sgml-build.stamp
173 $(DOC_MAIN_SGML_FILE
): sgml-build.stamp
176 xml
/gtkdocentities.ent
: Makefile
177 $(GTK_DOC_V_XML
)$(MKDIR_P
) $(@D
) && ( \
178 echo
"<!ENTITY package \"$(PACKAGE)\">"; \
179 echo
"<!ENTITY package_bugreport \"$(PACKAGE_BUGREPORT)\">"; \
180 echo
"<!ENTITY package_name \"$(PACKAGE_NAME)\">"; \
181 echo
"<!ENTITY package_string \"$(PACKAGE_STRING)\">"; \
182 echo
"<!ENTITY package_tarname \"$(PACKAGE_TARNAME)\">"; \
183 echo
"<!ENTITY package_url \"$(PACKAGE_URL)\">"; \
184 echo
"<!ENTITY package_version \"$(PACKAGE_VERSION)\">"; \
189 GTK_DOC_V_HTML
=$(GTK_DOC_V_HTML_@AM_V@
)
190 GTK_DOC_V_HTML_
=$(GTK_DOC_V_HTML_@AM_DEFAULT_V@
)
191 GTK_DOC_V_HTML_0
=@echo
" DOC Building HTML";
193 GTK_DOC_V_XREF
=$(GTK_DOC_V_XREF_@AM_V@
)
194 GTK_DOC_V_XREF_
=$(GTK_DOC_V_XREF_@AM_DEFAULT_V@
)
195 GTK_DOC_V_XREF_0
=@echo
" DOC Fixing cross-references";
197 html-build.stamp
: sgml.stamp
$(DOC_MAIN_SGML_FILE
) $(content_files
) $(expand_content_files
)
198 $(GTK_DOC_V_HTML
)rm -rf html
&& mkdir html
&& \
200 gtkdoc-mkhtml
2>&1 --help | grep
>/dev
/null
"\-\-verbose"; \
201 if
test "$$?" = "0"; then \
202 if
test "x$(V)" = "x1"; then \
203 mkhtml_options
="$$mkhtml_options --verbose"; \
206 gtkdoc-mkhtml
2>&1 --help | grep
>/dev
/null
"\-\-path"; \
207 if
test "$$?" = "0"; then \
208 mkhtml_options
="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
210 cd html
&& gtkdoc-mkhtml
$$mkhtml_options $(MKHTML_OPTIONS
) $(DOC_MODULE
) ..
/$(DOC_MAIN_SGML_FILE
)
211 -@
test "x$(HTML_IMAGES)" = "x" || \
212 for file in
$(HTML_IMAGES
) ; do \
213 test -f
$(abs_srcdir
)/$$file && cp
$(abs_srcdir
)/$$file $(abs_builddir
)/html
; \
214 test -f
$(abs_builddir
)/$$file && cp
$(abs_builddir
)/$$file $(abs_builddir
)/html
; \
215 test -f
$$file && cp
$$file $(abs_builddir
)/html
; \
217 $(GTK_DOC_V_XREF
)gtkdoc-fixxref
--module
=$(DOC_MODULE
) --module-dir
=html
--html-dir
=$(HTML_DIR
) $(FIXXREF_OPTIONS
)
218 $(AM_V_at
)touch html-build.stamp
222 GTK_DOC_V_PDF
=$(GTK_DOC_V_PDF_@AM_V@
)
223 GTK_DOC_V_PDF_
=$(GTK_DOC_V_PDF_@AM_DEFAULT_V@
)
224 GTK_DOC_V_PDF_0
=@echo
" DOC Building PDF";
226 pdf-build.stamp
: sgml.stamp
$(DOC_MAIN_SGML_FILE
) $(content_files
) $(expand_content_files
)
227 $(GTK_DOC_V_PDF
)rm -f
$(DOC_MODULE
).pdf
&& \
229 gtkdoc-mkpdf
2>&1 --help | grep
>/dev
/null
"\-\-verbose"; \
230 if
test "$$?" = "0"; then \
231 if
test "x$(V)" = "x1"; then \
232 mkpdf_options
="$$mkpdf_options --verbose"; \
235 if
test "x$(HTML_IMAGES)" != "x"; then \
236 for img in
$(HTML_IMAGES
); do \
237 part
=`dirname $$img`; \
238 echo
$$mkpdf_options | grep
>/dev
/null
"\-\-imgdir=$$part "; \
239 if
test $$?
!= 0; then \
240 mkpdf_options
="$$mkpdf_options --imgdir=$$part"; \
244 gtkdoc-mkpdf
--path
="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE
) $(DOC_MAIN_SGML_FILE
) $(MKPDF_OPTIONS
)
245 $(AM_V_at
)touch pdf-build.stamp
252 @if echo
$(SCAN_OPTIONS
) | grep
-q
"\-\-rebuild-types" ; then \
253 rm -f
$(DOC_MODULE
).types
; \
255 @if echo
$(SCAN_OPTIONS
) | grep
-q
"\-\-rebuild-sections" ; then \
256 rm -f
$(DOC_MODULE
)-sections.txt
; \
260 @
rm -rf xml html
$(REPORT_FILES
) $(DOC_MODULE
).pdf \
261 $(DOC_MODULE
)-decl-list.txt
$(DOC_MODULE
)-decl.txt
262 @if
test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
263 rm -f
$(SETUP_FILES
) $(DOC_MODULE
).types
; \
266 maintainer-clean-local
:
270 @installfiles
=`echo $(builddir)/html/*`; \
271 if
test "$$installfiles" = '$(builddir)/html/*'; \
272 then echo
1>&2 'Nothing to install' ; \
274 if
test -n
"$(DOC_MODULE_VERSION)"; then \
275 installdir
="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
277 installdir
="$(DESTDIR)$(TARGET_DIR)"; \
279 $(mkinstalldirs
) $${installdir} ; \
280 for i in
$$installfiles; do \
281 echo
' $(INSTALL_DATA) '$$i ; \
282 $(INSTALL_DATA
) $$i $${installdir}; \
284 if
test -n
"$(DOC_MODULE_VERSION)"; then \
285 mv
-f
$${installdir}/$(DOC_MODULE
).devhelp2 \
286 $${installdir}/$(DOC_MODULE
)-$(DOC_MODULE_VERSION
).devhelp2
; \
288 $(GTKDOC_REBASE
) --relative
--dest-dir
=$(DESTDIR
) --html-dir
=$${installdir}; \
292 @if
test -n
"$(DOC_MODULE_VERSION)"; then \
293 installdir
="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
295 installdir
="$(DESTDIR)$(TARGET_DIR)"; \
297 rm -rf
$${installdir}
300 # Require gtk-doc when making dist
303 dist-check-gtkdoc
: docs
306 @echo
"*** gtk-doc is needed to run 'make dist'. ***"
307 @echo
"*** gtk-doc was not found when 'configure' ran. ***"
308 @echo
"*** please install gtk-doc and rerun 'configure'. ***"
312 dist-hook
: dist-check-gtkdoc all-gtk-doc dist-hook-local
313 @mkdir
$(distdir
)/html
314 @cp .
/html
/* $(distdir
)/html
315 @
-cp .
/$(DOC_MODULE
).pdf
$(distdir
)/
316 @
-cp .
/$(DOC_MODULE
).types
$(distdir
)/
317 @
-cp .
/$(DOC_MODULE
)-sections.txt
$(distdir
)/
318 @cd
$(distdir
) && rm -f
$(DISTCLEANFILES
)
319 @
$(GTKDOC_REBASE
) --online
--relative
--html-dir
=$(distdir
)/html
321 .PHONY
: dist-hook-local docs