gobject: remove -DG_DISABLE_CONST_RETURNS
[platform/upstream/glib.git] / gobject / Makefile.am
1 # GObject - GLib Type, Object, Parameter and Signal Library
2 # Copyright (C) 1997,98,99,2000 Tim Janik and Red Hat, Inc.
3 #
4 ## Process this file with automake to produce Makefile.in
5 include $(top_srcdir)/Makefile.decl
6
7 SUBDIRS = . tests
8
9 CLEANFILES=
10
11 if HAVE_THREADS
12 THREAD_FLAGS=-DG_THREADS_MANDATORY
13 endif
14
15 AM_CPPFLAGS =                                   \
16         -DG_LOG_DOMAIN=\"GLib-GObject\"         \
17         $(gthread_INCLUDES)                     \
18         $(GLIB_DEBUG_FLAGS)                     \
19         $(THREAD_FLAGS)                         \
20         -DG_DISABLE_DEPRECATED                  \
21         -DGOBJECT_COMPILATION
22
23 gobject.def: gobject.symbols
24         $(AM_V_GEN) (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gobject.symbols | $(SED) -e '/^$$/d' -e 's/^/      /' -e 's/G_GNUC_[^ ]*//g' | sort) > gobject.def
25
26 if OS_LINUX
27 if HAVE_GNUC_VISIBILITY
28 TESTS = abicheck.sh
29 endif
30 endif
31
32 libglib = $(top_builddir)/glib/libglib-2.0.la $(top_builddir)/gthread/libgthread-2.0.la
33
34 # libraries to compile and install
35 lib_LTLIBRARIES = libgobject-2.0.la
36
37 if OS_WIN32_AND_DLL_COMPILATION
38 if MS_LIB_AVAILABLE
39 noinst_DATA = gobject-2.0.lib
40
41 install_ms_lib_cmd = $(INSTALL) gobject-2.0.lib $(DESTDIR)$(libdir)
42 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gobject-2.0.lib
43 endif
44 endif
45
46 install-ms-lib:
47         $(install_ms_lib_cmd)
48
49 uninstall-ms-lib:
50         $(uninstall_ms_lib_cmd)
51
52 if PLATFORM_WIN32
53 no_undefined = -no-undefined
54 endif
55
56 if OS_WIN32_AND_DLL_COMPILATION
57 export_symbols = -export-symbols gobject.def
58 gobject_def = gobject.def
59
60 gobject_win32_res = gobject-win32-res.o
61 gobject_win32_res_ldflag = -Wl,$(gobject_win32_res)
62
63 install-def-file:
64         $(INSTALL) gobject.def $(DESTDIR)$(libdir)/gobject-2.0.def
65
66 uninstall-def-file:
67         -rm $(DESTDIR)$(libdir)/gobject-2.0.def
68 else
69 install-def-file:
70 uninstall-def-file:
71
72 export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
73 endif
74
75 # libtool stuff: set version and export symbols for resolving
76 libgobjectincludedir = $(includedir)/glib-2.0/gobject
77 libgobject_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
78   $(gobject_win32_res_ldflag) \
79   -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
80   -export-dynamic $(no_undefined) $(export_symbols)
81
82 libgobject_2_0_la_CFLAGS = $(LIBFFI_CFLAGS)
83
84 libgobject_2_0_la_LIBADD = $(libglib) $(LIBFFI_LIBS)
85
86 libgobject_2_0_la_DEPENDENCIES = $(gobject_win32_res) $(gobject_def)
87
88 #
89 # setup source file variables
90 #
91 # GObject library header files for public installation
92 gobject_public_h_sources = \
93         glib-types.h            \
94         gbinding.h              \
95         gboxed.h                \
96         gclosure.h              \
97         genums.h                \
98         gobject.h               \
99         gparam.h                \
100         gparamspecs.h           \
101         gsignal.h               \
102         gsourceclosure.h        \
103         gtype.h                 \
104         gtypemodule.h           \
105         gtypeplugin.h           \
106         gvalue.h                \
107         gvaluearray.h           \
108         gvaluecollector.h       \
109         gvaluetypes.h           \
110         gobjectnotifyqueue.c    \
111         gmarshal.h
112
113 # GObject library header files that don't get installed
114 gobject_private_h_sources =     \
115         gatomicarray.h          \
116         gtype-private.h
117
118 # GObject library C sources to build the library from
119 gobject_c_sources = \
120         gobject_probes.d        \
121         gatomicarray.c          \
122         gbinding.c              \
123         gboxed.c                \
124         gclosure.c              \
125         genums.c                \
126         gobject.c               \
127         gobject_trace.h         \
128         gparam.c                \
129         gparamspecs.c           \
130         gsignal.c               \
131         gsourceclosure.c        \
132         gtype.c                 \
133         gtypemodule.c           \
134         gtypeplugin.c           \
135         gvalue.c                \
136         gvaluearray.c           \
137         gvaluetransform.c       \
138         gvaluetypes.c
139
140 # these sources (also mentioned above) are generated.
141 BUILT_SOURCES = gmarshal.h gmarshal.c
142
143 if ENABLE_DTRACE
144 gobject_probes.h: gobject_probes.d Makefile
145         $(AM_V_GEN) $(DTRACE) -C -h -s $< -o $@.tmp
146         @$(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $@.tmp > $@ && rm -f $@.tmp
147 gobject_probes.o: gobject_probes.d Makefile
148         $(AM_V_GEN) $(DTRACE) -G -s $< -o $@
149 BUILT_SOURCES += gobject_probes.h gobject_probes.o
150 CLEANFILES += gobject_probes.h
151 libgobject_2_0_la_LIBADD += gobject_probes.o
152 endif
153
154 if ENABLE_SYSTEMTAP
155 tapset_in_files = gobject.stp.in
156 tapsetdir   = @ABS_TAPSET_DIR@
157 tapset_DATA = $(tapset_in_files:.stp.in=.stp)
158 EXTRA_DIST += $(tapset_in_files)
159 endif
160
161 # non-header sources (headers should be specified in the above variables)
162 # that don't serve as direct make target sources, i.e. they don't have
163 # their own .lo rules and don't get publically installed
164 gobject_extra_sources = \
165         gmarshal.list           \
166         gmarshal.strings        \
167         gobject.symbols
168
169
170 #
171 # setup GObject library sources and their dependancies
172 #
173 gobject_target_headers = $(gobject_public_h_sources)
174 gobject_target_sources = $(gobject_c_sources)
175 EXTRA_HEADERS =
176 EXTRA_DIST += \
177         $(gobject_private_h_sources)    \
178         $(gobject_extra_sources)        \
179         marshal-genstrings.pl
180
181 # This is read by gobject-introspection/misc/ and gtk-doc
182 gobject-public-headers.txt: Makefile
183         echo $(gobject_public_h_sources) > $@.tmp && mv $@.tmp $@
184
185 CLEANFILES += gobject-public-headers.txt
186
187 all-local: gobject-public-headers.txt
188
189 #
190 # rules to generate built sources
191 #
192 # setup autogeneration dependancies
193 gen_sources = xgen-gmh xgen-gmc xgen-gms
194 CLEANFILES += $(gen_sources)
195
196 # normal autogeneration rules
197 # all autogenerated files need to be generated in the srcdir,
198 # so old versions get remade and are not confused with newer
199 # versions in the build dir. thus a development setup requires
200 # srcdir to be writable, passing --disable-rebuilds to
201 # ../configure will supress all autogeneration rules.
202
203 if CROSS_COMPILING
204   glib_genmarshal=$(GLIB_GENMARSHAL)
205 else
206   glib_genmarshal=./glib-genmarshal
207 endif
208
209 gmarshal.h: stamp-gmarshal.h
210         @true
211 stamp-gmarshal.h: @REBUILD@ gmarshal.list glib-genmarshal$(EXEEXT)
212         $(MAKE) glib-genmarshal$(EXEEXT)
213         $(AM_V_GEN) echo "#ifndef __G_MARSHAL_H__" > xgen-gmh \
214         && echo "#define __G_MARSHAL_H__" >> xgen-gmh \
215         && $(glib_genmarshal) --nostdinc --prefix=g_cclosure_marshal $(srcdir)/gmarshal.list --header >> xgen-gmh \
216         && echo "#endif /* __G_MARSHAL_H__ */" >> xgen-gmh \
217         && (cmp -s xgen-gmh gmarshal.h 2>/dev/null || cp xgen-gmh gmarshal.h) \
218         && rm -f xgen-gmh xgen-gmh~ \
219         && echo timestamp > $@
220
221 gmarshal.c: @REBUILD@ stamp-gmarshal.h
222         $(AM_V_GEN) $(glib_genmarshal) --nostdinc --prefix=g_cclosure_marshal $(srcdir)/gmarshal.list --body >> xgen-gmc \
223         && cp xgen-gmc gmarshal.c \
224         && rm -f xgen-gmc xgen-gmc~
225
226 gmarshal.strings: @REBUILD@ $(srcdir)/gmarshal.list
227         $(AM_V_GEN) grep '^[A-Z]' $(srcdir)/gmarshal.list \
228         | $(SED) -e 's/^/"g_cclosure_marshal_/' -e 's/:/__/' -e 's/,/_/g' -e 's/$$/",/' > xgen-gms \
229         && cp xgen-gms gmarshal.strings \
230         && rm -f xgen-gms xgen-gms~
231
232 glib-genmarshal.o: gmarshal.strings
233 gsignal.lo: gmarshal.c
234
235 # target platform:
236 libgobjectinclude_HEADERS = $(gobject_target_headers)
237 libgobject_2_0_la_SOURCES = $(gobject_target_sources)
238
239 #
240 # programs to compile and install
241 #
242 bin_PROGRAMS = gobject-query glib-genmarshal
243 bin_SCRIPTS = glib-mkenums
244 noinst_PROGRAMS = testgobject
245 # source files
246 gobject_query_SOURCES = gobject-query.c
247 glib_genmarshal_SOURCES = glib-genmarshal.c
248 testgobject_SOURCES = testgobject.c
249 # link programs against libgobject
250 progs_LDADD = ./libgobject-2.0.la $(libglib)
251 glib_genmarshal_LDADD = $(libglib)
252 gobject_query_LDADD = $(progs_LDADD)
253 testgobject_LDADD = $(progs_LDADD)
254
255 #
256 # auxillary files
257 #
258 EXTRA_DIST +=                   \
259         makefile.msc.in         \
260         gobject.rc.in           \
261         libgobject-gdb.py.in    \
262         glib-mkenums.in         \
263         abicheck.sh
264
265 BUILT_EXTRA_DIST = \
266         makefile.msc            \
267         gobject.rc              \
268         gmarshal.h              \
269         gmarshal.c              \
270         stamp-gmarshal.h
271
272 gobject-win32-res.o: gobject.rc
273         $(AM_V_GEN) $(WINDRES) gobject.rc $@
274
275 gobject-2.0.lib: libgobject-2.0.la gobject.def
276         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgobject-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:gobject.def -out:$@
277
278 dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/gobject.vcproj ../build/win32/vs10/gobject.vcxproj ../build/win32/vs10/gobject.vcxproj.filters
279         files='$(BUILT_EXTRA_DIST)'; \
280         for f in $$files; do \
281           if test -f $$f; then d=.; else d=$(srcdir); fi; \
282           cp $$d/$$f $(distdir) || exit 1; done
283
284 ../build/win32/vs9/gobject.vcproj: $(top_srcdir)/build/win32/vs9/gobject.vcprojin
285         for F in $(libgobject_2_0_la_SOURCES); do \
286                 case $$F in \
287                 *.c) echo '   <File RelativePath="..\..\..\gobject\'$$F'" />' \
288                      ;; \
289                 esac; \
290         done >libgobject.sourcefiles
291         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/gobject.vcprojin >$@
292         rm libgobject.sourcefiles
293
294 ../build/win32/vs10/gobject.vcxproj: $(top_srcdir)/build/win32/vs10/gobject.vcxprojin
295         for F in $(libgobject_2_0_la_SOURCES); do \
296                 case $$F in \
297                 *.c) echo '    <ClCompile Include="..\..\..\gobject\'$$F'" />' \
298                      ;; \
299                 esac; \
300         done >libgobject.vs10.sourcefiles
301         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/gobject.vcxprojin >$@
302         rm libgobject.vs10.sourcefiles
303
304 ../build/win32/vs10/gobject.vcxproj.filters: $(top_srcdir)/build/win32/vs10/gobject.vcxproj.filtersin
305         for F in $(libgobject_2_0_la_SOURCES); do \
306                 case $$F in \
307                 *.c) echo '    <ClCompile Include="..\..\..\gobject\'$$F'"><Filter>Source Files</Filter></ClCompile>' \
308                      ;; \
309                 esac; \
310         done >libgobject.vs10.sourcefiles.filters
311         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/gobject.vcxproj.filtersin >$@
312         rm libgobject.vs10.sourcefiles.filters
313
314 install-data-local: install-ms-lib install-def-file
315
316 uninstall-local: uninstall-ms-lib uninstall-def-file uninstall-gdb
317
318 distclean-local:
319         if test $(srcdir) = .; then :; else \
320             rm -f $(BUILT_EXTRA_DIST); \
321             rm -f libgobject-gdb.py; \
322         fi
323
324 # install gdb scripts
325 gdbdir = $(datadir)/glib-2.0/gdb
326 dist_gdb_SCRIPTS = gobject.py
327
328 libgobject-gdb.py: libgobject-gdb.py.in
329         $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libgobject-gdb.py.in > libgobject-gdb.py
330
331 uninstall-gdb:
332         -rm -r $(DESTDIR)$(datadir)/gdb
333
334 install-data-hook: libgobject-gdb.py
335         mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load/$(ABS_GLIB_RUNTIME_LIBDIR)
336         $(INSTALL) libgobject-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load/$(ABS_GLIB_RUNTIME_LIBDIR)/libgobject-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py
337 if HAVE_GLIB_RUNTIME_LIBDIR
338         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
339         mv $(DESTDIR)$(libdir)/libgobject-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
340         mv $(DESTDIR)$(libdir)/libgobject-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
341         rm -f $(DESTDIR)$(libdir)/libgobject-2.0.so
342         ln -s $(GLIB_RUNTIME_LIBDIR)/libgobject-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libgobject-2.0.so
343 endif