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