Debian Codegraph @

build-aux/gtk-doc.mk

raw symbols SCIP
1 # Generic gtk-doc rules.
2 # $Id: gtk-doc.mk 27951 2025-05-09 16:34:45Z yeti-dn $
3 # Included in all API-docs Makefile.am's, if you change anything here, it's
4 # affects all subdirs.
5
6 # Some combinations of the tools do not give these us automatically.
7 abs_builddir = @abs_builddir@
8 abs_srcdir = @abs_srcdir@
9
10 GWY_DOC_CFLAGS = -I$(top_srcdir) -I$(top_builddir) @GTK_CFLAGS@ @COMMON_CFLAGS@ @GTKDOC_EXTRA_CFLAGS@
11 GWY_DOC_LIBS = \
12 $(top_builddir)/libgwyapp/libgwyapp3.la \
13 $(top_builddir)/libgwyui/libgwyui3.la \
14 $(top_builddir)/libgwyddion/libgwyddion3.la \
15 @GTK_LIBS@ @BASIC_LIBS@
16
17 GWY_SCAN_OPTIONS = \
18 --rebuild-sections --rebuild-types \
19 --deprecated-guards="GWY_DISABLE_DEPRECATED" \
20 --ignore-headers="tests" \
21 --ignore-decorators="_GWY_STATIC_INLINE"
22
23 GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(GWY_DOC_CFLAGS) $(GTKDOC_CFLAGS) $(CPPFLAGS) $(CFLAGS)
24 GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(GWY_DOC_LIBS) $(GTKDOC_LIBS) $(CFLAGS) $(LDFLAGS)
25 GTKDOC_RUN = $(LIBTOOL) --mode=execute
26
27 # We set GPATH here; this gives us semantics for GNU make
28 # which are more like other make's VPATH, when it comes to
29 # whether a source that is a target of one rule is then
30 # searched for in VPATH/GPATH.
31 #
32 GPATH = $(srcdir)
33
34 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
35 ADD_OBJECTS = $(top_srcdir)/devel-docs/add-objects.py
36
37 EXTRA_DIST = \
38 $(content_files) \
39 releaseinfo.xml.in \
40 $(HTML_IMAGES) \
41 $(DOC_MAIN_SGML_FILE) \
42 $(DOC_MODULE)-overrides.txt
43
44 DOC_STAMPS = \
45 scan-build.stamp \
46 xml-build.stamp \
47 html-build.stamp \
48 xml.stamp \
49 html.stamp
50
51 SCANOBJ_FILES = \
52 $(DOC_MODULE).args \
53 $(DOC_MODULE).hierarchy \
54 $(DOC_MODULE).interfaces \
55 $(DOC_MODULE).prerequisites \
56 $(DOC_MODULE).signals
57
58 CLEANFILES = $(SCANOBJ_FILES) $(DOC_MODULE)-unused.txt $(DOC_STAMPS)
59
60 DISTCLEANFILES = \
61 $(DOC_MODULE)-sections.txt \
62 $(DOC_MODULE)-undocumented.txt \
63 $(DOC_MODULE)-undeclared.txt \
64 $(DOC_MODULE)-decl-list.txt \
65 $(DOC_MODULE)-decl.txt \
66 $(DOC_MODULE).types
67
68 HFILE_GLOB = $(top_srcdir)/$(DOC_SOURCE_DIR)/*.h $(MORE_HFILES)
69 CFILE_GLOB = $(top_srcdir)/$(DOC_SOURCE_DIR)/*.c $(MORE_CFILES)
70
71 if ENABLE_GTK_DOC
72 all-local: html-build.stamp
73
74 #### scan ####
75
76 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) $(ADD_OBJECTS)
77 @echo 'gtk-doc: Scanning header files'
78 if test -f Makefile.am; then \
79 x=; \
80 else \
81 x=--source-dir=$(top_builddir)/$(DOC_SOURCE_DIR); \
82 fi; \
83 noinst_headers=$$($(MAKE) -C $(top_builddir)/$(DOC_SOURCE_DIR) -qp | @SED@ -e 's/^noinst_HEADERS *= *//' -e t -e d); \
84 gtkdoc-scan --module=$(DOC_MODULE) \
85 --source-dir=$(top_srcdir)/$(DOC_SOURCE_DIR) $x \
86 $(GWY_SCAN_OPTIONS) $(SCAN_OPTIONS) --ignore-headers="tests $$noinst_headers"
87 if grep -l '^..*$$' $(DOC_MODULE).types >/dev/null 2>&1 ; then \
88 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(builddir); \
89 else \
90 for i in $(SCANOBJ_FILES); do \
91 test -f $$i || touch $$i ; \
92 done \
93 fi
94 if test -s $(DOC_MODULE).hierarchy; then \
95 $(PYTHON) $(ADD_OBJECTS) $(DOC_MODULE)-sections.txt $(DOC_MODULE).hierarchy $(ADDOBJECTS_OPTIONS); \
96 $(AWK) '/^[^ ]/{ignore=0}; /^(GFlags|GEnum|GBoxed)/{ignore=1}; {if(!ignore)print}' $(DOC_MODULE).hierarchy >$(DOC_MODULE).tmp && mv -f $(DOC_MODULE).tmp $(DOC_MODULE).hierarchy; \
97 fi
98 touch scan-build.stamp
99
100 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
101 @true
102
103 #### xml ####
104
105 xml-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-overrides.txt $(CFILE_GLOB) $(expand_content_files)
106 @echo 'gtk-doc: Building XML'
107 if test -f Makefile.am; then \
108 x=; \
109 else \
110 x=--source-dir=$(top_builddir)/$(DOC_SOURCE_DIR); \
111 fi; \
112 gtkdoc-mkdb --module=$(DOC_MODULE) \
113 --source-dir=$(top_srcdir)/$(DOC_SOURCE_DIR) $x \
114 --xml-mode --output-format=xml \
115 --expand-content-files="$(expand_content_files)" \
116 --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS)
117 @SED@ -i -e 's| (|(|g' xml/*.xml
118 touch xml-build.stamp
119 @test -f sgml.stamp && mv -f sgml.stamp xml.stamp
120
121 xml.stamp: xml-build.stamp
122 @true
123
124 #### html ####
125
126 # Note the test for Makefile.am is a desperate measure to detect VPATH
127 # builds. Comparing srcdir and builddir is not safe as different strings
128 # can resolve to the same directory. Giving xsltproc directly
129 # $(DOC_MAIN_SGML_FILE) in source directory apparently totally messes paths
130 # so we can't do this.
131 html-build.stamp: xml.stamp $(srcdir)/$(DOC_MAIN_SGML_FILE) $(content_files) releaseinfo.xml
132 @echo 'gtk-doc: Building HTML'
133 rm -rf html
134 mkdir html
135 test -f Makefile.am || cp -f $(srcdir)/$(DOC_MAIN_SGML_FILE) .
136 test ! -f html/index.xml || rm -f html/index.xml
137 cd html \
138 && xsltproc --path $(abs_srcdir) --nonet --xinclude \
139 --stringparam gtkdoc.bookname $(DOC_MODULE) \
140 --stringparam gtkdoc.version "1.19" \
141 $(GTK_DOC_PATH)/data/gtk-doc.xsl \
142 ../$(DOC_MAIN_SGML_FILE)
143 @echo 'gtk-doc: Copying styles and images'
144 cd $(GTK_DOC_PATH)/data && cp -f *.png *.css $(abs_builddir)/html/
145 test "x$(HTML_IMAGES)" = "x" || cp -f $(HTML_IMAGES) html/
146 @echo 'gtk-doc: Fixing cross-references'
147 gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) --module=$(DOC_MODULE) $(FIXXREF_OPTIONS)
148 cd $(top_srcdir)/devel-docs && cp -f style.css $(abs_builddir)/html/
149 touch html-build.stamp
150 endif
151
152 ##############
153
154 clean-local:
155 rm -f *~ *.bak $(DOC_MODULE)-scan.*
156
157 distclean-local:
158 rm -rf xml template
159 test -f Makefile.am || rm -f $(DOC_MAIN_SGML_FILE)
160
161 maintainer-clean-local:
162 rm -rf html
163
164 install-data-local:
165 d=; \
166 if test -s html/index.html; then \
167 echo 'gtk-doc: Installing HTML from builddir'; \
168 d=html; \
169 elif test -s $(srcdir)/html/index.html; then \
170 echo 'gtk-doc: Installing HTML from srcdir'; \
171 d=$(srcdir)/html; \
172 else \
173 echo 'gtk-doc: Nothing to install'; \
174 fi; \
175 if test -n "$$d"; then \
176 $(mkdir_p) $(DESTDIR)$(TARGET_DIR); \
177 ( cd $$d && $(INSTALL_DATA) * "$(DESTDIR)$(TARGET_DIR)"; ); \
178 fi
179
180 uninstall-local:
181 rm -f $(DESTDIR)$(TARGET_DIR)/*
182 rmdir $(DESTDIR)$(TARGET_DIR)
183
184 #
185 # Require gtk-doc when making dist
186 # FIXME: We should require *built* docs, because this is not guaranteed just
187 # by having gtk-doc enabled.
188 #
189 if ENABLE_GTK_DOC
190 dist-check-gtkdoc:
191 else
192 dist-check-gtkdoc:
193 @echo "*** gtk-doc must be installed and enabled in order to make dist"
194 @false
195 endif
196
197 dist-hook: dist-check-gtkdoc dist-hook-local
198 mkdir $(distdir)/html
199 if test -s html/index.html; then d=html; else d=$(srcdir)/html; fi; \
200 cp -f $$d/* $(distdir)/html
201 $(PYTHON) $(top_srcdir)/devel-docs/ncrosslinks.py $(distdir)/html/*.html </dev/null
202
203 .PHONY: dist-hook-local