1 # This is an include file specifically tuned for building documentation
2 # for GStreamer plug-ins
5 @echo "If you are a doc maintainer, run 'make update' to update"
6 @echo "the documentation files maintained in CVS"
8 # update the stuff maintained by doc maintainers
10 $(MAKE) inspect-update
11 $(MAKE) scanobj-update
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.
20 # thomas: make docs parallel installable
21 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@
25 $(srcdir)/inspect/*.xml \
32 $(DOC_MAIN_SGML_FILE) \
34 $(DOC_MODULE)-sections.txt
36 MAINTAINER_DOC_STAMPS = \
41 # we don't add inspect-build.stamp and scanobj-build.stamp here since they are
42 # built manually by docs maintainers and result is commited to CVS
53 # files generated/updated by gtkdoc-scangobj
55 $(DOC_MODULE).signals \
56 $(DOC_MODULE).hierarchy \
57 $(DOC_MODULE).interfaces \
58 $(DOC_MODULE).prerequisites \
63 .libs/$(DOC_MODULE)-scan.o
65 # files generated/updated by gtkdoc-scan
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
75 $(DOC_MODULE)-undocumented.txt \
76 $(DOC_MODULE)-undeclared.txt \
77 $(DOC_MODULE)-unused.txt
79 # FC3 seems to need -scan.c to be part of CLEANFILES for distcheck
80 # no idea why FC4 can do without
83 $(DOC_MODULE)-scan.c \
90 all-local: html-build.stamp
92 #### scan gobjects; done by documentation maintainer ####
94 -rm scanobj-build.stamp
95 $(MAKE) scanobj-build.stamp
97 # in the case of non-srcdir builds, the built gst directory gets added
98 # to gtk-doc scanning; but only then, to avoid duplicates
99 # FIXME: since we don't have the scan step as part of the build anymore,
100 # we could remove that
101 # TODO: finish elite script that updates the output files of this step
102 # instead of rewriting them, so that multiple maintainers can generate
103 # a collective set of args and signals
104 scanobj-build.stamp: $(SCANOBJ_DEPS) $(basefiles)
105 @echo '*** Scanning GObjects ***'
106 if test x"$(srcdir)" != x. ; then \
107 for f in $(SCANOBJ_FILES); \
109 cp $(srcdir)/$$f . ; \
112 $(INSPECT_ENVIRONMENT) \
113 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" \
114 CFLAGS="-g $(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" \
115 $(GST_DOC_SCANOBJ) --type-init-func="gst_init(NULL,NULL)" \
116 --module=$(DOC_MODULE) --source=$(PACKAGE) && \
118 $(top_srcdir)/common/scangobj-merge.py $(DOC_MODULE); \
120 touch scanobj-build.stamp
122 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(SCANOBJ_FILES_O): scan-build.stamp
125 ### inspect GStreamer plug-ins; done by documentation maintainer ###
127 # only look at the plugins in this module when building inspect .xml stuff
128 INSPECT_REGISTRY=$(top_builddir)/docs/plugins/inspect-registry.xml
129 INSPECT_ENVIRONMENT=\
130 GST_PLUGIN_SYSTEM_PATH= \
131 GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(top_builddir)/plugins:$(top_builddir)/src \
132 GST_REGISTRY=$(INSPECT_REGISTRY)
134 # update the element and plugin XML descriptions; store in inspect/
138 inspect-update: inspect
139 -rm $(INSPECT_REGISTRY)
140 -rm inspect-build.stamp
141 $(MAKE) inspect-build.stamp
143 # FIXME: inspect.stamp should be written to by gst-xmlinspect.py
144 # IF the output changed; see gtkdoc-mktmpl
146 @echo '*** Rebuilding plugin inspection files ***'
147 if test x"$(srcdir)" != x. ; then \
148 cp $(srcdir)/inspect.stamp . ; \
149 cp $(srcdir)/inspect-build.stamp . ; \
151 $(INSPECT_ENVIRONMENT) $(PYTHON) \
152 $(top_srcdir)/common/gst-xmlinspect.py $(PACKAGE) inspect && \
153 echo -n "timestamp" > inspect.stamp && \
154 touch inspect-build.stamp; \
157 ### scan headers; done on every build ###
158 scan-build.stamp: $(HFILE_GLOB) $(EXTRA_HFILES) $(basefiles) scanobj-build.stamp inspect-build.stamp
159 if test "x$(top_srcdir)" != "x$(top_builddir)" && \
160 test -d "$(top_builddir)/gst"; \
162 export BUILT_OPTIONS="--source-dir=$(top_builddir)/gst"; \
165 $(SCAN_OPTIONS) $(EXTRA_HFILES) \
166 --module=$(DOC_MODULE) \
168 --ignore-headers="$(IGNORE_HFILES)"; \
169 touch scan-build.stamp
171 #### update templates; done on every build ####
173 ### FIXME: make this error out again when docs are fixed for 0.9
174 # in a non-srcdir build, we need to copy files from the previous step
175 # and the files from previous runs of this step
176 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
177 @echo '*** Rebuilding template files ***'
178 if test x"$(srcdir)" != x. ; then \
179 for f in $(SCANOBJ_FILES) $(SCAN_FILES); \
181 if test -e $(srcdir)/$$f; then cp $(srcdir)/$$f . ; fi; \
184 gtkdoc-mktmpl --module=$(DOC_MODULE) | tee tmpl-build.log
186 $(top_srcdir)/common/mangle-tmpl.py $(srcdir)/inspect tmpl
187 @cat $(DOC_MODULE)-unused.txt
189 touch tmpl-build.stamp
191 tmpl.stamp: tmpl-build.stamp
194 #### build xml; done on every build ####
196 ### FIXME: make this error out again when docs are fixed for 0.9
197 sgml-build.stamp: tmpl.stamp inspect.stamp $(CFILE_GLOB) $(top_srcdir)/common/plugins.xsl
198 @echo '*** Building XML ***'
200 @for a in $(srcdir)/inspect/*.xml; do \
201 xsltproc --stringparam module $(MODULE) \
202 $(top_srcdir)/common/plugins.xsl $$a > xml/`basename $$a`; done
203 @for f in $(EXAMPLE_CFILES); do \
204 $(PYTHON) $(top_srcdir)/common/c-to-xml.py $$f > xml/element-`basename $$f .c`.xml; done
206 --module=$(DOC_MODULE) \
207 --source-dir=$(DOC_SOURCE_DIR) \
208 --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) \
209 --output-format=xml \
210 --ignore-files="$(IGNORE_HFILES) $(IGNORE_CFILES)" \
213 @if grep "WARNING:" sgml-build.log > /dev/null; then true; fi # exit 1; fi
214 cp ../version.entities xml
216 touch sgml-build.stamp
218 sgml.stamp: sgml-build.stamp
221 #### build html; done on every step ####
223 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
224 @echo '*** Building HTML ***'
225 if test -d html; then rm -rf html; fi
227 cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
228 @for f in $(content_files); do cp $(srcdir)/$$f html; done
230 cp ../version.entities html
231 cd html && gtkdoc-mkhtml $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) \
232 2>&1 | tee ../html-build.log
233 @if grep "warning:" html-build.log > /dev/null; then \
234 echo "ERROR"; grep "warning:" html-build.log; exit 1; fi
236 sed -i "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml
237 rm -f html/$(DOC_MAIN_SGML_FILE)
239 rm -f html/version.entities
240 test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
241 if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
242 @echo '-- Fixing Crossreferences'
243 gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
244 touch html-build.stamp
249 # FIXME: these rules need a little cleaning up
253 # clean files generated for tmpl build
255 # clean files copied/generated for nonsrcdir tmpl build
256 if test x"$(srcdir)" != x. ; then \
257 rm -rf $(SCANOBJ_FILES) $(SCAN_FILES); \
259 # clean files generated for xml build
261 # clean files generate for html build
264 distclean-local: clean
265 rm -rf tmpl/*.sgml.bak
266 rm -f *.stamp || true
269 # thomas: make docs parallel installable; devhelp requires majorminor too
271 $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
272 (installfiles=`echo ./html/*.html`; \
273 if test "$$installfiles" = './html/*.html'; \
274 then echo '-- Nothing to install' ; \
276 for i in $$installfiles; do \
277 echo '-- Installing '$$i ; \
278 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
280 pngfiles=`echo ./html/*.png`; \
281 if test "$$pngfiles" != './html/*.png'; then \
282 for i in $$pngfiles; do \
283 echo '-- Installing '$$i ; \
284 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
287 echo '-- Installing $(srcdir)/html/$(DOC_MODULE).devhelp' ; \
288 $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp \
289 $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
290 if test -e $(srcdir)/html/$(DOC_MODULE).devhelp2; then \
291 $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp2 \
292 $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
294 echo '-- Installing $(srcdir)/html/index.sgml' ; \
295 $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
296 if test -e $(srcdir)/html/style.css; then \
297 echo '-- Installing $(srcdir)/html/style.css' ; \
298 $(INSTALL_DATA) $(srcdir)/html/style.css $(DESTDIR)$(TARGET_DIR); \
302 (installfiles=`echo ./html/*.html`; \
303 if test "$$installfiles" = './html/*.html'; \
304 then echo '-- Nothing to uninstall' ; \
306 for i in $$installfiles; do \
307 rmfile=`basename $$i` ; \
308 echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
309 rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
311 pngfiles=`echo ./html/*.png`; \
312 if test "$$pngfiles" != './html/*.png'; then \
313 for i in $$pngfiles; do \
314 rmfile=`basename $$i` ; \
315 echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
316 rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
319 echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE).devhelp' ; \
320 rm -f $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
321 if test -e $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; then \
322 rm -f $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
324 echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/index.sgml' ; \
325 rm -f $(DESTDIR)$(TARGET_DIR)/index.sgml; \
326 if test -e $(DESTDIR)$(TARGET_DIR)/style.css; then \
327 echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/style.css' ; \
328 rm -f $(DESTDIR)$(TARGET_DIR)/style.css; \
331 if test -d $(DESTDIR)$(TARGET_DIR); then rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(TARGET_DIR) 2>/dev/null; fi; true
336 check-hierarchy: $(DOC_MODULE).hierarchy
337 @if grep ' ' $(DOC_MODULE).hierarchy; then \
338 echo "$(DOC_MODULE).hierarchy contains tabs, please fix"; \
342 check: check-hierarchy
346 # Require gtk-doc when making dist
352 @echo "*** gtk-doc must be installed and enabled in order to make dist"
356 # FIXME: decide whether we want to dist generated html or not
357 dist-hook: dist-check-gtkdoc dist-hook-local
358 mkdir $(distdir)/tmpl
360 mkdir $(distdir)/html
361 -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
362 -cp $(srcdir)/sgml/*.xml $(distdir)/xml
363 -cp $(srcdir)/html/index.sgml $(distdir)/html
364 -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
365 -cp $(srcdir)/html/$(DOC_MODULE).devhelp* $(distdir)/html
367 images=$(HTML_IMAGES) ; \
368 for i in "" $$images ; do \
369 if test "$$i" != ""; then cp $(srcdir)/$$i $(distdir)/html ; fi; \
372 .PHONY : dist-hook-local