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