Use g_once_init_*() instead of GOnce for the enum types
[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 if USE_BINARY_REGISTRY
13 GST_REGISTRY_SRC = gstregistrybinary.c
14 else
15 GST_REGISTRY_SRC = gstregistryxml.c
16 endif
17 endif
18
19 if GST_DISABLE_PARSE
20 SUBDIRS_PARSE =
21 GST_PARSE_LA =
22 else
23 SUBDIRS_PARSE = parse
24 GST_PARSE_LA = parse/libgstparse.la
25 endif
26
27 if GST_DISABLE_TRACE
28 GST_TRACE_SRC =
29 else
30 GST_TRACE_SRC = gsttrace.c
31 endif
32
33 if GST_DISABLE_PLUGIN
34 GST_PLUGIN_SRC =
35 else
36 GST_PLUGIN_SRC = gstplugin.c
37 endif
38
39 SUBDIRS = $(SUBDIRS_PARSE)
40
41 DIST_SUBDIRS = parse
42
43 # make variables for all generated source and header files to make the
44 # distinction clear
45
46 built_header_configure = gstconfig.h gstversion.h
47 built_header_make = gstenumtypes.h gstmarshal.h
48 built_source_make = gstenumtypes.c gstmarshal.c
49
50 EXTRA_libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
51         gstmarshal.list gsttrace.c gstxml.c \
52         gstregistryxml.c gstregistrybinary.c
53
54
55 # temporarily not used
56 #       glib-compat.c
57
58 libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
59         gst.c                   \
60         gstobject.c             \
61         gstbin.c                \
62         gstbuffer.c             \
63         gstbus.c                \
64         gstcaps.c               \
65         gstchildproxy.c         \
66         gstclock.c              \
67         gstdebugutils.c         \
68         gstelement.c            \
69         gstelementfactory.c     \
70         gsterror.c              \
71         gstevent.c              \
72         gstfilter.c             \
73         gstformat.c             \
74         gstghostpad.c           \
75         gstindex.c              \
76         gstindexfactory.c       \
77         gstinfo.c               \
78         gstinterface.c          \
79         gstiterator.c           \
80         gstmessage.c            \
81         gstminiobject.c         \
82         gstpad.c                \
83         gstpadtemplate.c        \
84         gstparamspecs.c         \
85         gstpipeline.c           \
86         gstplugin.c             \
87         gstpluginfeature.c      \
88         gstpoll.c               \
89         gstpreset.c             \
90         gstquark.c              \
91         gstquery.c              \
92         gstregistry.c           \
93         gstsegment.c            \
94         gststructure.c          \
95         gstsystemclock.c        \
96         gsttaglist.c            \
97         gsttagsetter.c          \
98         gsttask.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         gstbus.h                \
149         gstcaps.h               \
150         gstchildproxy.h         \
151         gstclock.h              \
152         gstcompat.h             \
153         gstdebugutils.h         \
154         gstelement.h            \
155         gstelementfactory.h     \
156         gsterror.h              \
157         gstevent.h              \
158         gstfilter.h             \
159         gstformat.h             \
160         gstghostpad.h           \
161         gstindex.h              \
162         gstindexfactory.h       \
163         gstinfo.h               \
164         gstinterface.h          \
165         gstiterator.h           \
166         gstmacros.h             \
167         gstmessage.h            \
168         gstminiobject.h         \
169         gstpad.h                \
170         gstpadtemplate.h        \
171         gstparamspecs.h         \
172         gstpipeline.h           \
173         gstplugin.h             \
174         gstpluginfeature.h      \
175         gstpoll.h               \
176         gstpreset.h             \
177         gstquery.h              \
178         gstsegment.h            \
179         gststructure.h          \
180         gstsystemclock.h        \
181         gsttaglist.h            \
182         gsttagsetter.h          \
183         gsttask.h               \
184         gsttrace.h              \
185         gsttypefind.h           \
186         gsttypefindfactory.h    \
187         gsturi.h                \
188         gstutils.h              \
189         gstvalue.h              \
190         gstregistry.h           \
191         gstparse.h              \
192         gstxml.h
193
194 libgstreamer_@GST_MAJORMINOR@include_HEADERS = $(gst_headers)
195 nodist_libgstreamer_@GST_MAJORMINOR@include_HEADERS = \
196         $(built_header_configure) $(built_header_make)
197
198 noinst_HEADERS =                \
199         gettext.h               \
200         glib-compat-private.h   \
201         gst-i18n-lib.h          \
202         gst-i18n-app.h          \
203         gstquark.h              \
204         gstregistrybinary.h     \
205         gst_private.h
206
207 gstmarshal.h: gstmarshal.list
208         glib-genmarshal --header --prefix=gst_marshal $(srcdir)/gstmarshal.list > gstmarshal.h.tmp
209         mv gstmarshal.h.tmp gstmarshal.h
210
211 gstmarshal.c: gstmarshal.list gst_private.h
212         echo "#include \"gst_private.h\"" > gstmarshal.c.tmp
213         echo "#include \"glib-object.h\"" >> gstmarshal.c.tmp
214         echo "#include \"gstmarshal.h\"" >> gstmarshal.c.tmp
215         glib-genmarshal --body --prefix=gst_marshal $(srcdir)/gstmarshal.list >> gstmarshal.c.tmp
216         mv gstmarshal.c.tmp gstmarshal.c
217
218 gstenumtypes.h: $(gst_headers)
219         glib-mkenums \
220         --fhead "#ifndef __GST_ENUM_TYPES_H__\n#define __GST_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
221         --fprod "\n/* enumerations from \"@filename@\" */\n" \
222         --vhead "GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n"         \
223         --ftail "G_END_DECLS\n\n#endif /* __GST_ENUM_TYPES_H__ */" \
224         $^ > gstenumtypes.h
225
226 gstenumtypes.c: $(gst_headers)
227         glib-mkenums \
228         --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 " \
229         --fprod "\n/* enumerations from \"@filename@\" */" \
230         --vhead "GType\n@enum_name@_get_type (void)\n{\n  static gsize id = 0;\n  static const G@Type@Value values[] = {"     \
231         --vprod "    { C_@TYPE@(@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" }," \
232         --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}" \
233         $^ > gstenumtypes.c
234
235 %.c.gcov: .libs/libgstreamer_@GST_MAJORMINOR@_la-%.gcda %.c
236         $(GCOV) -b -f -o $^ > $@.out
237
238 gcov: $(libgstreamer_@GST_MAJORMINOR@_la_SOURCES:=.gcov)