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