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