doh
[platform/upstream/gstreamer.git] / docs / libs / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2
3 # The name of the module, e.g. 'glib'.
4 #DOC_MODULE=gstreamer-libs-@GST_MAJORMINOR@
5 DOC_MODULE=gstreamer-libs
6
7 # for upload.mak
8 DOC=gstreamer-libs
9 FORMATS=html
10 html: html-build.stamp
11 include $(srcdir)/../upload.mak
12
13 # generated basefiles
14 #basefiles = \
15 ##              $(DOC_MODULE).types \
16 #               $(DOC_MODULE)-sections.txt \
17 #               $(DOC_MODULE)-docs.sgml
18
19 # ugly hack to make -unused.sgml work
20 #unused-build.stamp:
21 #       BUILDDIR=`pwd` && \
22 #       cd $(srcdir)/tmpl && \
23 #       ln -sf gstreamer-libs-unused.sgml \
24 #               $$BUILDDIR/tmpl/gstreamer-libs-@GST_MAJORMINOR@-unused.sgml
25 #       touch unused-build.stamp
26
27 # these rules are added to create parallel docs using GST_MAJORMINOR
28 #$(basefiles): gstreamer-libs-@GST_MAJORMINOR@%: gstreamer-libs%
29 #       cp $< $@
30
31 #CLEANFILES = $(basefiles)
32
33 # The top-level SGML file. Change it if you want.
34 DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
35
36 # The directory containing the source code. Relative to $(top_srcdir).
37 # gtk-doc will search all .c & .h files beneath here for inline comments
38 # documenting functions and macros.
39 DOC_SOURCE_DIR=$(top_srcdir)/libs/gst
40
41 # Extra options to supply to gtkdoc-scan.
42 SCAN_OPTIONS=
43
44 # FIXME :
45 # there's something wrong with gstreamer-sections.txt not being in the dist
46 # maybe it doesn't resolve; we're adding it below for now
47 #EXTRA_DIST = gstreamer.types.in gstreamer.hierarchy $(DOC_MODULE)-sections.txt gstreamer-sections.txt $(DOC_MAIN_SGML_FILE)
48
49 # Extra options to supply to gtkdoc-mkdb.
50 MKDB_OPTIONS=--sgml-mode --ignore-files=trio
51
52 # Extra options to supply to gtkdoc-fixref.
53 FIXXREF_OPTIONS=--extra-dir=../gst/html
54
55 # Used for dependencies.
56 HFILE_GLOB=$(DOC_SOURCE_DIR)/*/*.h
57 CFILE_GLOB=$(DOC_SOURCE_DIR)/*/*.c
58
59 # this is a wingo addition
60 # thomasvs: another nice wingo addition would be an explanation on why
61 # this is useful ;)
62
63 #SCANOBJ_DEPS = $(top_builddir)/gst/elements/libgstelements.la \
64 #       $(top_builddir)/gst/schedulers/libgstbasicomegascheduler.la
65 SCANOBJ_DEPS = $(top_builddir)/libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la
66
67 # Header files to ignore when scanning.
68 IGNORE_HFILES=
69
70 # Images to copy into HTML directory.
71 HTML_IMAGES =
72
73 # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
74 content_files =
75
76 # Other files to distribute.
77 extra_files =
78
79 # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
80 # contains GtkObjects/GObjects and you want to document signals and properties.
81 GTKDOC_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)
82 GTKDOC_LIBS = $(GST_OBJ_LIBS) $(SCANOBJ_DEPS)
83
84 GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
85 GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
86
87 # If you need to override some of the declarations, place them in this file
88 # and uncomment this line.
89 #DOC_OVERRIDES = $(DOC_MODULE)-overrides.txt
90
91
92
93 ###########################################################################
94 # Everything below here is generic and you shouldn't need to change it.
95 ###########################################################################
96 # thomas: except of course that we did
97
98 # thomas: copied from glib-2
99 # We set GPATH here; this gives us semantics for GNU make
100 # which are more like other make's VPATH, when it comes to
101 # whether a source that is a target of one rule is then
102 # searched for in VPATH/GPATH.
103 #
104 GPATH = $(srcdir)
105
106 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@
107
108 EXTRA_DIST =                            \
109         $(content_files)                \
110         $(extra_files)                  \
111         $(HTML_IMAGES)                  \
112         $(DOC_MAIN_SGML_FILE)           \
113         $(DOC_MODULE).types             \
114         $(DOC_MODULE)-sections.txt
115
116 DOC_STAMPS =                            \
117         scan-build.stamp                \
118         tmpl-build.stamp                \
119         sgml-build.stamp                \
120         html-build.stamp                \
121         $(srcdir)/tmpl.stamp            \
122         $(srcdir)/sgml.stamp            \
123         $(srcdir)/html.stamp
124
125 SCANOBJ_FILES =                         \
126         $(DOC_MODULE).args              \
127         $(DOC_MODULE).hierarchy         \
128         $(DOC_MODULE).interfaces        \
129         $(DOC_MODULE).prerequisites     \
130         .libs/$(DOC_MODULE)-scan.o      \
131         $(DOC_MODULE).signals
132
133 CLEANFILES = $(SCANOBJ_FILES) $(DOC_MODULE)-unused.txt $(DOC_STAMPS)
134
135 if HAVE_GTK_DOC
136 all-local: html-build.stamp
137
138 #### scan ####
139
140 # in the case of non-srcdir builds, the built gst directory gets added
141 # to gtk-doc scanning; but only then, to avoid duplicates
142 scan-build.stamp: $(HFILE_GLOB) $(SCANOBJ_DEPS) $(basefiles)
143         @echo '*** Scanning header files ***'
144         if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null;  \
145         then                                                            \
146             if test x"$(srcdir)" != x. ; then                           \
147                 cp $(srcdir)/$(DOC_MODULE).types . ;                    \
148                 chmod u+w $(DOC_MODULE).types ;                         \
149             fi ;                                                        \
150             CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"                         \
151             CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)"          \
152             $(GTK_DOC_SCANOBJ) --type-init-func="gst_init(NULL,NULL)"   \
153                 --module=$(DOC_MODULE) ;                                \
154         else                                                            \
155             cd $(srcdir) ;                                              \
156             for i in $(SCANOBJ_FILES) ; do                              \
157                test -f $$i || touch $$i ;                               \
158             done                                                        \
159         fi
160         if test "x$(top_srcdir)" != "x$(top_builddir)";                 \
161         then                                                            \
162           export BUILT_OPTIONS="--source-dir=$(top_builddir)/libs/gst"; \
163         fi;                                                             \
164         gtkdoc-scan                                                     \
165                 $(SCAN_OPTIONS) $(EXTRA_HFILES)                         \
166                 --module=$(DOC_MODULE)                                  \
167                 --source-dir=$(DOC_SOURCE_DIR)                          \
168                 $$BUILT_OPTIONS                                         \
169                 --ignore-headers="$(IGNORE_HFILES)"
170         touch scan-build.stamp
171
172 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
173         @true
174
175 #### templates ####
176
177 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
178         @echo '*** Rebuilding template files ***'
179         if test x"$(srcdir)" != x. ; then \
180             cp $(srcdir)/$(DOC_MODULE)-decl.txt . ; \
181             cp $(srcdir)/$(DOC_MODULE)-sections.txt . ; \
182         fi
183         gtkdoc-mktmpl --module=$(DOC_MODULE)
184         touch tmpl-build.stamp
185
186 tmpl.stamp: tmpl-build.stamp
187         @true
188
189 #### sgml ####
190
191 sgml-build.stamp: tmpl.stamp $(CFILE_GLOB)
192         @echo '*** Building XML ***'
193         gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) --output-format=xml $(MKDB_OPTIONS) | tee sgml-build.log
194         @if grep "WARNING:" sgml-build.log > /dev/null; then exit 1; fi
195         rm sgml-build.log
196         touch sgml-build.stamp
197
198 sgml.stamp: sgml-build.stamp
199         @true
200
201 #### html ####
202
203 # FIXME: setting LANG=C is a hack to work with gtk-doc < 1.1, because
204 # that forces a non-utf8 locale.  gtk-doc >= 1.1 solves this by calling
205 # use bytes; in gtkdoc-fixxref
206 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
207         @echo '*** Building HTML ***'
208         if test -d html; then rm -rf html; fi
209         mkdir html
210         @cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
211         cp -pr xml html
212         cp ../version.entities html
213         cd html && gtkdoc-mkhtml $(DOC_MODULE) $(DOC_MAIN_SGML_FILE)
214         rm -f html/$(DOC_MAIN_SGML_FILE)
215         rm -rf html/xml
216         rm -f html/version.entities
217         test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
218             if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
219         @echo '-- Fixing Crossreferences' 
220         LANG=C && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
221         touch html-build.stamp
222 else
223 all-local:
224 endif
225
226 clean-local:
227         rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS)
228         rm -rf xml html
229
230 maintainer-clean-local: clean
231         cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
232
233 # FIXME : thomas added all sgml files and some other things to make
234 # make distcheck work
235 distclean-local: clean
236         rm -rf $(DOC_MODULE)-decl-list.txt
237         rm -rf $(DOC_MODULE)-decl.txt
238         rm -rf $(DOC_MODULE)-undocumented.txt
239         rm -rf $(DOC_MODULE)-unused.txt
240         rm -rf tmpl/*.sgml.bak
241         rm -f $(DOC_MODULE).hierarchy
242         rm -f *.stamp || true
243         if test x"$(srcdir)" != x. ; then \
244             rm -f $(DOC_MODULE)-docs.sgml ; \
245             rm -f $(DOC_MODULE).types ; \
246             rm -f $(DOC_MODULE).interfaces ; \
247             rm -f $(DOC_MODULE).prerequisites ; \
248             rm -f $(DOC_MODULE)-sections.txt ; \
249             rm -rf tmpl/*.sgml ; \
250         fi
251         rm -f *.o
252
253
254 install-data-local:
255         $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) 
256         (installfiles=`echo ./html/*.html`; \
257         if test "$$installfiles" = './html/*.html'; \
258         then echo '-- Nothing to install' ; \
259         else \
260           for i in $$installfiles; do \
261             echo '-- Installing '$$i ; \
262             $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
263           done; \
264           pngfiles=`echo ./html/*.png`; \
265           if test "$$pngfiles" != './html/*.png'; then \
266             for i in $$pngfiles; do \
267               echo '-- Installing '$$i ; \
268               $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
269             done; \
270           fi; \
271           echo '-- Installing $(srcdir)/html/$(DOC_MODULE).devhelp' ; \
272           $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp \
273             $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
274           echo '-- Installing $(srcdir)/html/index.sgml' ; \
275           $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
276         fi) 
277 uninstall-local:
278         (installfiles=`echo ./html/*.html`; \
279         if test "$$installfiles" = './html/*.html'; \
280         then echo '-- Nothing to uninstall' ; \
281         else \
282           for i in $$installfiles; do \
283             rmfile=`basename $$i` ; \
284             echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
285             rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
286           done; \
287           pngfiles=`echo ./html/*.png`; \
288           if test "$$pngfiles" != './html/*.png'; then \
289             for i in $$pngfiles; do \
290               rmfile=`basename $$i` ; \
291               echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
292               rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
293             done; \
294           fi; \
295           echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE).devhelp' ; \
296           rm -f $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
297           echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/index.sgml' ; \
298           rm -f $(DESTDIR)$(TARGET_DIR)/index.sgml; \
299         fi) 
300         if test -d $(DESTDIR)$(TARGET_DIR); then rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(TARGET_DIR); fi
301
302 #
303 # Require gtk-doc when making dist
304 #
305 if HAVE_GTK_DOC
306 dist-check-gtkdoc:
307 else
308 dist-check-gtkdoc:
309         @echo "*** gtk-doc must be installed and enabled in order to make dist"
310         @false
311 endif
312
313 dist-hook: dist-check-gtkdoc dist-hook-local
314         mkdir $(distdir)/tmpl
315         mkdir $(distdir)/xml
316         mkdir $(distdir)/html
317         -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
318         -cp $(srcdir)/sgml/*.xml $(distdir)/xml
319         -cp $(srcdir)/html/index.sgml $(distdir)/html
320         -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
321         -cp $(srcdir)/html/gstreamer-libs.devhelp $(distdir)/html
322
323         images=$(HTML_IMAGES) ;               \
324         for i in "" $$images ; do                     \
325           if test "$$i" != ""; then cp $(srcdir)/$$i $(distdir)/html ; fi; \
326         done
327
328 .PHONY : dist-hook-local