build: make sure gst-plugin-scanner gets installed where we expect it
[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
137 libgstreamer_@GST_MAJORMINOR@_la_LDFLAGS =              \
138         $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) $(LIBM)
139
140 libgstreamer_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst
141
142 gst_headers =                   \
143         gst.h                   \
144         glib-compat.h           \
145         gstobject.h             \
146         gstbin.h                \
147         gstbuffer.h             \
148         gstbufferlist.h         \
149         gstbus.h                \
150         gstcaps.h               \
151         gstchildproxy.h         \
152         gstclock.h              \
153         gstcompat.h             \
154         gstdebugutils.h         \
155         gstelement.h            \
156         gstelementfactory.h     \
157         gsterror.h              \
158         gstevent.h              \
159         gstfilter.h             \
160         gstformat.h             \
161         gstghostpad.h           \
162         gstindex.h              \
163         gstindexfactory.h       \
164         gstinfo.h               \
165         gstinterface.h          \
166         gstiterator.h           \
167         gstmacros.h             \
168         gstmessage.h            \
169         gstminiobject.h         \
170         gstpad.h                \
171         gstpadtemplate.h        \
172         gstparamspecs.h         \
173         gstpipeline.h           \
174         gstplugin.h             \
175         gstpluginfeature.h      \
176         gstpoll.h               \
177         gstpreset.h             \
178         gstquery.h              \
179         gstsegment.h            \
180         gststructure.h          \
181         gstsystemclock.h        \
182         gsttaglist.h            \
183         gsttagsetter.h          \
184         gsttask.h               \
185         gsttaskpool.h           \
186         gsttrace.h              \
187         gsttypefind.h           \
188         gsttypefindfactory.h    \
189         gsturi.h                \
190         gstutils.h              \
191         gstvalue.h              \
192         gstregistry.h           \
193         gstparse.h              \
194         gstxml.h
195
196 libgstreamer_@GST_MAJORMINOR@include_HEADERS = $(gst_headers)
197 nodist_libgstreamer_@GST_MAJORMINOR@include_HEADERS = \
198         $(built_header_configure) $(built_header_make)
199
200 noinst_HEADERS =                \
201         gettext.h               \
202         glib-compat-private.h   \
203         gst-i18n-lib.h          \
204         gst-i18n-app.h          \
205         gstpluginloader.h       \
206         gstquark.h              \
207         gstregistrybinary.h     \
208         gstregistrychunks.h     \
209         gst_private.h
210
211 gstmarshal.h: gstmarshal.list
212         glib-genmarshal --header --prefix=gst_marshal $(srcdir)/gstmarshal.list > gstmarshal.h.tmp
213         mv gstmarshal.h.tmp gstmarshal.h
214
215 gstmarshal.c: gstmarshal.list gst_private.h
216         echo "#include \"gst_private.h\"" > gstmarshal.c.tmp
217         echo "#include \"glib-object.h\"" >> gstmarshal.c.tmp
218         echo "#include \"gstmarshal.h\"" >> gstmarshal.c.tmp
219         glib-genmarshal --body --prefix=gst_marshal $(srcdir)/gstmarshal.list >> gstmarshal.c.tmp
220         mv gstmarshal.c.tmp gstmarshal.c
221
222 gstenumtypes.h: $(gst_headers)
223         glib-mkenums \
224         --fhead "#ifndef __GST_ENUM_TYPES_H__\n#define __GST_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
225         --fprod "\n/* enumerations from \"@filename@\" */\n" \
226         --vhead "GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n"         \
227         --ftail "G_END_DECLS\n\n#endif /* __GST_ENUM_TYPES_H__ */" \
228         $^ > gstenumtypes.h
229
230 gstenumtypes.c: $(gst_headers)
231         glib-mkenums \
232         --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 " \
233         --fprod "\n/* enumerations from \"@filename@\" */" \
234         --vhead "GType\n@enum_name@_get_type (void)\n{\n  static gsize id = 0;\n  static const G@Type@Value values[] = {"     \
235         --vprod "    { C_@TYPE@(@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" }," \
236         --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}" \
237         $^ > gstenumtypes.c
238
239 %.c.gcov: .libs/libgstreamer_@GST_MAJORMINOR@_la-%.gcda %.c
240         $(GCOV) -b -f -o $^ > $@.out
241
242 gcov: $(libgstreamer_@GST_MAJORMINOR@_la_SOURCES:=.gcov)
243
244 if HAVE_INTROSPECTION
245 BUILT_GIRSOURCES = Gst-@GST_MAJORMINOR@.gir
246
247 gir_headers=$(patsubst %,$(srcdir)/%, $(libgstreamer_@GST_MAJORMINOR@include_HEADERS))
248 gir_sources=$(patsubst %,$(srcdir)/%, $(libgstreamer_@GST_MAJORMINOR@_la_SOURCES))
249
250 Gst-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstreamer-@GST_MAJORMINOR@.la
251         $(INTROSPECTION_SCANNER) -v --namespace Gst \
252                 --nsversion=@GST_MAJORMINOR@ \
253                 -I$(top_srcdir) \
254                 -I$(top_builddir) \
255                 -DIN_GOBJECT_INTROSPECTION=1 \
256                 --c-include='gst/gst.h' \
257                 --library=gstreamer-0.10 \
258                 --include=GLib-2.0 \
259                 --include=GObject-2.0 \
260                 --include=GModule-2.0 \
261                 --include=libxml2-2.0 \
262                 --libtool="$(top_builddir)/libtool" \
263                 --pkg glib-2.0 \
264                 --pkg gobject-2.0 \
265                 --pkg gmodule-no-export-2.0 \
266                 --pkg gthread-2.0 \
267                 --pkg libxml-2.0 \
268                 --output $@ \
269                 $(gir_headers) \
270                 $(gir_sources)
271
272 # INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
273 # install anything - we need to install inside our prefix.
274 girdir = $(datadir)/gir-1.0
275 gir_DATA = $(BUILT_GIRSOURCES)
276
277 typelibsdir = $(libdir)/girepository-1.0/
278
279 typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
280
281 %.typelib: %.gir $(INTROSPECTION_COMPILER)
282         $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
283
284 CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
285 endif
286
287 # try to prevent packaging errors
288 check-libexecdir-consistency:
289         if test "${GST_PLUGIN_SCANNER_INSTALLED}" != "${libexecdir}/gstreamer-$(GST_MAJORMINOR)/gst-plugin-scanner"; then \
290           echo "*** Inconsistent libexecdir! Please use ./configure --libexecdir=/foo/bar"; \
291           echo "*** to set the libexecdir and not make libexecdir=/foo/bar or the like."; \
292           echo "*** The same goes for prefix, libdir etc."; \
293           echo "*** ${GST_PLUGIN_SCANNER_INSTALLED} != ${libexecdir}/gstreamer-$(GST_MAJORMINOR)/gst-plugin-scanner"; \
294           exit 1; \
295         fi
296
297 all-local: check-libexecdir-consistency