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
16 update: scanobj-update
17 $(MAKE) check-outdated-docs
19 # We set GPATH here; this gives us semantics for GNU make
20 # which are more like other make's VPATH, when it comes to
21 # whether a source that is a target of one rule is then
22 # searched for in VPATH/GPATH.
26 # thomas: make docs parallel installable
27 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_API_VERSION@
29 MAINTAINER_DOC_STAMPS = \
33 $(MAINTAINER_DOC_STAMPS) \
34 $(srcdir)/inspect/*.xml \
39 $(DOC_MAIN_SGML_FILE) \
41 $(DOC_MODULE)-sections.txt
43 # we don't add scanobj-build.stamp here since they are built manually by docs
44 # maintainers and result is commited to git
55 # files generated/updated by gtkdoc-scangobj
58 $(DOC_MODULE).hierarchy \
59 $(DOC_MODULE).interfaces \
60 $(DOC_MODULE).prerequisites \
61 $(DOC_MODULE).signals \
65 .libs/$(DOC_MODULE)-scan.o
67 # files generated/updated by gtkdoc-scan
69 $(DOC_MODULE)-sections.txt \
70 $(DOC_MODULE)-overrides.txt \
71 $(DOC_MODULE)-decl.txt \
72 $(DOC_MODULE)-decl-list.txt
76 $(DOC_MODULE)-undocumented.txt \
77 $(DOC_MODULE)-undeclared.txt \
78 $(DOC_MODULE)-unused.txt
89 all-local: html-build.stamp
91 ### inspect GStreamer plug-ins; done by documentation maintainer ###
93 # only look at the plugins in this module when building inspect .xml stuff
94 INSPECT_REGISTRY=$(top_builddir)/docs/plugins/inspect-registry.xml
97 GST_PLUGIN_SYSTEM_PATH= \
98 GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(top_builddir)/plugins:$(top_builddir)/src:$(top_builddir)/gnl \
99 GST_REGISTRY=$(INSPECT_REGISTRY) \
100 PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
101 $(INSPECT_EXTRA_ENVIRONMENT)
103 #### scan gobjects; done by documentation maintainer ####
105 -rm scanobj-build.stamp
106 $(MAKE) scanobj-build.stamp
108 # gstdoc-scanobj produces 5 output files (.new)
109 # scangobj-merge.py merges them into the file which we commit later
110 # TODO: also merge the hierarchy
111 scanobj-build.stamp: $(SCANOBJ_DEPS) $(basefiles)
112 @echo " DOC Introspecting gobjects"
113 @if test x"$(srcdir)" != x. ; then \
114 for f in $(SCANOBJ_FILES) $(SCAN_FILES); \
116 if test -e $(srcdir)/$$f; then cp -u $(srcdir)/$$f . ; fi; \
119 mkdir -p $(INSPECT_DIR); \
120 scanobj_options=""; \
121 if test "x$(V)" = "x1"; then \
122 scanobj_options="--verbose"; \
124 $(INSPECT_ENVIRONMENT) \
125 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" \
126 CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS) $(WARNING_CFLAGS)" \
127 LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
128 $(GST_DOC_SCANOBJ) $$scanobj_options --type-init-func="gst_init(NULL,NULL)" \
129 --module=$(DOC_MODULE) --source=$(PACKAGE) --inspect-dir=$(INSPECT_DIR) && \
130 echo " DOC Merging introspection data" && \
132 $(top_srcdir)/common/scangobj-merge.py $(DOC_MODULE) || exit 1; \
133 if test x"$(srcdir)" != x. ; then \
134 for f in $(SCANOBJ_FILES); \
136 cmp -s ./$$f $(srcdir)/$$f || cp ./$$f $(srcdir)/ ; \
139 touch scanobj-build.stamp
141 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(SCANOBJ_FILES_O): scan-build.stamp
144 ### scan headers; done on every build ###
145 scan-build.stamp: $(HFILE_GLOB) $(EXTRA_HFILES) $(basefiles) scanobj-build.stamp
146 @echo ' DOC Scanning header files'
147 @if test x"$(srcdir)" != x. ; then \
148 for f in $(SCANOBJ_FILES) $(SCAN_FILES); \
150 if test -e $(srcdir)/$$f; then cp -u $(srcdir)/$$f . ; fi; \
154 for i in $(DOC_SOURCE_DIR) ; do \
155 _source_dir="$${_source_dir} --source-dir=$$i" ; \
158 $(SCAN_OPTIONS) $(EXTRA_HFILES) \
159 --module=$(DOC_MODULE) \
161 --ignore-headers="$(IGNORE_HFILES)"; \
162 touch scan-build.stamp
164 #### update templates; done on every build ####
166 # in a non-srcdir build, we need to copy files from the previous step
167 # and the files from previous runs of this step
168 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
169 @echo ' DOC Rebuilding template files'
170 @if test x"$(srcdir)" != x. ; then \
171 for f in $(SCANOBJ_FILES) $(SCAN_FILES); \
173 if test -e $(srcdir)/$$f; then cp -u $(srcdir)/$$f . ; fi; \
176 @gtkdoc-mktmpl --module=$(DOC_MODULE)
178 $(top_srcdir)/common/mangle-tmpl.py $(srcdir)/$(INSPECT_DIR) tmpl
179 @touch tmpl-build.stamp
181 tmpl.stamp: tmpl-build.stamp
186 sgml-build.stamp: tmpl.stamp scan-build.stamp $(CFILE_GLOB) $(top_srcdir)/common/plugins.xsl $(expand_content_files)
187 @echo ' DOC Building XML'
189 @for a in $(srcdir)/$(INSPECT_DIR)/*.xml; do \
190 xsltproc --stringparam module $(MODULE) \
191 $(top_srcdir)/common/plugins.xsl $$a > xml/`basename $$a`; done
192 @for f in $(EXAMPLE_CFILES); do \
193 $(PYTHON) $(top_srcdir)/common/c-to-xml.py $$f > xml/element-`basename $$f .c`.xml; done
195 --module=$(DOC_MODULE) \
196 --source-dir=$(DOC_SOURCE_DIR) \
197 --expand-content-files="$(expand_content_files)" \
198 --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) \
199 --output-format=xml \
200 --ignore-files="$(IGNORE_HFILES) $(IGNORE_CFILES)" \
202 @cp ../version.entities xml
203 @touch sgml-build.stamp
205 sgml.stamp: sgml-build.stamp
210 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
211 @echo ' DOC Building HTML'
214 @cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
215 @for f in $(content_files); do cp $(srcdir)/$$f html; done
217 @cp ../version.entities html
218 @mkhtml_options=""; \
219 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
220 if test "$(?)" = "0"; then \
221 if test "x$(V)" = "x1"; then \
222 mkhtml_options="$$mkhtml_options --verbose"; \
225 cd html && gtkdoc-mkhtml $$mkhtml_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE)
226 @mv html/index.sgml html/index.sgml.bak
227 @$(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_API_VERSION@\//g" html/index.sgml.bak >html/index.sgml
228 @rm -f html/index.sgml.bak
229 @rm -f html/$(DOC_MAIN_SGML_FILE)
231 @rm -f html/version.entities
232 @test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
233 if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
234 @echo ' DOC Fixing cross-references'
235 @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
236 @touch html-build.stamp
239 @rm -rf xml tmpl html
240 # clean files copied for nonsrcdir templates build
241 @if test x"$(srcdir)" != x. ; then \
242 rm -rf $(SCANOBJ_FILES) $(SCAN_FILES) $(REPORT_FILES) \
243 $(MAINTAINER_DOC_STAMPS); \
250 clean-local: clean-local-gtkdoc
255 @rm -f $(REPORT_FILES) \
256 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
257 @rm -rf tmpl/*.sgml.bak
258 @rm -f $(DOC_MODULE).hierarchy
259 @rm -f *.stamp || true
260 @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
261 rm -f $(DOC_MODULE)-docs.sgml ; \
262 rm -f $(DOC_MODULE).types ; \
263 rm -f $(DOC_MODULE).interfaces ; \
264 rm -f $(DOC_MODULE)-overrides.txt ; \
265 rm -f $(DOC_MODULE).prerequisites ; \
266 rm -f $(DOC_MODULE)-sections.txt ; \
267 rm -rf tmpl/*.sgml ; \
268 rm -rf $(INSPECT_DIR); \
272 MAINTAINERCLEANFILES = $(MAINTAINER_DOC_STAMPS)
274 # thomas: make docs parallel installable; devhelp requires majorminor too
276 (installfiles=`echo $(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css`; \
277 if test "$$installfiles" = '$(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css'; \
278 then echo '-- Nothing to install' ; \
280 $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
281 for i in $$installfiles; do \
282 echo '-- Installing '$$i ; \
283 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
285 pngfiles=`echo ./html/*.png`; \
286 if test "$$pngfiles" != './html/*.png'; then \
287 for i in $$pngfiles; do \
288 echo '-- Installing '$$i ; \
289 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
292 echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp2' ; \
293 if test -e $(builddir)/html/$(DOC_MODULE).devhelp2; then \
294 $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp2 \
295 $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2; \
297 (which gtkdoc-rebase >/dev/null && \
298 gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR)) || true ; \
301 if test -d $(DESTDIR)$(TARGET_DIR); then \
302 rm -rf $(DESTDIR)$(TARGET_DIR)/*; \
303 rmdir -p $(DESTDIR)$(TARGET_DIR) 2>/dev/null || true; \
305 echo '-- Nothing to uninstall' ; \
312 check-hierarchy: $(DOC_MODULE).hierarchy
313 @if grep ' ' $(DOC_MODULE).hierarchy; then \
314 echo "$(DOC_MODULE).hierarchy contains tabs, please fix"; \
318 check: check-hierarchy
321 # wildcard is apparently not portable to other makes, hence the use of find
322 inspect_files = $(shell find $(srcdir)/$(INSPECT_DIR) -name '*.xml')
324 check-inspected-versions:
325 @echo Checking plugin versions of inspected plugin data ...; \
327 for each in $(inspect_files) ; do \
328 if (grep -H '<version>' $$each | grep -v '<version>$(VERSION)'); then \
329 echo $$each should be fixed to say version $(VERSION) or be removed ; \
330 echo "sed -i -e 's/<version.*version>/<version>$(VERSION)<\/version>/'" $$each; \
338 $(AM_V_GEN)echo Checking for outdated plugin inspect data ...; \
340 if [ -d $(top_srcdir)/.git/ ]; then \
341 files=`find $(srcdir)/inspect/ -name '*xml'`; \
342 for f in $$files; do \
343 ver=`grep '<version>$(PACKAGE_VERSION)</version>' $$f`; \
344 if test "x$$ver" = "x"; then \
345 plugin=`echo $$f | sed -e 's/^.*plugin-//' -e 's/.xml//'`; \
346 # echo "Checking $$plugin $$f"; \
347 pushd "$(top_srcdir)" >/dev/null; \
348 pinit=`git grep -A3 GST_PLUGIN_DEFINE -- ext/ gst/ sys/ | grep "\"$$plugin\""`; \
350 # echo "[$$pinit]"; \
351 if test "x$$pinit" = "x"; then \
352 printf " **** outdated docs for plugin %-15s: %s\n" $$plugin $$f; \
361 # Require gtk-doc when making dist
367 @echo "*** gtk-doc must be installed and enabled in order to make dist"
371 # FIXME: decide whether we want to dist generated html or not
372 # also this only works, if the project has been build before
373 # we could dist html only if its there, but that might lead to missing html in
375 dist-hook: dist-check-gtkdoc dist-hook-local
376 mkdir $(distdir)/html
377 cp html/* $(distdir)/html
378 -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
379 -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
380 cd $(distdir) && rm -f $(DISTCLEANFILES)
381 -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
383 .PHONY : dist-hook-local docs check-outdated-docs inspect
385 # avoid spurious build errors when distchecking with -jN