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