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