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