1###########################################################################
2# Everything below here is generic and you shouldn't need to change it.
3###########################################################################
4# thomas: except of course that we did
5
6# thomas: copied from glib-2
7# We set GPATH here; this gives us semantics for GNU make
8# which are more like other make's VPATH, when it comes to
9# whether a source that is a target of one rule is then
10# searched for in VPATH/GPATH.
11#
12GPATH = $(srcdir)
13
14# thomas: make docs parallel installable
15TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_API_VERSION@
16
17EXTRA_DIST = 				\
18	$(content_files)		\
19	$(extra_files)			\
20	$(HTML_IMAGES)			\
21	$(DOC_MAIN_SGML_FILE)		\
22	$(DOC_MODULE).types		\
23	$(DOC_OVERRIDES)		\
24	$(DOC_MODULE)-sections.txt
25
26DOC_STAMPS =				\
27	setup-build.stamp		\
28	scan-build.stamp		\
29	sgml-build.stamp		\
30	html-build.stamp		\
31	sgml.stamp		\
32	html.stamp
33
34SCANOBJ_FILES =				\
35	$(DOC_MODULE).args		\
36	$(DOC_MODULE).hierarchy		\
37	$(DOC_MODULE).interfaces		\
38	$(DOC_MODULE).prerequisites	\
39	$(DOC_MODULE).signals		\
40	.libs/$(DOC_MODULE)-scan.o
41
42REPORT_FILES = \
43	$(DOC_MODULE)-undocumented.txt \
44	$(DOC_MODULE)-undeclared.txt \
45	$(DOC_MODULE)-unused.txt
46
47CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) doc-registry.xml
48
49if ENABLE_GTK_DOC
50all-local: html-build.stamp
51
52#### setup ####
53
54setup-build.stamp: $(content_files)
55	-@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
56	    echo '  DOC   Preparing build'; \
57	    files=`echo $(DOC_MAIN_SGML_FILE) $(DOC_OVERRIDES) $(DOC_MODULE)-sections.txt $(DOC_MODULE).types $(content_files)`; \
58	    if test "x$$files" != "x" ; then \
59	        for file in $$files ; do \
60	            test -f $(abs_srcdir)/$$file && \
61	                cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \
62	        done; \
63	    fi; \
64	fi
65	@touch setup-build.stamp
66
67#### scan ####
68
69# in the case of non-srcdir builds, the built gst directory gets added
70# to gtk-doc scanning; but only then, to avoid duplicates
71scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
72	@echo '  DOC   Scanning header files'
73	@_source_dir='' ;						\
74	for i in $(DOC_SOURCE_DIR) ; do					\
75	    _source_dir="$${_source_dir} --source-dir=$$i" ;	        \
76	done ;							        \
77	gtkdoc-scan							\
78		$(SCAN_OPTIONS) $(EXTRA_HFILES)				\
79		--module=$(DOC_MODULE)					\
80		$${_source_dir}         				\
81		--ignore-headers="$(IGNORE_HFILES)"
82	@if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null; then	\
83	    echo "  DOC   Introspecting gobjects"; \
84	    GST_PLUGIN_SYSTEM_PATH_1_0=`cd $(top_builddir) && pwd`		\
85	    GST_PLUGIN_PATH_1_0=						\
86	    GST_REGISTRY_1_0=doc-registry.xml				\
87	    $(GTKDOC_EXTRA_ENVIRONMENT)					\
88	    CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"				\
89	    CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)"				\
90	    LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)"				\
91	    gtkdoc-scangobj --type-init-func="gst_init(NULL,NULL)"	\
92	        --module=$(DOC_MODULE) ;				\
93	else								\
94	    for i in $(SCANOBJ_FILES) ; do				\
95	       test -f $$i || touch $$i ;				\
96	    done							\
97	fi
98	@touch scan-build.stamp
99
100$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
101	@true
102
103#### xml ####
104
105sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(expand_content_files)
106	@echo '  DOC   Building XML'
107	@gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR)  --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) --output-format=xml $(MKDB_OPTIONS)
108	@cp ../version.entities xml
109	@touch sgml-build.stamp
110
111sgml.stamp: sgml-build.stamp
112	@true
113
114#### html ####
115
116html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
117	@echo '  DOC   Building HTML'
118	@rm -rf html
119	@mkdir html
120	@cp -pr xml html
121	@cp ../version.entities ./
122	@mkhtml_options=""; \
123	gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
124	if test "$(?)" = "0"; then \
125	  if test "x$(V)" = "x1"; then \
126	    mkhtml_options="$$mkhtml_options --verbose"; \
127	  fi; \
128	fi; \
129	@gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-path"; \
130	if test "$(?)" = "0"; then \
131	  mkhtml_options=--path="$(abs_srcdir)"; \
132	fi; \
133	cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE)-@GST_API_VERSION@ ../$(DOC_MAIN_SGML_FILE)
134	@rm -rf html/xml
135	@rm -f version.entities
136	@test "x$(HTML_IMAGES)" = "x" ||  ( cd $(srcdir) && cp $(HTML_IMAGES) $(abs_builddir)/html )
137	@echo '  DOC   Fixing cross-references'
138	@gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
139	@touch html-build.stamp
140
141clean-local-gtkdoc:
142	@rm -rf xml tmpl html
143# clean files copied for nonsrcdir templates build
144	@if test x"$(srcdir)" != x. ; then \
145	        rm -rf $(DOC_MODULE).types; \
146	fi
147else
148all-local:
149clean-local-gtkdoc:
150endif
151
152clean-local: clean-local-gtkdoc
153	@rm -f *~ *.bak
154	@rm -rf .libs
155
156distclean-local:
157	@rm -f $(REPORT_FILES) \
158	        $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
159	@rm -rf tmpl/*.sgml.bak
160	@rm -f $(DOC_MODULE).hierarchy
161	@rm -f *.stamp || true
162	@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
163	    rm -f $(DOC_MAIN_SGML_FILE) ; \
164	    rm -f $(DOC_OVERRIDES) ; \
165	    rm -f $(DOC_MODULE).types ; \
166	    rm -f $(DOC_MODULE).interfaces ; \
167	    rm -f $(DOC_MODULE).prerequisites ; \
168	    rm -f $(DOC_MODULE)-sections.txt ; \
169	    rm -f $(content_files) ; \
170	    rm -rf tmpl/*.sgml ; \
171	fi
172	@rm -rf *.o
173
174maintainer-clean-local: clean
175	@cd $(srcdir) && rm -rf html \
176		xml $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
177
178# thomas: make docs parallel installable; devhelp requires majorminor too
179install-data-local:
180	(installfiles=`echo $(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css`; \
181	if test "$$installfiles" = '$(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css'; \
182	then echo '-- Nothing to install' ; \
183	else \
184	  $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
185	  for i in $$installfiles; do \
186	    echo '-- Installing '$$i ; \
187	    $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
188	  done; \
189	  echo '-- Installing $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2' ; \
190	  if test -e $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2; then \
191	            $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2 \
192	            $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2; \
193	  fi; \
194	  $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR) || true ; \
195	fi)
196uninstall-local:
197	if test -d $(DESTDIR)$(TARGET_DIR); then \
198	  rm -rf $(DESTDIR)$(TARGET_DIR)/*; \
199	  rmdir -p $(DESTDIR)$(TARGET_DIR) 2>/dev/null || true; \
200	else \
201	  echo '-- Nothing to uninstall' ; \
202	fi;
203
204
205#
206# Require gtk-doc when making dist
207#
208if ENABLE_GTK_DOC
209dist-check-gtkdoc:
210else
211dist-check-gtkdoc:
212	@echo "*** gtk-doc must be installed and enabled in order to make dist"
213	@false
214endif
215
216dist-hook: dist-check-gtkdoc dist-hook-local
217	mkdir $(distdir)/html
218	cp html/* $(distdir)/html
219	-cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
220	-cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
221	cd $(distdir) && rm -f $(DISTCLEANFILES)
222	-gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
223
224.PHONY : dist-hook-local docs
225
226# avoid spurious build errors when distchecking with -jN
227.NOTPARALLEL:
228