try fix distcheck for FC3
[platform/upstream/gst-common.git] / gtk-doc-plugins.mak
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 #
12 GPATH = $(srcdir)
13
14 # thomas: make docs parallel installable
15 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@
16
17 EXTRA_DIST =                            \
18         inspect.stamp                   \
19         inspect-build.stamp             \
20         $(srcdir)/inspect/*.xml         \
21         $(content_files)                \
22         $(extra_files)                  \
23         $(HTML_IMAGES)                  \
24         $(DOC_MAIN_SGML_FILE)           \
25         $(DOC_MODULE).types             \
26         $(DOC_OVERRIDES)                \
27         $(DOC_MODULE)-sections.txt
28
29 # we don't add inspect-build.stamp here since this is run manually
30 # by docs maintainers and result is commited to CVS
31 DOC_STAMPS =                            \
32         scan-build.stamp                \
33         tmpl-build.stamp                \
34         sgml-build.stamp                \
35         html-build.stamp                \
36         $(srcdir)/tmpl.stamp            \
37         $(srcdir)/sgml.stamp            \
38         $(srcdir)/html.stamp
39
40 SCANOBJ_FILES =                         \
41         $(DOC_MODULE).args              \
42         $(DOC_MODULE).hierarchy         \
43         $(DOC_MODULE).interfaces        \
44         $(DOC_MODULE).prerequisites     \
45         .libs/$(DOC_MODULE)-scan.o      \
46         $(DOC_MODULE).signals
47
48 # FC3 seems to need -scan.c to be part of CLEANFILES for distcheck
49 # no idea why FC4 can do without
50 CLEANFILES = $(SCANOBJ_FILES) $(DOC_MODULE)-unused.txt $(DOC_STAMPS) $(DOC_MODULE)-scan.c
51
52 if ENABLE_GTK_DOC
53 all-local: html-build.stamp
54
55 #### scan ####
56
57 # in the case of non-srcdir builds, the built gst directory gets added
58 # to gtk-doc scanning; but only then, to avoid duplicates
59 scan-build.stamp: $(HFILE_GLOB) $(SCANOBJ_DEPS) $(basefiles)
60         @echo '*** Scanning header files ***'
61             if test x"$(srcdir)" != x. ; then                           \
62                 cp $(srcdir)/$(DOC_MODULE).types . ;                    \
63                 chmod u+w $(DOC_MODULE).types ;                         \
64             fi ;                                                        \
65             GST_PLUGIN_PATH=`cd $(top_builddir) && pwd`                 \
66             GST_PLUGIN_PATH_ONLY=1                                      \
67             CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"                         \
68             CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)"          \
69             $(GST_DOC_SCANOBJ) --type-init-func="gst_init(NULL,NULL)"   \
70                 --module=$(DOC_MODULE) ;                                \
71         if test "x$(top_srcdir)" != "x$(top_builddir)";                 \
72         then                                                            \
73           export BUILT_OPTIONS="--source-dir=$(top_builddir)/gst";      \
74         fi;                                                             \
75         gtkdoc-scan                                                     \
76                 $(SCAN_OPTIONS) $(EXTRA_HFILES)                         \
77                 --module=$(DOC_MODULE)                                  \
78                 $$BUILT_OPTIONS                                         \
79                 --ignore-headers="$(IGNORE_HFILES)"
80         touch scan-build.stamp
81
82 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
83         @true
84
85 #### templates ####
86
87 ### FIXME: make this error out again when docs are fixed for 0.9
88 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
89         @echo '*** Rebuilding template files ***'
90         if test x"$(srcdir)" != x. ; then \
91             cp $(srcdir)/$(DOC_MODULE)-sections.txt . ; \
92             touch $(DOC_MODULE)-decl.txt ; \
93         fi
94         gtkdoc-mktmpl --module=$(DOC_MODULE) | tee tmpl-build.log
95         @cat $(DOC_MODULE)-unused.txt
96         @if ! test -z "`grep -v GstPoptOption $(DOC_MODULE)-unused.txt`"; then \
97             true; fi # exit 1; fi
98         rm -f tmpl-build.log
99         touch tmpl-build.stamp
100
101 tmpl.stamp: tmpl-build.stamp
102         @true
103
104 #### inspect stuff ####
105 # this is stuff that should be built/updated manually by people that work
106 # on docs
107
108 # only look at the plugins in this module when building inspect .xml stuff
109 INSPECT_REGISTRY=$(top_builddir)/docs/plugins/inspect-registry.xml
110 INSPECT_ENVIRONMENT=\
111         GST_PLUGIN_PATH_ONLY=yes \
112         GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext \
113         GST_REGISTRY=$(INSPECT_REGISTRY)
114
115
116 # update the element and plugin XML descriptions; store in inspect/
117 inspect:
118         mkdir inspect
119
120 inspect-update:
121         rm inspect-build.stamp
122         make inspect-build.stamp
123
124 # FIXME: inspect.timestamp should be written to by gst-xmlinspect.py
125 # IFF the output changed; see gtkdoc-mktmpl
126 inspect-build.stamp: inspect
127         @echo '*** Rebuilding plugin inspection files ***'
128         if test x"$(srcdir)" != x. ; then \
129             cp $(srcdir)/inspect.stamp . ; \
130             cp $(srcdir)/inspect-build.stamp . ; \
131         else \
132             $(INSPECT_ENVIRONMENT) $(PYTHON) \
133                 $(top_srcdir)/common/gst-xmlinspect.py $(PACKAGE) inspect; \
134             $(INSPECT_ENVIRONMENT) $(PYTHON) \
135                 $(top_srcdir)/common/mangle-tmpl.py tmpl; \
136             echo -n "timestamp" > inspect.stamp; \
137             touch inspect-build.stamp; \
138         fi
139
140 inspect.stamp: inspect-build.stamp
141         @true
142
143 #### xml ####
144
145 ### FIXME: make this error out again when docs are fixed for 0.9
146 # first convert inspect/*.xml to xml
147 sgml-build.stamp: tmpl.stamp inspect.stamp $(CFILE_GLOB) $(top_srcdir)/common/plugins.xsl
148         @echo '*** Building XML ***'
149         @-mkdir -p xml
150         @for a in $(srcdir)/inspect/*.xml; do \
151             xsltproc --stringparam module $(MODULE) \
152                 $(top_srcdir)/common/plugins.xsl $$a > xml/`basename $$a`; done
153         gtkdoc-mkdb \
154                 --module=$(DOC_MODULE) \
155                 --source-dir=$(DOC_SOURCE_DIR) \
156                 --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) \
157                 --output-format=xml \
158                 --ignore-files="$(IGNORE_HFILES) $(IGNORE_CFILES)" \
159                 $(MKDB_OPTIONS) \
160                 | tee sgml-build.log
161         @if grep "WARNING:" sgml-build.log > /dev/null; then true; fi # exit 1; fi
162         cp ../version.entities xml
163         rm sgml-build.log
164         touch sgml-build.stamp
165
166 sgml.stamp: sgml-build.stamp
167         @true
168
169 #### html ####
170
171 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(top_srcdir)/common/plugins.xsl
172         @echo '*** Building HTML ***'
173         if test -d html; then rm -rf html; fi
174         mkdir html
175         cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
176         @for f in $(content_files); do cp $(srcdir)/$$f html; done
177         cp -pr xml html
178         cp ../version.entities html
179         cd html && gtkdoc-mkhtml $(DOC_MODULE) $(DOC_MAIN_SGML_FILE)
180         rm -f html/$(DOC_MAIN_SGML_FILE)
181         rm -rf html/xml
182         rm -f html/version.entities
183         test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
184             if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
185         @echo '-- Fixing Crossreferences' 
186         gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
187         touch html-build.stamp
188 else
189 all-local:
190 endif
191
192 clean-local:
193         rm -f *~ *.bak
194         rm -rf xml html
195         rm -rf .libs
196
197 maintainer-clean-local: clean
198         cd $(srcdir) && rm -rf xml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
199
200 # company: don't delete .sgml and -sections.txt as they're in CVS
201 # FIXME : thomas added all sgml files and some other things to make
202 # make distcheck work
203 distclean-local: clean
204         rm -f $(DOC_MODULE)-decl-list.txt
205         rm -f $(DOC_MODULE)-decl.txt
206         rm -f $(DOC_MODULE)-undocumented.txt
207         rm -f $(DOC_MODULE)-unused.txt
208         rm -rf tmpl/*.sgml.bak
209         rm -f $(DOC_MODULE).hierarchy
210         rm -f *.stamp || true
211         if test x"$(srcdir)" != x. ; then \
212             rm -f $(DOC_MODULE)-docs.sgml ; \
213             rm -f $(DOC_MODULE).types ; \
214             rm -f $(DOC_MODULE).interfaces ; \
215             rm -f $(DOC_MODULE)-overrides.txt ; \
216             rm -f $(DOC_MODULE).prerequisites ; \
217             rm -f $(DOC_MODULE)-sections.txt ; \
218             rm -rf tmpl/*.sgml ; \
219         fi
220         rm -rf *.o
221
222 # thomas: make docs parallel installable; devhelp requires majorminor too
223 install-data-local:
224         $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) 
225         (installfiles=`echo ./html/*.html`; \
226         if test "$$installfiles" = './html/*.html'; \
227         then echo '-- Nothing to install' ; \
228         else \
229           for i in $$installfiles; do \
230             echo '-- Installing '$$i ; \
231             $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
232           done; \
233           pngfiles=`echo ./html/*.png`; \
234           if test "$$pngfiles" != './html/*.png'; then \
235             for i in $$pngfiles; do \
236               echo '-- Installing '$$i ; \
237               $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
238             done; \
239           fi; \
240           echo '-- Installing $(srcdir)/html/$(DOC_MODULE).devhelp' ; \
241           $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp \
242             $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
243           echo '-- Installing $(srcdir)/html/index.sgml' ; \
244           $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
245                 if test -e $(srcdir)/html/style.css; then \
246                         echo '-- Installing $(srcdir)/html/style.css' ; \
247                         $(INSTALL_DATA) $(srcdir)/html/style.css $(DESTDIR)$(TARGET_DIR); \
248                 fi; \
249         fi) 
250 uninstall-local:
251         (installfiles=`echo ./html/*.html`; \
252         if test "$$installfiles" = './html/*.html'; \
253         then echo '-- Nothing to uninstall' ; \
254         else \
255           for i in $$installfiles; do \
256             rmfile=`basename $$i` ; \
257             echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
258             rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
259           done; \
260           pngfiles=`echo ./html/*.png`; \
261           if test "$$pngfiles" != './html/*.png'; then \
262             for i in $$pngfiles; do \
263               rmfile=`basename $$i` ; \
264               echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
265               rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
266             done; \
267           fi; \
268           echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE).devhelp' ; \
269           rm -f $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
270           echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/index.sgml' ; \
271           rm -f $(DESTDIR)$(TARGET_DIR)/index.sgml; \
272                 if test -e $(DESTDIR)$(TARGET_DIR)/style.css; then \
273                         echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/style.css' ; \
274                         rm -f $(DESTDIR)$(TARGET_DIR)/style.css; \
275                 fi; \
276         fi) 
277         if test -d $(DESTDIR)$(TARGET_DIR); then rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(TARGET_DIR) 2>/dev/null; fi; true
278
279 #
280 # Require gtk-doc when making dist
281 #
282 if ENABLE_GTK_DOC
283 dist-check-gtkdoc:
284 else
285 dist-check-gtkdoc:
286         @echo "*** gtk-doc must be installed and enabled in order to make dist"
287         @false
288 endif
289
290 dist-hook: dist-check-gtkdoc dist-hook-local
291         mkdir $(distdir)/tmpl
292         mkdir $(distdir)/xml
293         mkdir $(distdir)/html
294         -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
295         -cp $(srcdir)/sgml/*.xml $(distdir)/xml
296         -cp $(srcdir)/html/index.sgml $(distdir)/html
297         -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
298         -cp $(srcdir)/html/$(DOC_MODULE).devhelp $(distdir)/html
299
300         images=$(HTML_IMAGES) ;               \
301         for i in "" $$images ; do                     \
302           if test "$$i" != ""; then cp $(srcdir)/$$i $(distdir)/html ; fi; \
303         done
304
305 .PHONY : dist-hook-local