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