bc2eb3f6556288eded9d35f6cf9f4f5e8e492b44
[platform/upstream/gstreamer.git] / docs / gst / 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-@GST_MAJORMINOR@
5 DOC_MODULE=gstreamer
6
7 # for upload.mak
8 DOC=gstreamer
9 FORMATS=html
10 html: html-build.stamp
11 sinclude $(srcdir)/../upload.mak
12
13 # generated basefiles
14 #basefiles = \
15 #               gstreamer-@GST_MAJORMINOR@.types \
16 #               gstreamer-@GST_MAJORMINOR@-sections.txt \
17 #               gstreamer-@GST_MAJORMINOR@-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-unused.sgml \
24 #               $$BUILDDIR/tmpl/gstreamer-@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-@GST_MAJORMINOR@%: gstreamer%
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
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 --output-format=xml --ignore-files=trio
51
52 # Extra options to supply to gtkdoc-fixref.
53 FIXXREF_OPTIONS=
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
66 # Header files to ignore when scanning.
67 IGNORE_HFILES=
68
69 # Images to copy into HTML directory.
70 HTML_IMAGES =
71
72 # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
73 content_files =
74
75 # Other files to distribute.
76 extra_files =
77
78 # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
79 # contains GtkObjects/GObjects and you want to document signals and properties.
80 GTKDOC_CFLAGS = $(GST_CFLAGS) -I$(top_builddir)
81 GTKDOC_LIBS = $(GST_LIBS) $(SCANOBJ_DEPS)
82
83 GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
84 GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
85
86 # If you need to override some of the declarations, place them in this file
87 # and uncomment this line.
88 #DOC_OVERRIDES = $(DOC_MODULE)-overrides.txt
89
90
91
92 ###########################################################################
93 # Everything below here is generic and you shouldn't need to change it.
94 ###########################################################################
95 # thomas: except of course that we did
96
97 # thomas: copied from glib-2
98 # We set GPATH here; this gives us semantics for GNU make
99 # which are more like other make's VPATH, when it comes to
100 # whether a source that is a target of one rule is then
101 # searched for in VPATH/GPATH.
102 #
103 GPATH = $(srcdir)
104
105 # thomas: make docs parallel installable
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=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
117            $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
118
119 SCANOBJ_FILES =                 \
120         $(DOC_MODULE).args      \
121         $(DOC_MODULE).hierarchy \
122         $(DOC_MODULE)-scan.o    \
123         $(DOC_MODULE).signals
124
125 if HAVE_GTK_DOC
126 all-local: html-build.stamp
127
128 #### scan ####
129
130
131 # wingo addition
132 scan-build.stamp: $(HFILE_GLOB) $(SCANOBJ_DEPS) $(basefiles)
133         @echo '*** Scanning header files ***'
134         if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
135             if test x"$(srcdir)" != x. ; then \
136                 cp $(srcdir)/$(DOC_MODULE).types . ; \
137             fi ; \
138             CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" $(GTK_DOC_SCANOBJ) --type-init-func="gst_init(NULL,NULL)" --module=$(DOC_MODULE) ; \
139         else \
140             cd $(srcdir) ; \
141             for i in $(SCANOBJ_FILES) ; do \
142                test -f $$i || touch $$i ; \
143             done \
144         fi
145         gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
146         touch scan-build.stamp
147
148 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
149         @true
150
151 #### templates ####
152
153 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
154         @echo '*** Rebuilding template files ***'
155         if test x"$(srcdir)" != x. ; then \
156             cp $(srcdir)/$(DOC_MODULE)-decl.txt . ; \
157             cp $(srcdir)/$(DOC_MODULE)-sections.txt . ; \
158         fi
159         gtkdoc-mktmpl --module=$(DOC_MODULE)
160         touch tmpl-build.stamp
161
162 tmpl.stamp: tmpl-build.stamp
163         @true
164
165 #### sgml ####
166
167 sgml-build.stamp: tmpl.stamp $(CFILE_GLOB)
168         @echo '*** Building SGML ***'
169         gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS)
170         touch sgml-build.stamp
171
172 sgml.stamp: sgml-build.stamp
173         @true
174
175 #### html ####
176
177 # FIXME: setting LANG=C is a hack to work with gtk-doc < 1.1, because
178 # that forces a non-utf8 locale.  gtk-doc >= 1.1 solves this by calling
179 # use bytes; in gtkdoc-fixxref
180 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
181         @echo '*** Building HTML ***'
182         test -d html || mkdir html
183         cd html && gtkdoc-mkhtml $(DOC_MODULE) $(srcdir)/../$(DOC_MAIN_SGML_FILE)
184         test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
185             if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
186         @echo '-- Fixing Crossreferences' 
187         LANG=C && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
188         touch html-build.stamp
189 endif
190
191 clean-local:
192         rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS)
193         rm -rf xml html
194
195 maintainer-clean-local: clean
196         cd $(srcdir) && rm -rf sgml 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 -rf $(DOC_MODULE)-decl-list.txt
203         rm -rf $(DOC_MODULE)-decl.txt
204         rm -rf $(DOC_MODULE)-undocumented.txt
205         rm -rf $(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).prerequisites ; \
214             rm -f $(DOC_MODULE)-sections.txt ; \
215             rm -rf tmpl/*.sgml ; \
216         fi
217         rm -rf *.o
218
219 # thomas: make docs parallel installable; devhelp requires majorminor too
220 if DOC_HTML
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         fi) 
244 uninstall-local:
245         (installfiles=`echo ./html/*.html`; \
246         if test "$$installfiles" = './html/*.html'; \
247         then echo '-- Nothing to uninstall' ; \
248         else \
249           for i in $$installfiles; do \
250             rmfile=`basename $$i` ; \
251             echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
252             rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
253           done; \
254           pngfiles=`echo ./html/*.png`; \
255           if test "$$pngfiles" != './html/*.png'; then \
256             for i in $$pngfiles; do \
257               rmfile=`basename $$i` ; \
258               echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
259               rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
260             done; \
261           fi; \
262           echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE).devhelp' ; \
263           rm -f $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
264           echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/index.sgml' ; \
265           rm -f $(DESTDIR)$(TARGET_DIR)/index.sgml; \
266         fi) 
267         if test -d $(DESTDIR)$(TARGET_DIR); then rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(TARGET_DIR); fi
268 else
269 install-data-local:
270 uninstall-local:
271 endif
272
273 #
274 # Require gtk-doc when making dist
275 #
276 if HAVE_GTK_DOC
277 dist-check-gtkdoc:
278 else
279 dist-check-gtkdoc:
280         @echo "*** gtk-doc must be installed and enabled in order to make dist"
281         @false
282 endif
283
284 dist-hook: dist-check-gtkdoc dist-hook-local
285         mkdir $(distdir)/tmpl
286         mkdir $(distdir)/xml
287         mkdir $(distdir)/html
288         -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
289         -cp $(srcdir)/sgml/*.xml $(distdir)/xml
290         -cp $(srcdir)/html/index.sgml $(distdir)/html
291         -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
292
293         images=$(HTML_IMAGES) ;               \
294         for i in "" $$images ; do                     \
295           if test "$$i" != ""; then cp $(srcdir)/$$i $(distdir)/html ; fi; \
296         done
297
298 .PHONY : dist-hook-local