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