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
59 $(DOC_MODULE).hierarchy \
60 $(DOC_MODULE).interfaces \
61 $(DOC_MODULE).prerequisites \
62 $(DOC_MODULE).signals \
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
90 all-local: html-build.stamp
92 ### inspect GStreamer plug-ins; done by documentation maintainer ###
94 # only look at the plugins in this module when building inspect .xml stuff
95 INSPECT_REGISTRY=$(top_builddir)/docs/plugins/inspect-registry.xml
98 GST_PLUGIN_SYSTEM_PATH= \
99 GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(top_builddir)/plugins:$(top_builddir)/src:$(top_builddir)/gnl \
100 GST_REGISTRY=$(INSPECT_REGISTRY) \
101 PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
102 $(INSPECT_EXTRA_ENVIRONMENT)
104 #### scan gobjects; done by documentation maintainer ####
106 -rm scanobj-build.stamp
107 $(MAKE) scanobj-build.stamp
109 # gstdoc-scanobj produces 5 output files (.new)
110 # scangobj-merge.py merges them into the file which we commit later
111 # TODO: also merge the hierarchy
112 scanobj-build.stamp: $(SCANOBJ_DEPS) $(basefiles)
113 @echo " DOC Introspecting gobjects"
114 @if test x"$(srcdir)" != x. ; then \
115 for f in $(SCANOBJ_FILES) $(SCAN_FILES); \
117 if test -e $(srcdir)/$$f; then cp -u $(srcdir)/$$f . ; fi; \
120 mkdir -p $(INSPECT_DIR); \
121 scanobj_options=""; \
122 if test "x$(V)" = "x1"; then \
123 scanobj_options="--verbose"; \
125 $(INSPECT_ENVIRONMENT) \
126 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" \
127 CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS) $(WARNING_CFLAGS)" \
128 LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
129 $(GST_DOC_SCANOBJ) $$scanobj_options --type-init-func="gst_init(NULL,NULL)" \
130 --module=$(DOC_MODULE) --source=$(PACKAGE) --inspect-dir=$(INSPECT_DIR) && \
131 echo " DOC Merging introspection data" && \
133 $(top_srcdir)/common/scangobj-merge.py $(DOC_MODULE); \
134 if test x"$(srcdir)" != x. ; then \
135 for f in $(SCANOBJ_FILES); \
137 cmp -s ./$$f $(srcdir)/$$f || cp ./$$f $(srcdir)/ ; \
140 touch scanobj-build.stamp
142 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(SCANOBJ_FILES_O): scan-build.stamp
145 ### scan headers; done on every build ###
146 scan-build.stamp: $(HFILE_GLOB) $(EXTRA_HFILES) $(basefiles) scanobj-build.stamp
147 @echo ' DOC Scanning header files'
148 @if test x"$(srcdir)" != x. ; then \
149 for f in $(SCANOBJ_FILES) $(SCAN_FILES); \
151 if test -e $(srcdir)/$$f; then cp -u $(srcdir)/$$f . ; fi; \
155 for i in $(DOC_SOURCE_DIR) ; do \
156 _source_dir="$${_source_dir} --source-dir=$$i" ; \
159 $(SCAN_OPTIONS) $(EXTRA_HFILES) \
160 --module=$(DOC_MODULE) \
162 --ignore-headers="$(IGNORE_HFILES)"; \
163 touch scan-build.stamp
165 #### update templates; done on every build ####
167 # in a non-srcdir build, we need to copy files from the previous step
168 # and the files from previous runs of this step
169 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
170 @echo ' DOC Rebuilding template files'
171 @if test x"$(srcdir)" != x. ; then \
172 for f in $(SCANOBJ_FILES) $(SCAN_FILES); \
174 if test -e $(srcdir)/$$f; then cp -u $(srcdir)/$$f . ; fi; \
177 @gtkdoc-mktmpl --module=$(DOC_MODULE)
179 $(top_srcdir)/common/mangle-tmpl.py $(srcdir)/$(INSPECT_DIR) tmpl
180 @touch tmpl-build.stamp
182 tmpl.stamp: tmpl-build.stamp
187 sgml-build.stamp: tmpl.stamp scan-build.stamp $(CFILE_GLOB) $(top_srcdir)/common/plugins.xsl $(expand_content_files)
188 @echo ' DOC Building XML'
190 @for a in $(srcdir)/$(INSPECT_DIR)/*.xml; do \
191 xsltproc --stringparam module $(MODULE) \
192 $(top_srcdir)/common/plugins.xsl $$a > xml/`basename $$a`; done
193 @for f in $(EXAMPLE_CFILES); do \
194 $(PYTHON) $(top_srcdir)/common/c-to-xml.py $$f > xml/element-`basename $$f .c`.xml; done
196 --module=$(DOC_MODULE) \
197 --source-dir=$(DOC_SOURCE_DIR) \
198 --expand-content-files="$(expand_content_files)" \
199 --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) \
200 --output-format=xml \
201 --ignore-files="$(IGNORE_HFILES) $(IGNORE_CFILES)" \
203 @cp ../version.entities xml
204 @touch sgml-build.stamp
206 sgml.stamp: sgml-build.stamp
211 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
212 @echo ' DOC Building HTML'
215 @cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
216 @for f in $(content_files); do cp $(srcdir)/$$f html; done
218 @cp ../version.entities html
219 @mkhtml_options=""; \
220 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
221 if test "$(?)" = "0"; then \
222 if test "x$(V)" = "x1"; then \
223 mkhtml_options="$$mkhtml_options --verbose"; \
226 cd html && gtkdoc-mkhtml $$mkhtml_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE)
227 @mv html/index.sgml html/index.sgml.bak
228 @$(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml
229 @rm -f html/index.sgml.bak
230 @rm -f html/$(DOC_MAIN_SGML_FILE)
232 @rm -f html/version.entities
233 @test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
234 if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
235 @echo ' DOC Fixing cross-references'
236 @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
237 @touch html-build.stamp
240 @rm -rf xml tmpl html
241 # clean files copied for nonsrcdir templates build
242 @if test x"$(srcdir)" != x. ; then \
243 rm -rf $(SCANOBJ_FILES) $(SCAN_FILES) $(REPORT_FILES) \
244 $(MAINTAINER_DOC_STAMPS); \
251 clean-local: clean-local-gtkdoc
256 @rm -f $(REPORT_FILES) \
257 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
258 @rm -rf tmpl/*.sgml.bak
259 @rm -f $(DOC_MODULE).hierarchy
260 @rm -f *.stamp || true
261 @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
262 rm -f $(DOC_MODULE)-docs.sgml ; \
263 rm -f $(DOC_MODULE).types ; \
264 rm -f $(DOC_MODULE).interfaces ; \
265 rm -f $(DOC_MODULE)-overrides.txt ; \
266 rm -f $(DOC_MODULE).prerequisites ; \
267 rm -f $(DOC_MODULE)-sections.txt ; \
268 rm -rf tmpl/*.sgml ; \
269 rm -rf $(INSPECT_DIR); \
273 MAINTAINERCLEANFILES = $(MAINTAINER_DOC_STAMPS)
275 # thomas: make docs parallel installable; devhelp requires majorminor too
277 (installfiles=`echo $(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css`; \
278 if test "$$installfiles" = '$(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css'; \
279 then echo '-- Nothing to install' ; \
281 $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
282 for i in $$installfiles; do \
283 echo '-- Installing '$$i ; \
284 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
286 pngfiles=`echo ./html/*.png`; \
287 if test "$$pngfiles" != './html/*.png'; then \
288 for i in $$pngfiles; do \
289 echo '-- Installing '$$i ; \
290 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
293 echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp2' ; \
294 if test -e $(builddir)/html/$(DOC_MODULE).devhelp2; then \
295 $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp2 \
296 $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
298 (which gtkdoc-rebase >/dev/null && \
299 gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR)) || true ; \
302 if test -d $(DESTDIR)$(TARGET_DIR); then \
303 rm -rf $(DESTDIR)$(TARGET_DIR)/*; \
304 rmdir -p $(DESTDIR)$(TARGET_DIR) 2>/dev/null || true; \
306 echo '-- Nothing to uninstall' ; \
313 check-hierarchy: $(DOC_MODULE).hierarchy
314 @if grep ' ' $(DOC_MODULE).hierarchy; then \
315 echo "$(DOC_MODULE).hierarchy contains tabs, please fix"; \
319 check: check-hierarchy
322 # wildcard is apparently not portable to other makes, hence the use of find
323 inspect_files = $(shell find $(srcdir)/$(INSPECT_DIR) -name '*.xml')
325 check-inspected-versions:
326 @echo Checking plugin versions of inspected plugin data ...; \
328 for each in $(inspect_files) ; do \
329 if (grep -H '<version>' $$each | grep -v '<version>$(VERSION)'); then \
330 echo $$each should be fixed to say version $(VERSION) or be removed ; \
331 echo "sed -i -e 's/<version.*version>/<version>$(VERSION)<\/version>/'" $$each; \
339 $(AM_V_GEN)echo Checking for outdated plugin inspect data ...; \
341 if [ -d $(top_srcdir)/.git/ ]; then \
342 files=`find $(srcdir)/inspect/ -name '*xml'`; \
343 for f in $$files; do \
344 ver=`grep '<version>$(PACKAGE_VERSION)</version>' $$f`; \
345 if test "x$$ver" = "x"; then \
346 plugin=`echo $$f | sed -e 's/^.*plugin-//' -e 's/.xml//'`; \
347 # echo "Checking $$plugin $$f"; \
348 pushd "$(top_srcdir)" >/dev/null; \
349 pinit=`git grep -A3 GST_PLUGIN_DEFINE -- ext/ gst/ sys/ | grep "\"$$plugin\""`; \
351 # echo "[$$pinit]"; \
352 if test "x$$pinit" = "x"; then \
353 printf " **** outdated docs for plugin %-15s: %s\n" $$plugin $$f; \
362 # Require gtk-doc when making dist
368 @echo "*** gtk-doc must be installed and enabled in order to make dist"
372 # FIXME: decide whether we want to dist generated html or not
373 # also this only works, if the project has been build before
374 # we could dist html only if its there, but that might lead to missing html in
376 dist-hook: dist-check-gtkdoc dist-hook-local
377 mkdir $(distdir)/html
378 cp html/* $(distdir)/html
379 -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
380 -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
381 cd $(distdir) && rm -f $(DISTCLEANFILES)
382 -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
384 .PHONY : dist-hook-local docs check-outdated-docs inspect
386 # avoid spurious build errors when distchecking with -jN