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