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