1 # This is an include file specifically tuned for building documentation
2 # for GStreamer plug-ins
6 @echo "If you are a doc maintainer, run 'make update' to update"
7 @echo "the documentation files maintained in git"
9 @echo Other useful make targets:
11 @echo check-inspected-versions: make sure the inspected plugin info
12 @echo is up to date before a release
15 # update the stuff maintained by doc maintainers
17 $(MAKE) scanobj-update
18 $(MAKE) check-outdated-docs
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.
27 # thomas: make docs parallel installable
28 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@
30 MAINTAINER_DOC_STAMPS = \
34 $(MAINTAINER_DOC_STAMPS) \
35 $(srcdir)/inspect/*.xml \
40 $(DOC_MAIN_SGML_FILE) \
42 $(DOC_MODULE)-sections.txt
44 # we don't add scanobj-build.stamp here since they are built manually by docs
45 # maintainers and result is commited to git
56 # files generated/updated by gtkdoc-scangobj
58 $(DOC_MODULE).signals \
59 $(DOC_MODULE).hierarchy \
60 $(DOC_MODULE).interfaces \
61 $(DOC_MODULE).prerequisites \
66 .libs/$(DOC_MODULE)-scan.o
68 # files generated/updated by gtkdoc-scan
70 $(DOC_MODULE)-sections.txt \
71 $(DOC_MODULE)-overrides.txt \
72 $(DOC_MODULE)-decl.txt \
73 $(DOC_MODULE)-decl-list.txt
77 $(DOC_MODULE)-undocumented.txt \
78 $(DOC_MODULE)-undeclared.txt \
79 $(DOC_MODULE)-unused.txt
81 # FC3 seems to need -scan.c to be part of CLEANFILES for distcheck
82 # no idea why FC4 can do without
85 $(DOC_MODULE)-scan.c \
93 all-local: html-build.stamp
95 ### inspect GStreamer plug-ins; done by documentation maintainer ###
97 # only look at the plugins in this module when building inspect .xml stuff
98 INSPECT_REGISTRY=$(top_builddir)/docs/plugins/inspect-registry.xml
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)
107 # update the element and plugin XML descriptions; store in inspect/
109 @-mkdir -p $(INSPECT_DIR)
111 #### scan gobjects; done by documentation maintainer ####
113 -rm scanobj-build.stamp
114 $(MAKE) scanobj-build.stamp
116 # TODO: finish elite script that updates the output files of this step
117 # instead of rewriting them, so that multiple maintainers can generate
118 # a collective set of args and signals
119 scanobj-build.stamp: $(SCANOBJ_DEPS) $(basefiles) inspect
120 @echo " DOC Introspecting gobjects"
121 @if test x"$(srcdir)" != x. ; then \
122 for f in $(SCANOBJ_FILES) $(SCAN_FILES); \
124 if test -e $(srcdir)/$$f; then cp -u $(srcdir)/$$f . ; fi; \
127 scanobj_options=""; \
128 if test "x$(V)" = "x1"; then \
129 scanobj_options="--verbose"; \
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) $$scanobj_options --type-init-func="gst_init(NULL,NULL)" \
136 --module=$(DOC_MODULE) --source=$(PACKAGE) --inspect-dir=$(INSPECT_DIR) && \
137 echo " DOC Merging introspection data" && \
139 $(top_srcdir)/common/scangobj-merge.py $(DOC_MODULE); \
140 if test x"$(srcdir)" != x. ; then \
141 for f in $(SCANOBJ_FILES); \
143 cmp -s ./$$f $(srcdir)/$$f || cp ./$$f $(srcdir)/ ; \
146 touch scanobj-build.stamp
148 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(SCANOBJ_FILES_O): scan-build.stamp
151 ### scan headers; done on every build ###
152 scan-build.stamp: $(HFILE_GLOB) $(EXTRA_HFILES) $(basefiles) scanobj-build.stamp
153 @echo ' DOC Scanning header files'
155 $(SCAN_OPTIONS) $(EXTRA_HFILES) \
156 --module=$(DOC_MODULE) \
157 --source-dir=$(DOC_SOURCE_DIR) \
158 --ignore-headers="$(IGNORE_HFILES)"; \
159 touch scan-build.stamp
161 #### update templates; done on every build ####
163 ### FIXME: make this error out again when docs are fixed for 0.X
164 # in a non-srcdir build, we need to copy files from the previous step
165 # and the files from previous runs of this step
166 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
167 @echo ' DOC Rebuilding template files'
168 @if test x"$(srcdir)" != x. ; then \
169 for f in $(SCANOBJ_FILES) $(SCAN_FILES); \
171 if test -e $(srcdir)/$$f; then cp -u $(srcdir)/$$f . ; fi; \
174 @gtkdoc-mktmpl --module=$(DOC_MODULE)
176 $(top_srcdir)/common/mangle-tmpl.py $(srcdir)/$(INSPECT_DIR) tmpl
177 @touch tmpl-build.stamp
179 tmpl.stamp: tmpl-build.stamp
182 #### build xml; done on every build ####
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 ' DOC Building 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
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)" \
201 @cp ../version.entities xml
202 @touch sgml-build.stamp
204 sgml.stamp: sgml-build.stamp
207 #### build html; done on every step ####
209 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
210 @echo ' DOC Building HTML'
211 @if test -d html; then rm -rf html; fi
213 @cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
214 @for f in $(content_files); do cp $(srcdir)/$$f html; done
216 @cp ../version.entities html
217 @mkhtml_options=""; \
218 if test "x$(V)" = "x1"; then \
219 mkhtml_options="--verbose"; \
221 cd html && gtkdoc-mkhtml $$mkhtml_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE)
222 @mv html/index.sgml html/index.sgml.bak
223 @$(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml
224 @rm -f html/index.sgml.bak
225 @rm -f html/$(DOC_MAIN_SGML_FILE)
227 @rm -f html/version.entities
228 @test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
229 if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
230 @echo ' DOC Fixing cross-references'
231 @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
232 @touch html-build.stamp
235 @rm -rf xml tmpl html
236 # clean files copied for nonsrcdir templates build
237 @if test x"$(srcdir)" != x. ; then \
238 rm -rf $(SCANOBJ_FILES) $(SCAN_FILES) $(REPORT_FILES) \
239 $(MAINTAINER_DOC_STAMPS); \
246 clean-local: clean-local-gtkdoc
251 @rm -f $(REPORT_FILES) \
252 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
253 @rm -rf tmpl/*.sgml.bak
254 @rm -f $(DOC_MODULE).hierarchy
255 @rm -f *.stamp || true
256 @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
257 rm -f $(DOC_MODULE)-docs.sgml ; \
258 rm -f $(DOC_MODULE).types ; \
259 rm -f $(DOC_MODULE).interfaces ; \
260 rm -f $(DOC_MODULE)-overrides.txt ; \
261 rm -f $(DOC_MODULE).prerequisites ; \
262 rm -f $(DOC_MODULE)-sections.txt ; \
263 rm -rf tmpl/*.sgml ; \
264 rm -rf $(INSPECT_DIR); \
268 MAINTAINERCLEANFILES = $(MAINTAINER_DOC_STAMPS)
270 # thomas: make docs parallel installable; devhelp requires majorminor too
272 (installfiles=`echo $(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css`; \
273 if test "$$installfiles" = '$(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css'; \
274 then echo '-- Nothing to install' ; \
276 $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
277 for i in $$installfiles; do \
278 echo '-- Installing '$$i ; \
279 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
281 pngfiles=`echo ./html/*.png`; \
282 if test "$$pngfiles" != './html/*.png'; then \
283 for i in $$pngfiles; do \
284 echo '-- Installing '$$i ; \
285 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
288 echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp2' ; \
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; \
293 (which gtkdoc-rebase >/dev/null && \
294 gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR)) || true ; \
297 if test -d $(DESTDIR)$(TARGET_DIR); then \
298 rm -rf $(DESTDIR)$(TARGET_DIR)/*; \
299 rmdir -p $(DESTDIR)$(TARGET_DIR) 2>/dev/null || true; \
301 echo '-- Nothing to uninstall' ; \
308 check-hierarchy: $(DOC_MODULE).hierarchy
309 @if grep ' ' $(DOC_MODULE).hierarchy; then \
310 echo "$(DOC_MODULE).hierarchy contains tabs, please fix"; \
314 check: check-hierarchy
317 # wildcard is apparently not portable to other makes, hence the use of find
318 inspect_files = $(shell find $(srcdir)/$(INSPECT_DIR) -name '*.xml')
320 check-inspected-versions:
321 @echo Checking plugin versions of inspected plugin data ...; \
323 for each in $(inspect_files) ; do \
324 if (grep -H '<version>' $$each | grep -v '<version>$(VERSION)'); then \
325 echo $$each should be fixed to say version $(VERSION) or be removed ; \
326 echo "sed -i -e 's/<version.*version>/<version>$(VERSION)<\/version>/'" $$each; \
334 $(AM_V_GEN)echo Checking for outdated plugin inspect data ...; \
336 if [ -d $(top_srcdir)/.git/ ]; then \
337 files=`find $(srcdir)/inspect/ -name '*xml'`; \
338 for f in $$files; do \
339 ver=`grep '<version>$(PACKAGE_VERSION)</version>' $$f`; \
340 if test "x$$ver" = "x"; then \
341 plugin=`echo $$f | sed -e 's/^.*plugin-//' -e 's/.xml//'`; \
342 # echo "Checking $$plugin $$f"; \
343 pushd "$(top_srcdir)" >/dev/null; \
344 pinit=`git grep -A3 GST_PLUGIN_DEFINE -- ext/ gst/ sys/ | grep "\"$$plugin\""`; \
346 # echo "[$$pinit]"; \
347 if test "x$$pinit" = "x"; then \
348 printf " **** outdated docs for plugin %-15s: %s\n" $$plugin $$f; \
357 # Require gtk-doc when making dist
363 @echo "*** gtk-doc must be installed and enabled in order to make dist"
367 # FIXME: decide whether we want to dist generated html or not
368 # also this only works, if the project has been build before
369 # we could dist html only if its there, but that might lead to missing html in
371 dist-hook: dist-check-gtkdoc dist-hook-local
372 mkdir $(distdir)/html
373 cp html/* $(distdir)/html
374 -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
375 -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
376 cd $(distdir) && rm -f $(DISTCLEANFILES)
377 -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
379 .PHONY : dist-hook-local docs check-outdated-docs inspect
381 # avoid spurious build errors when distchecking with -jN