build: $(LIBM) belongs into LIBADD not LDFLAGS
[platform/upstream/gstreamer.git] / gst / Makefile.am
1 lib_LTLIBRARIES = libgstreamer-@GST_MAJORMINOR@.la
2
3 if GST_DISABLE_LOADSAVE
4 GST_LOADSAVE_SRC =
5 else
6 GST_LOADSAVE_SRC = gstxml.c
7 endif
8
9 if GST_DISABLE_REGISTRY
10 GST_REGISTRY_SRC =
11 else
12 GST_REGISTRY_SRC = gstregistrybinary.c
13 endif
14
15 if GST_DISABLE_PARSE
16 SUBDIRS_PARSE =
17 GST_PARSE_LA =
18 else
19 SUBDIRS_PARSE = parse
20 GST_PARSE_LA = parse/libgstparse.la
21 endif
22
23 if GST_DISABLE_TRACE
24 GST_TRACE_SRC =
25 else
26 GST_TRACE_SRC = gsttrace.c
27 endif
28
29 if GST_DISABLE_PLUGIN
30 GST_PLUGIN_SRC =
31 else
32 GST_PLUGIN_SRC = gstplugin.c
33 endif
34
35 SUBDIRS = $(SUBDIRS_PARSE)
36
37 DIST_SUBDIRS = parse
38
39 # make variables for all generated source and header files to make the
40 # distinction clear
41
42 built_header_configure = gstconfig.h gstversion.h
43 built_header_make = gstenumtypes.h gstmarshal.h
44 built_source_make = gstenumtypes.c gstmarshal.c
45
46 EXTRA_libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
47         gstmarshal.list gsttrace.c gstxml.c \
48         gstregistrybinary.c
49
50
51 # temporarily not used
52 #       glib-compat.c
53
54 libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
55         gst.c                   \
56         gstobject.c             \
57         gstbin.c                \
58         gstbuffer.c             \
59         gstbufferlist.c         \
60         gstbus.c                \
61         gstcaps.c               \
62         gstchildproxy.c         \
63         gstclock.c              \
64         gstdebugutils.c         \
65         gstelement.c            \
66         gstelementfactory.c     \
67         gsterror.c              \
68         gstevent.c              \
69         gstfilter.c             \
70         gstformat.c             \
71         gstghostpad.c           \
72         gstindex.c              \
73         gstindexfactory.c       \
74         gstinfo.c               \
75         gstinterface.c          \
76         gstiterator.c           \
77         gstmessage.c            \
78         gstminiobject.c         \
79         gstpad.c                \
80         gstpadtemplate.c        \
81         gstparamspecs.c         \
82         gstpipeline.c           \
83         gstplugin.c             \
84         gstpluginfeature.c      \
85         gstpluginloader.c       \
86         gstpoll.c               \
87         gstpreset.c             \
88         gstquark.c              \
89         gstquery.c              \
90         gstregistry.c           \
91         gstregistrychunks.c     \
92         gstsegment.c            \
93         gststructure.c          \
94         gstsystemclock.c        \
95         gsttaglist.c            \
96         gsttagsetter.c          \
97         gsttask.c               \
98         gsttaskpool.c           \
99         $(GST_TRACE_SRC)        \
100         gsttypefind.c           \
101         gsttypefindfactory.c    \
102         gsturi.c                \
103         gstutils.c              \
104         gstvalue.c              \
105         gstparse.c              \
106         $(GST_REGISTRY_SRC)     \
107         $(GST_LOADSAVE_SRC)
108
109 # do not put files in the distribution that are generated
110 nodist_libgstreamer_@GST_MAJORMINOR@_la_SOURCES = $(built_source_make)
111
112 # BUILT_SOURCES are built on make all/check/install before all other targets
113 BUILT_SOURCES = \
114         $(built_header_configure)       \
115         $(built_header_make)            \
116         $(built_source_make)
117 # CLEANFILES is for files generated by make
118 CLEANFILES = $(built_header_make) $(built_source_make) $(as_dll_cleanfiles) *.gcno *.gcda *.gcov *.gcov.out
119 # DISTCLEANFILES is for files generated by configure
120 DISTCLEANFILES = $(built_header_configure)
121
122 libgstreamer_@GST_MAJORMINOR@_la_CFLAGS =               \
123         -D_GNU_SOURCE                                   \
124         -DGST_EXPORTS                                   \
125         -DG_LOG_DOMAIN=g_log_domain_gstreamer           \
126         -DGST_MAJORMINOR=\""$(GST_MAJORMINOR)"\"        \
127         -DGST_DISABLE_DEPRECATED                        \
128         $(VALGRIND_CFLAGS)                              \
129         $(GST_ALL_CFLAGS)
130
131 libgstreamer_@GST_MAJORMINOR@_la_LIBADD =               \
132         $(GST_PARSE_LA)                                 \
133         $(GST_ALL_LIBS)                                 \
134         $(WIN32_LIBS)                                   \
135         $(XML_LIBS)                                     \
136         $(LIBM)
137
138 libgstreamer_@GST_MAJORMINOR@_la_LDFLAGS =              \
139         $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
140
141 libgstreamer_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst
142
143 gst_headers =                   \
144         gst.h                   \
145         glib-compat.h           \
146         gstobject.h             \
147         gstbin.h                \
148         gstbuffer.h             \
149         gstbufferlist.h         \
150         gstbus.h                \
151         gstcaps.h               \
152         gstchildproxy.h         \
153         gstclock.h              \
154         gstcompat.h             \
155         gstdebugutils.h         \
156         gstelement.h            \
157         gstelementfactory.h     \
158         gsterror.h              \
159         gstevent.h              \
160         gstfilter.h             \
161         gstformat.h             \
162         gstghostpad.h           \
163         gstindex.h              \
164         gstindexfactory.h       \
165         gstinfo.h               \
166         gstinterface.h          \
167         gstiterator.h           \
168         gstmacros.h             \
169         gstmessage.h            \
170         gstminiobject.h         \
171         gstpad.h                \
172         gstpadtemplate.h        \
173         gstparamspecs.h         \
174         gstpipeline.h           \
175         gstplugin.h             \
176         gstpluginfeature.h      \
177         gstpoll.h               \
178         gstpreset.h             \
179         gstquery.h              \
180         gstsegment.h            \
181         gststructure.h          \
182         gstsystemclock.h        \
183         gsttaglist.h            \
184         gsttagsetter.h          \
185         gsttask.h               \
186         gsttaskpool.h           \
187         gsttrace.h              \
188         gsttypefind.h           \
189         gsttypefindfactory.h    \
190         gsturi.h                \
191         gstutils.h              \
192         gstvalue.h              \
193         gstregistry.h           \
194         gstparse.h              \
195         gstxml.h
196
197 libgstreamer_@GST_MAJORMINOR@include_HEADERS = $(gst_headers)
198 nodist_libgstreamer_@GST_MAJORMINOR@include_HEADERS = \
199         $(built_header_configure) $(built_header_make)
200
201 noinst_HEADERS =                \
202         gettext.h               \
203         glib-compat-private.h   \
204         gst-i18n-lib.h          \
205         gst-i18n-app.h          \
206         gstelementdetails.h     \
207         gstpluginloader.h       \
208         gstquark.h              \
209         gstregistrybinary.h     \
210         gstregistrychunks.h     \
211         gst_private.h
212
213 gstmarshal.h: gstmarshal.list
214         $(AM_V_GEN)glib-genmarshal --header --prefix=gst_marshal $(srcdir)/gstmarshal.list > gstmarshal.h.tmp && \
215         mv gstmarshal.h.tmp gstmarshal.h
216
217 gstmarshal.c: gstmarshal.list gst_private.h
218         $(AM_V_GEN)echo "#include \"gst_private.h\"" > gstmarshal.c.tmp && \
219         echo "#include \"glib-object.h\"" >> gstmarshal.c.tmp && \
220         echo "#include \"gstmarshal.h\"" >> gstmarshal.c.tmp && \
221         glib-genmarshal --body --prefix=gst_marshal $(srcdir)/gstmarshal.list >> gstmarshal.c.tmp && \
222         mv gstmarshal.c.tmp gstmarshal.c
223
224 gstenumtypes.h: $(gst_headers)
225         $(AM_V_GEN)glib-mkenums \
226         --fhead "#ifndef __GST_ENUM_TYPES_H__\n#define __GST_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
227         --fprod "\n/* enumerations from \"@filename@\" */\n" \
228         --vhead "GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n"         \
229         --ftail "G_END_DECLS\n\n#endif /* __GST_ENUM_TYPES_H__ */" \
230         $^ > gstenumtypes.h
231
232 gstenumtypes.c: $(gst_headers)
233         $(AM_V_GEN)glib-mkenums \
234         --fhead "#include \"gst_private.h\"\n#include <gst/gst.h>\n#define C_ENUM(v) ((gint) v)\n#define C_FLAGS(v) ((guint) v)\n " \
235         --fprod "\n/* enumerations from \"@filename@\" */" \
236         --vhead "GType\n@enum_name@_get_type (void)\n{\n  static gsize id = 0;\n  static const G@Type@Value values[] = {"     \
237         --vprod "    { C_@TYPE@(@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" }," \
238         --vtail "    { 0, NULL, NULL }\n  };\n\n  if (g_once_init_enter (&id)) {\n    GType tmp = g_@type@_register_static (\"@EnumName@\", values);\n    g_once_init_leave (&id, tmp);\n  }\n\n  return (GType) id;\n}" \
239         $^ > gstenumtypes.c
240
241 %.c.gcov: .libs/libgstreamer_@GST_MAJORMINOR@_la-%.gcda %.c
242         $(GCOV) -b -f -o $^ > $@.out
243
244 gcov: $(libgstreamer_@GST_MAJORMINOR@_la_SOURCES:=.gcov)
245
246 if HAVE_INTROSPECTION
247 BUILT_GIRSOURCES = Gst-@GST_MAJORMINOR@.gir
248
249 gir_headers=$(patsubst %,$(srcdir)/%, $(libgstreamer_@GST_MAJORMINOR@include_HEADERS))
250 gir_sources=$(patsubst %,$(srcdir)/%, $(libgstreamer_@GST_MAJORMINOR@_la_SOURCES))
251
252 Gst-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstreamer-@GST_MAJORMINOR@.la
253         $(AM_V_GEN)$(INTROSPECTION_SCANNER) -v --namespace Gst \
254                 --nsversion=@GST_MAJORMINOR@ \
255                 -I$(top_srcdir) \
256                 -I$(top_builddir) \
257                 -DIN_GOBJECT_INTROSPECTION=1 \
258                 --c-include='gst/gst.h' \
259                 --library=libgstreamer-0.10.la \
260                 --include=GLib-2.0 \
261                 --include=GObject-2.0 \
262                 --include=GModule-2.0 \
263                 --include=libxml2-2.0 \
264                 --libtool="$(top_builddir)/libtool" \
265                 --pkg glib-2.0 \
266                 --pkg gobject-2.0 \
267                 --pkg gmodule-no-export-2.0 \
268                 --pkg gthread-2.0 \
269                 --pkg libxml-2.0 \
270                 --output $@ \
271                 $(gir_headers) \
272                 $(gir_sources)
273
274 # INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
275 # install anything - we need to install inside our prefix.
276 girdir = $(datadir)/gir-1.0
277 gir_DATA = $(BUILT_GIRSOURCES)
278
279 typelibsdir = $(libdir)/girepository-1.0/
280
281 typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
282
283 %.typelib: %.gir $(INTROSPECTION_COMPILER)
284         $(AM_V_GEN)$(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
285
286 CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
287 endif
288
289 # try to prevent packaging errors
290 check-libexecdir-consistency:
291         @if test "${GST_PLUGIN_SCANNER_INSTALLED}" != "${libexecdir}/gstreamer-$(GST_MAJORMINOR)/gst-plugin-scanner"; then \
292           echo "*** Inconsistent libexecdir! Please use ./configure --libexecdir=/foo/bar"; \
293           echo "*** to set the libexecdir and not make libexecdir=/foo/bar or the like."; \
294           echo "*** The same goes for prefix, libdir etc."; \
295           echo "*** ${GST_PLUGIN_SCANNER_INSTALLED} != ${libexecdir}/gstreamer-$(GST_MAJORMINOR)/gst-plugin-scanner"; \
296           exit 1; \
297         fi
298
299 all-local: check-libexecdir-consistency