plugin-docs: remove -undocumented from scan files
[platform/upstream/gst-common.git] / gtk-doc-plugins.mak
1 # This is an include file specifically tuned for building documentation
2 # for GStreamer plug-ins
3
4 help:
5         @echo
6         @echo "If you are a doc maintainer, run 'make update' to update"
7         @echo "the documentation files maintained in git"
8         @echo
9         @echo Other useful make targets:
10         @echo
11         @echo  check-inspected-versions: make sure the inspected plugin info
12         @echo                            is up to date before a release
13         @echo
14
15 # update the stuff maintained by doc maintainers
16 update:
17         $(MAKE) scanobj-update
18         $(MAKE) check-outdated-docs
19
20 # We set GPATH here; this gives us semantics for GNU make
21 # which are more like other make's VPATH, when it comes to
22 # whether a source that is a target of one rule is then
23 # searched for in VPATH/GPATH.
24 #
25 GPATH = $(srcdir)
26
27 # thomas: make docs parallel installable
28 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@
29
30 MAINTAINER_DOC_STAMPS =                 \
31         scanobj-build.stamp
32
33 EXTRA_DIST =                            \
34         $(MAINTAINER_DOC_STAMPS)                \
35         $(srcdir)/inspect/*.xml         \
36         $(SCANOBJ_FILES)                \
37         $(content_files)                \
38         $(extra_files)                  \
39         $(HTML_IMAGES)                  \
40         $(DOC_MAIN_SGML_FILE)   \
41         $(DOC_OVERRIDES)                \
42         $(DOC_MODULE)-sections.txt
43
44 # we don't add scanobj-build.stamp here since they are built manually by docs
45 # maintainers and result is commited to git
46 DOC_STAMPS =                            \
47         scan-build.stamp                \
48         tmpl-build.stamp                \
49         sgml-build.stamp                \
50         html-build.stamp                \
51         scan.stamp                      \
52         tmpl.stamp                      \
53         sgml.stamp                      \
54         html.stamp
55
56 # files generated/updated by gtkdoc-scangobj
57 SCANOBJ_FILES =                         \
58         $(DOC_MODULE).signals           \
59         $(DOC_MODULE).hierarchy         \
60         $(DOC_MODULE).interfaces        \
61         $(DOC_MODULE).prerequisites     \
62         $(DOC_MODULE).types             \
63         $(DOC_MODULE).args
64
65 SCANOBJ_FILES_O =                       \
66         .libs/$(DOC_MODULE)-scan.o
67
68 # files generated/updated by gtkdoc-scan
69 SCAN_FILES =                            \
70         $(DOC_MODULE)-sections.txt      \
71         $(DOC_MODULE)-overrides.txt     \
72         $(DOC_MODULE)-decl.txt          \
73         $(DOC_MODULE)-decl-list.txt
74
75
76 REPORT_FILES = \
77         $(DOC_MODULE)-undocumented.txt \
78         $(DOC_MODULE)-undeclared.txt \
79         $(DOC_MODULE)-unused.txt
80
81 # FC3 seems to need -scan.c to be part of CLEANFILES for distcheck
82 # no idea why FC4 can do without
83 CLEANFILES = \
84         $(SCANOBJ_FILES_O) \
85         $(DOC_MODULE)-scan.c \
86         $(REPORT_FILES) \
87         $(DOC_STAMPS) \
88         inspect-registry.xml
89
90 INSPECT_DIR = inspect
91
92 if ENABLE_GTK_DOC
93 all-local: html-build.stamp
94
95 ### inspect GStreamer plug-ins; done by documentation maintainer ###
96
97 # only look at the plugins in this module when building inspect .xml stuff
98 INSPECT_REGISTRY=$(top_builddir)/docs/plugins/inspect-registry.xml
99 INSPECT_ENVIRONMENT=\
100         LC_ALL=C \
101         GST_PLUGIN_SYSTEM_PATH= \
102         GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(top_builddir)/plugins:$(top_builddir)/src:$(top_builddir)/gnl \
103         GST_REGISTRY=$(INSPECT_REGISTRY) \
104         PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
105         $(INSPECT_EXTRA_ENVIRONMENT)
106
107 # update the element and plugin XML descriptions; store in inspect/
108 inspect:
109         @-mkdir -p $(INSPECT_DIR)
110
111 #### scan gobjects; done by documentation maintainer ####
112 scanobj-update:
113         -rm scanobj-build.stamp
114         $(MAKE) scanobj-build.stamp
115
116 # in the case of non-srcdir builds, the built gst directory gets added
117 # to gtk-doc scanning; but only then, to avoid duplicates
118 # FIXME: since we don't have the scan step as part of the build anymore,
119 # we could remove that
120 # TODO: finish elite script that updates the output files of this step
121 # instead of rewriting them, so that multiple maintainers can generate
122 # a collective set of args and signals
123 scanobj-build.stamp: $(SCANOBJ_DEPS) $(basefiles) inspect
124         @echo '*** Scanning GObjects ***'
125         if test x"$(srcdir)" != x. ; then                               \
126             for f in $(SCANOBJ_FILES);                                  \
127             do                                                          \
128                 cp $(srcdir)/$$f . ;                                    \
129             done;                                                       \
130         else                                                            \
131             $(INSPECT_ENVIRONMENT)                                      \
132             CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"                         \
133             CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS) $(WARNING_CFLAGS)"       \
134             LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)"                         \
135             $(GST_DOC_SCANOBJ) --type-init-func="gst_init(NULL,NULL)"   \
136                 --module=$(DOC_MODULE) --source=$(PACKAGE) --inspect-dir=$(INSPECT_DIR) &&              \
137                 $(PYTHON)                                               \
138                 $(top_srcdir)/common/scangobj-merge.py $(DOC_MODULE);   \
139         fi
140         touch scanobj-build.stamp
141
142 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(SCANOBJ_FILES_O): scan-build.stamp
143         @true
144
145 ### scan headers; done on every build ###
146 scan-build.stamp: $(HFILE_GLOB) $(EXTRA_HFILES) $(basefiles) scanobj-build.stamp
147         if test "x$(top_srcdir)" != "x$(top_builddir)" &&               \
148            test -d "$(top_builddir)/gst";                               \
149         then                                                            \
150             export BUILT_OPTIONS="--source-dir=$(top_builddir)/gst";    \
151         fi;                                                             \
152         gtkdoc-scan                                                     \
153             $(SCAN_OPTIONS) $(EXTRA_HFILES)                             \
154             --module=$(DOC_MODULE)                                      \
155             $$BUILT_OPTIONS                                             \
156             --ignore-headers="$(IGNORE_HFILES)";                        \
157         touch scan-build.stamp
158
159 #### update templates; done on every build ####
160
161 ### FIXME: make this error out again when docs are fixed for 0.9
162 # in a non-srcdir build, we need to copy files from the previous step
163 # and the files from previous runs of this step
164 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
165         @echo '*** Rebuilding template files ***'
166         if test x"$(srcdir)" != x. ; then                               \
167             for f in $(SCANOBJ_FILES) $(SCAN_FILES);                    \
168             do                                                          \
169                 if test -e $(srcdir)/$$f; then cp $(srcdir)/$$f . ; fi; \
170             done;                                                       \
171         fi
172         gtkdoc-mktmpl --module=$(DOC_MODULE) | tee tmpl-build.log
173         $(PYTHON) \
174                 $(top_srcdir)/common/mangle-tmpl.py $(srcdir)/$(INSPECT_DIR) tmpl
175         @cat $(DOC_MODULE)-unused.txt
176         rm -f tmpl-build.log
177         touch tmpl-build.stamp
178
179 tmpl.stamp: tmpl-build.stamp
180         @true
181
182 #### build xml; done on every build ####
183
184 ### FIXME: make this error out again when docs are fixed for 0.9
185 sgml-build.stamp: tmpl.stamp scan-build.stamp $(CFILE_GLOB) $(top_srcdir)/common/plugins.xsl $(expand_content_files)
186         @echo '*** Building XML ***'
187         @-mkdir -p xml
188         @for a in $(srcdir)/$(INSPECT_DIR)/*.xml; do \
189             xsltproc --stringparam module $(MODULE) \
190                 $(top_srcdir)/common/plugins.xsl $$a > xml/`basename $$a`; done
191         @for f in $(EXAMPLE_CFILES); do \
192                 $(PYTHON) $(top_srcdir)/common/c-to-xml.py $$f > xml/element-`basename $$f .c`.xml; done
193         gtkdoc-mkdb \
194                 --module=$(DOC_MODULE) \
195                 --source-dir=$(DOC_SOURCE_DIR) \
196                  --expand-content-files="$(expand_content_files)" \
197                 --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) \
198                 --output-format=xml \
199                 --ignore-files="$(IGNORE_HFILES) $(IGNORE_CFILES)" \
200                 $(MKDB_OPTIONS) \
201                 | tee sgml-build.log
202         @if grep "WARNING:" sgml-build.log > /dev/null; then true; fi # exit 1; fi
203         cp ../version.entities xml
204         rm sgml-build.log
205         touch sgml-build.stamp
206
207 sgml.stamp: sgml-build.stamp
208         @true
209
210 #### build html; done on every step ####
211
212 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
213         @echo '*** Building HTML ***'
214         if test -d html; then rm -rf html; fi
215         mkdir html
216         cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
217         @for f in $(content_files); do cp $(srcdir)/$$f html; done
218         cp -pr xml html
219         cp ../version.entities html
220         cd html && gtkdoc-mkhtml $(DOC_MODULE) $(DOC_MAIN_SGML_FILE)
221         mv html/index.sgml html/index.sgml.bak
222         $(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml
223         rm -f html/index.sgml.bak
224         rm -f html/$(DOC_MAIN_SGML_FILE)
225         rm -rf html/xml
226         rm -f html/version.entities
227         test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
228             if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
229         @echo '-- Fixing Crossreferences'
230         gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
231         touch html-build.stamp
232
233 clean-local-gtkdoc:
234         rm -rf xml tmpl html
235 # clean files copied for nonsrcdir templates build
236         if test x"$(srcdir)" != x. ; then \
237             rm -rf $(SCANOBJ_FILES) $(SCAN_FILES) $(REPORT_FILES) \
238                 $(MAINTAINER_DOC_STAMPS); \
239         fi
240 else
241 all-local:
242 clean-local-gtkdoc:
243 endif
244
245 clean-local: clean-local-gtkdoc
246         rm -f *~ *.bak
247         rm -rf .libs
248
249 distclean-local:
250         rm -f $(REPORT_FILES) \
251                 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
252         rm -rf tmpl/*.sgml.bak
253         rm -f $(DOC_MODULE).hierarchy
254         rm -f *.stamp || true
255         if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
256             rm -f $(DOC_MODULE)-docs.sgml ; \
257             rm -f $(DOC_MODULE).types ; \
258             rm -f $(DOC_MODULE).interfaces ; \
259             rm -f $(DOC_MODULE)-overrides.txt ; \
260             rm -f $(DOC_MODULE).prerequisites ; \
261             rm -f $(DOC_MODULE)-sections.txt ; \
262             rm -rf tmpl/*.sgml ; \
263         fi
264         rm -rf *.o
265
266 MAINTAINERCLEANFILES = $(MAINTAINER_DOC_STAMPS)
267
268 # thomas: make docs parallel installable; devhelp requires majorminor too
269 install-data-local:
270         (installfiles=`echo $(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css`; \
271         if test "$$installfiles" = '$(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css'; \
272         then echo '-- Nothing to install' ; \
273         else \
274           $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
275           for i in $$installfiles; do \
276             echo '-- Installing '$$i ; \
277             $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
278           done; \
279           pngfiles=`echo ./html/*.png`; \
280           if test "$$pngfiles" != './html/*.png'; then \
281             for i in $$pngfiles; do \
282               echo '-- Installing '$$i ; \
283               $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
284             done; \
285           fi; \
286           echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp' ; \
287           $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp \
288             $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
289           if test -e $(builddir)/html/$(DOC_MODULE).devhelp2; then \
290                     $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp2 \
291                     $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
292           fi; \
293           (which gtkdoc-rebase >/dev/null && \
294             gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR)) || true ; \
295         fi)
296 uninstall-local:
297         if test -d $(DESTDIR)$(TARGET_DIR); then \
298           rm -rf $(DESTDIR)$(TARGET_DIR)/*; \
299           rmdir -p $(DESTDIR)$(TARGET_DIR) 2>/dev/null || true; \
300         else \
301           echo '-- Nothing to uninstall' ; \
302         fi;
303
304 #
305 # Checks
306 #
307 check-hierarchy: $(DOC_MODULE).hierarchy
308         @if grep '      ' $(DOC_MODULE).hierarchy; then \
309             echo "$(DOC_MODULE).hierarchy contains tabs, please fix"; \
310             /bin/false; \
311         fi
312
313 check: check-hierarchy
314
315 # wildcard is apparently not portable to other makes, hence the use of find
316 inspect_files = $(shell find $(srcdir)/$(INSPECT_DIR) -name '*.xml')
317
318 check-inspected-versions:
319         @echo Checking plugin versions of inspected plugin data ...; \
320         fail=0 ; \
321         for each in $(inspect_files) ; do \
322           if (grep -H '<version>' $$each | grep -v '<version>$(VERSION)'); then \
323             echo $$each should be fixed to say version $(VERSION) or be removed ; \
324             echo "sed -i -e 's/<version.*version>/<version>$(VERSION)<\/version>/'" $$each; \
325             echo ; \
326             fail=1; \
327           fi ; \
328         done ; \
329         exit $$fail
330
331 check-outdated-docs:
332         $(AM_V_GEN)echo Checking for outdated plugin inspect data ...; \
333         fail=0 ; \
334         if [ -d $(top_srcdir)/.git/ ]; then \
335           files=`find $(srcdir)/inspect/ -name '*xml'`; \
336           for f in $$files; do \
337             ver=`grep '<version>$(PACKAGE_VERSION)</version>' $$f`; \
338             if test "x$$ver" = "x"; then \
339               plugin=`echo $$f | sed -e 's/^.*plugin-//' -e 's/.xml//'`; \
340               # echo "Checking $$plugin $$f"; \
341               pushd "$(top_srcdir)" >/dev/null; \
342               pinit=`git grep -A3 GST_PLUGIN_DEFINE -- ext/ gst/ sys/ | grep "\"$$plugin\""`; \
343               popd >/dev/null; \
344               # echo "[$$pinit]"; \
345               if test "x$$pinit" = "x"; then \
346                 printf " **** outdated docs for plugin %-15s: %s\n" $$plugin $$f; \
347                 fail=1; \
348               fi; \
349             fi; \
350           done; \
351         fi ; \
352         exit $$fail
353
354 #
355 # Require gtk-doc when making dist
356 #
357 if ENABLE_GTK_DOC
358 dist-check-gtkdoc:
359 else
360 dist-check-gtkdoc:
361         @echo "*** gtk-doc must be installed and enabled in order to make dist"
362         @false
363 endif
364
365 # FIXME: decide whether we want to dist generated html or not
366 # also this only works, if the project has been build before
367 # we could dist html only if its there, but that might lead to missing html in
368 # tarballs
369 dist-hook: dist-check-gtkdoc dist-hook-local
370         mkdir $(distdir)/html
371         cp html/* $(distdir)/html
372         -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
373         -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
374         cd $(distdir) && rm -f $(DISTCLEANFILES)
375         -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
376
377 .PHONY : dist-hook-local docs check-outdated-docs
378
379 # avoid spurious build errors when distchecking with -jN
380 .NOTPARALLEL: