scan: improve handling of internal symbols
[gtk-doc.git] / gtk-doc.make
blob57fab986860146db7181ce186d76727d66ce8eff
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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
9 GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
10 GTKDOC_RUN = $(LIBTOOL) --mode=execute
11 else
12 GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
13 GTKDOC_LD = $(CC) $(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 EXTRA_DIST = \
27 $(content_files) \
28 $(HTML_IMAGES) \
29 $(DOC_MAIN_SGML_FILE) \
30 $(DOC_MODULE)-sections.txt \
31 $(DOC_MODULE)-overrides.txt
33 DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
34 pdf-build.stamp \
35 $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp \
36 $(srcdir)/pdf.stamp
38 SCANOBJ_FILES = \
39 $(DOC_MODULE).args \
40 $(DOC_MODULE).hierarchy \
41 $(DOC_MODULE).interfaces \
42 $(DOC_MODULE).prerequisites \
43 $(DOC_MODULE).signals
45 REPORT_FILES = \
46 $(DOC_MODULE)-undocumented.txt \
47 $(DOC_MODULE)-undeclared.txt \
48 $(DOC_MODULE)-unused.txt
50 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
52 if ENABLE_GTK_DOC
53 if GTK_DOC_BUILD_HTML
54 HTML_BUILD_STAMP=html-build.stamp
55 else
56 HTML_BUILD_STAMP=
57 endif
58 if GTK_DOC_BUILD_PDF
59 PDF_BUILD_STAMP=pdf-build.stamp
60 else
61 PDF_BUILD_STAMP=
62 endif
64 all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
65 else
66 all-local:
67 endif
69 docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
71 $(REPORT_FILES): sgml-build.stamp
73 #### scan ####
75 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
76 @echo 'gtk-doc: Scanning header files'
77 @-chmod -R u+w $(srcdir)
78 @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \
79 _source_dir="$${_source_dir} --source-dir=$$i" ; \
80 done ; \
81 cd $(srcdir) && \
82 gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
83 @if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
84 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
85 else \
86 cd $(srcdir) ; \
87 for i in $(SCANOBJ_FILES) ; do \
88 test -f $$i || touch $$i ; \
89 done \
91 @touch scan-build.stamp
93 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
94 @true
96 #### templates ####
98 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
99 @echo 'gtk-doc: Rebuilding template files'
100 @-chmod -R u+w $(srcdir)
101 @cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
102 @touch tmpl-build.stamp
104 tmpl.stamp: tmpl-build.stamp
105 @true
107 $(srcdir)/tmpl/*.sgml:
108 @true
110 #### xml ####
112 sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files)
113 @echo 'gtk-doc: Building XML'
114 @-chmod -R u+w $(srcdir)
115 @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \
116 _source_dir="$${_source_dir} --source-dir=$$i" ; \
117 done ; \
118 cd $(srcdir) && \
119 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)
120 @touch sgml-build.stamp
122 sgml.stamp: sgml-build.stamp
123 @true
125 #### html ####
127 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
128 @echo 'gtk-doc: Building HTML'
129 @-chmod -R u+w $(srcdir)
130 @rm -rf $(srcdir)/html
131 @mkdir $(srcdir)/html
132 @mkhtml_options=""; \
133 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
134 if test "$(?)" = "0"; then \
135 mkhtml_options=--path="$(srcdir)"; \
136 fi; \
137 cd $(srcdir)/html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
138 @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
139 @echo 'gtk-doc: Fixing cross-references'
140 @cd $(srcdir) && gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
141 @touch html-build.stamp
143 #### pdf ####
145 pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
146 @echo 'gtk-doc: Building PDF'
147 @-chmod -R u+w $(srcdir)
148 @rm -rf $(srcdir)/$(DOC_MODULE).pdf
149 @mkpdf_imgdirs=""; \
150 if test "x$(HTML_IMAGES)" != "x"; then \
151 for img in $(HTML_IMAGES); do \
152 part=`dirname $$img`; \
153 echo $$mkpdf_imgdirs | grep >/dev/null "\-\-imgdir=$$part "; \
154 if test $$? != 0; then \
155 mkpdf_imgdirs="$$mkpdf_imgdirs --imgdir=$$part"; \
156 fi; \
157 done; \
158 fi; \
159 cd $(srcdir) && gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_imgdirs $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
160 @touch pdf-build.stamp
162 ##############
164 clean-local:
165 rm -f *~ *.bak
166 rm -rf .libs
168 distclean-local:
169 cd $(srcdir) && \
170 rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \
171 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
173 maintainer-clean-local: clean
174 cd $(srcdir) && rm -rf xml html
176 install-data-local:
177 @installfiles=`echo $(srcdir)/html/*`; \
178 if test "$$installfiles" = '$(srcdir)/html/*'; \
179 then echo '-- Nothing to install' ; \
180 else \
181 if test -n "$(DOC_MODULE_VERSION)"; then \
182 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
183 else \
184 installdir="$(DESTDIR)$(TARGET_DIR)"; \
185 fi; \
186 $(mkinstalldirs) $${installdir} ; \
187 for i in $$installfiles; do \
188 echo '-- Installing '$$i ; \
189 $(INSTALL_DATA) $$i $${installdir}; \
190 done; \
191 if test -n "$(DOC_MODULE_VERSION)"; then \
192 mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
193 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
194 mv -f $${installdir}/$(DOC_MODULE).devhelp \
195 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \
196 fi; \
197 $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
200 uninstall-local:
201 @if test -n "$(DOC_MODULE_VERSION)"; then \
202 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
203 else \
204 installdir="$(DESTDIR)$(TARGET_DIR)"; \
205 fi; \
206 rm -rf $${installdir}
209 # Require gtk-doc when making dist
211 if ENABLE_GTK_DOC
212 dist-check-gtkdoc:
213 else
214 dist-check-gtkdoc:
215 @echo "*** gtk-doc must be installed and enabled in order to make dist"
216 @false
217 endif
219 dist-hook: dist-check-gtkdoc dist-hook-local
220 mkdir $(distdir)/tmpl
221 mkdir $(distdir)/html
222 -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
223 cp $(srcdir)/html/* $(distdir)/html
224 -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/
225 -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
226 -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
227 cd $(distdir) && rm -f $(DISTCLEANFILES)
228 $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
230 .PHONY : dist-hook-local docs