Define a HAVE_GNUC_VISIBILITY automake conditional.
[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
6 INCLUDES = \
7         -DG_LOG_DOMAIN=\"GLib-GObject\"         \
8         -I$(top_srcdir)                         \
9         -I$(top_srcdir)/glib                    \
10         -I$(top_builddir)                       \
11         $(GLIB_DEBUG_FLAGS)                     \
12         -DG_DISABLE_DEPRECATED                  \
13         -DGOBJECT_COMPILATION                   \
14         -DG_DISABLE_CONST_RETURNS
15
16 gobject.def: gobject.symbols
17         (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 - <$(srcdir)/gobject.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g' | sort) > gobject.def
18
19 gobjectalias.h: gobject.symbols
20         $(PERL) $(srcdir)/makegobjectalias.pl < $(srcdir)/gobject.symbols > gobjectalias.h
21
22 if OS_LINUX
23 if HAVE_GNUC_VISIBILITY
24 TESTS = abicheck.sh
25 endif
26 endif
27
28 libglib = $(top_builddir)/glib/libglib-2.0.la
29
30 # libraries to compile and install
31 lib_LTLIBRARIES = libgobject-2.0.la
32
33 if MS_LIB_AVAILABLE
34 noinst_DATA = gobject-2.0.lib
35
36 install-ms-lib:
37         $(INSTALL) gobject-2.0.lib $(DESTDIR)$(libdir)
38
39 uninstall-ms-lib:
40         -rm $(DESTDIR)$(libdir)/gobject-2.0.lib
41 else
42 install-ms-lib:
43 uninstall-ms-lib:
44 endif
45
46 if PLATFORM_WIN32
47 no_undefined = -no-undefined
48 endif
49
50 if OS_WIN32
51 export_symbols = -export-symbols gobject.def
52
53 install-libtool-import-lib:
54 #       Don't put the bug compatibility entries in the import lib!
55 #       (Unfortunately the GNU linker doesn't yet understand the PRIVATE
56 #       directive in .def files.)
57 #
58         for entry in `grep PRIVATE gobject.def | sed -e 's/PRIVATE//'`; do \
59           file=`$(NM) -A .libs/libgobject-2.0.dll.a | grep $$entry | head -n 1 | cut -d: -f2`; \
60           ar d .libs/libgobject-2.0.dll.a $$file; \
61         done
62         $(RANLIB) .libs/libgobject-2.0.dll.a
63         $(INSTALL) .libs/libgobject-2.0.dll.a $(DESTDIR)$(libdir)
64         $(INSTALL) gobject.def $(DESTDIR)$(libdir)/gobject-2.0.def
65
66 uninstall-libtool-import-lib:
67         -rm $(DESTDIR)$(libdir)/libgobject-2.0.dll.a $(DESTDIR)$(libdir)/gobject-2.0.def
68 else
69 install-libtool-import-lib:
70 uninstall-libtool-import-lib:
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 = \
78   -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)  \
79   -export-dynamic $(no_undefined) $(export_symbols)
80
81 libgobject_2_0_la_LIBADD = $(G_OBJECT_WIN32_RESOURCE) $(libglib)
82
83 libgobject_2_0_la_DEPENDENCIES = $(G_OBJECT_WIN32_RESOURCE) $(GOBJECT_DEF)
84
85 #
86 # setup source file variables
87 #
88 # GObject library header files for public installation
89 gobject_public_h_sources = \
90         gboxed.h                \
91         gclosure.h              \
92         genums.h                \
93         gobject.h               \
94         gparam.h                \
95         gparamspecs.h           \
96         gsignal.h               \
97         gsourceclosure.h        \
98         gtype.h                 \
99         gtypemodule.h           \
100         gtypeplugin.h           \
101         gvalue.h                \
102         gvaluearray.h           \
103         gvaluecollector.h       \
104         gvaluetypes.h           \
105         gobjectnotifyqueue.c    \
106         gmarshal.h
107
108 # GObject library header files that don't get installed
109 gobject_private_h_sources = 
110 # GObject library C sources to build the library from
111 gobject_c_sources = \
112         gboxed.c                \
113         gclosure.c              \
114         genums.c                \
115         gobject.c               \
116         gparam.c                \
117         gparamspecs.c           \
118         gsignal.c               \
119         gsourceclosure.c        \
120         gtype.c                 \
121         gtypemodule.c           \
122         gtypeplugin.c           \
123         gvalue.c                \
124         gvaluearray.c           \
125         gvaluetransform.c       \
126         gvaluetypes.c
127
128 # these sources (also mentioned above) are generated.
129 BUILT_SOURCES = gmarshal.h gmarshal.c gobjectalias.h
130
131 # non-header sources (headers should be specified in the above variables)
132 # that don't serve as direct make target sources, i.e. they don't have
133 # their own .lo rules and don't get publically installed
134 gobject_extra_sources = \
135         gmarshal.list           \
136         gmarshal.strings        \
137         gobject.symbols
138
139
140 #
141 # setup GObject library sources and their dependancies
142 #
143 gobject_target_headers = $(gobject_public_h_sources)
144 gobject_target_sources = $(gobject_c_sources)
145 EXTRA_HEADERS =
146 EXTRA_DIST = \
147         $(gobject_private_h_sources)    \
148         $(gobject_extra_sources)        \
149         makegobjectalias.pl
150
151 #
152 # rules to generate built sources
153 #
154 # setup autogeneration dependancies
155 gen_sources = xgen-gmh xgen-gmc xgen-gms
156 CLEANFILES = $(gen_sources)
157
158 # normal autogeneration rules
159 # all autogenerated files need to be generated in the srcdir,
160 # so old versions get remade and are not confused with newer
161 # versions in the build dir. thus a development setup requires
162 # srcdir to be writable, passing --disable-rebuilds to
163 # ../configure will supress all autogeneration rules.
164
165 if CROSS_COMPILING
166   glib_genmarshal=$(GLIB_GENMARSHAL)
167 else
168   glib_genmarshal=./glib-genmarshal
169 endif
170
171 gmarshal.h: stamp-gmarshal.h
172         @true
173 stamp-gmarshal.h: @REBUILD@ gmarshal.list glib-genmarshal$(EXEEXT)
174         $(MAKE) glib-genmarshal$(EXEEXT)
175         echo "#ifndef __G_MARSHAL_H__" > xgen-gmh \
176         && echo "#define __G_MARSHAL_H__" >> xgen-gmh \
177         && $(glib_genmarshal) --nostdinc --prefix=g_cclosure_marshal $(srcdir)/gmarshal.list --header >> xgen-gmh \
178         && echo "#endif /* __G_MARSHAL_H__ */" >> xgen-gmh \
179         && (cmp -s xgen-gmh gmarshal.h 2>/dev/null || cp xgen-gmh gmarshal.h) \
180         && rm -f xgen-gmh xgen-gmh~ \
181         && echo timestamp > $@
182
183 gmarshal.c: @REBUILD@ stamp-gmarshal.h
184         $(glib_genmarshal) --nostdinc --prefix=g_cclosure_marshal $(srcdir)/gmarshal.list --body >> xgen-gmc \
185         && cp xgen-gmc gmarshal.c \
186         && rm -f xgen-gmc xgen-gmc~
187
188 gmarshal.strings: @REBUILD@ $(srcdir)/gmarshal.list
189         grep '^[A-Z]' $(srcdir)/gmarshal.list \
190         | sed -e 's/^/"g_cclosure_marshal_/' -e 's/:/__/' -e 's/,/_/g' -e 's/$$/",/' > xgen-gms \
191         && cp xgen-gms gmarshal.strings \
192         && rm -f xgen-gms xgen-gms~
193
194 glib-genmarshal.o: gmarshal.strings
195 gsignal.lo: gmarshal.c
196
197
198 # target platform:
199 libgobjectinclude_HEADERS = $(gobject_target_headers)
200 libgobject_2_0_la_SOURCES = $(gobject_target_sources)
201
202 #
203 # programs to compile and install
204 #
205 bin_PROGRAMS = gobject-query glib-genmarshal
206 bin_SCRIPTS = glib-mkenums
207 noinst_PROGRAMS = testgobject
208 # source files
209 gobject_query_SOURCES = gobject-query.c
210 glib_genmarshal_SOURCES = glib-genmarshal.c
211 testgobject_SOURCES = testgobject.c
212 # link programs against libgobject
213 progs_LDADD = ./libgobject-2.0.la $(libglib)
214 glib_genmarshal_LDADD = $(libglib)
215 gobject_query_LDADD = $(progs_LDADD)
216 testgobject_LDADD = $(progs_LDADD)
217
218 #
219 # auxillary files
220 #
221 EXTRA_DIST +=                   \
222         makefile.msc.in         \
223         gobject.def             \
224         gobject.rc.in           \
225         glib-genmarshal.1       \
226         glib-mkenums.in         \
227         glib-mkenums.1          \
228         abicheck.sh
229
230 BUILT_EXTRA_DIST = \
231         makefile.msc            \
232         gobject.rc              \
233         gmarshal.h              \
234         gmarshal.c              \
235         stamp-gmarshal.h        \
236         gobjectalias.h
237
238
239 if OS_WIN32
240 $(G_OBJECT_WIN32_RESOURCE): gobject.rc
241         $(top_srcdir)/build/win32/lt-compile-resource gobject.rc $@
242 endif
243
244 gobject-2.0.lib: libgobject-2.0.la gobject.def
245         lib -name:libgobject-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:gobject.def -out:$@
246
247 dist-hook: $(BUILT_EXTRA_DIST)
248         files='$(BUILT_EXTRA_DIST)'; \
249         for f in $$files; do \
250           if test -f $$f; then d=.; else d=$(srcdir); fi; \
251           cp $$d/$$f $(distdir) || exit 1; done
252
253 install-data-local: install-ms-lib install-libtool-import-lib
254
255 uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
256
257 distclean-local:
258         if test $(srcdir) = .; then :; else \
259             rm -f $(BUILT_EXTRA_DIST); \
260         fi