summaryrefslogtreecommitdiff
path: root/gobject/Makefile.am
blob: 6bcd5ae01ec350ba1ba151199594af5cb5e7602d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# GObject - GLib Type, Object, Parameter and Signal Library
# Copyright (C) 1997,98,99,2000 Tim Janik and Red Hat, Inc.
#
## Process this file with automake to produce Makefile.in
include $(top_srcdir)/Makefile.decl

SUBDIRS = . tests

CLEANFILES=

if HAVE_THREADS
THREAD_FLAGS=-DG_THREADS_MANDATORY
endif

AM_CPPFLAGS = 					\
	-DG_LOG_DOMAIN=\"GLib-GObject\"		\
	-I$(top_srcdir)				\
	-I$(top_srcdir)/glib			\
	-I$(top_builddir)			\
	$(GLIB_DEBUG_FLAGS)			\
	$(THREAD_FLAGS)				\
	-DG_DISABLE_DEPRECATED			\
	-DGOBJECT_COMPILATION			\
	-DG_DISABLE_CONST_RETURNS

gobject.def: gobject.symbols
	(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

gobjectalias.h: gobject.symbols
	$(PERL) $(srcdir)/makegobjectalias.pl < $(srcdir)/gobject.symbols > gobjectalias.h

gobjectaliasdef.c: gobject.symbols
	$(PERL) $(srcdir)/makegobjectalias.pl -def < $(srcdir)/gobject.symbols > gobjectaliasdef.c

if OS_LINUX
if HAVE_GNUC_VISIBILITY
TESTS = abicheck.sh pltcheck.sh
endif
endif

libglib = $(top_builddir)/glib/libglib-2.0.la $(top_builddir)/gthread/libgthread-2.0.la

# libraries to compile and install
lib_LTLIBRARIES = libgobject-2.0.la

if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE
noinst_DATA = gobject-2.0.lib

install_ms_lib_cmd = $(INSTALL) gobject-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gobject-2.0.lib
endif
endif

install-ms-lib:
	$(install_ms_lib_cmd)

uninstall-ms-lib:
	$(uninstall_ms_lib_cmd)

if PLATFORM_WIN32
no_undefined = -no-undefined
endif

if OS_WIN32_AND_DLL_COMPILATION
export_symbols = -export-symbols gobject.def
gobject_def = gobject.def

gobject_win32_res = gobject-win32-res.o
gobject_win32_res_ldflag = -Wl,$(gobject_win32_res)

install-def-file:
	$(INSTALL) gobject.def $(DESTDIR)$(libdir)/gobject-2.0.def

uninstall-def-file:
	-rm $(DESTDIR)$(libdir)/gobject-2.0.def
else
install-def-file:
uninstall-def-file:

export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
endif

# libtool stuff: set version and export symbols for resolving
libgobjectincludedir = $(includedir)/glib-2.0/gobject
libgobject_2_0_la_LDFLAGS = \
  $(gobject_win32_res_ldflag) \
  -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
  -export-dynamic $(no_undefined) $(export_symbols)

libgobject_2_0_la_LIBADD = $(libglib)

libgobject_2_0_la_DEPENDENCIES = $(gobject_win32_res) $(gobject_def)

#
# setup source file variables
#
# GObject library header files for public installation
gobject_public_h_sources = \
	gboxed.h		\
	gclosure.h		\
	genums.h		\
	gobject.h		\
	gparam.h		\
	gparamspecs.h		\
	gsignal.h		\
	gsourceclosure.h	\
	gtype.h			\
	gtypemodule.h		\
	gtypeplugin.h		\
	gvalue.h		\
	gvaluearray.h		\
	gvaluecollector.h	\
	gvaluetypes.h		\
	gobjectnotifyqueue.c	\
	gmarshal.h

# GObject library header files that don't get installed
gobject_private_h_sources =     \
	gatomicarray.h		\
	gtype-private.h

# GObject library C sources to build the library from
gobject_c_sources = \
	gobject_probes.d	\
	gatomicarray.c		\
	gboxed.c		\
	gclosure.c		\
	genums.c		\
	gobject.c		\
	gobject_trace.h		\
	gparam.c		\
	gparamspecs.c		\
	gsignal.c		\
	gsourceclosure.c	\
	gtype.c			\
	gtypemodule.c		\
	gtypeplugin.c		\
	gvalue.c		\
	gvaluearray.c		\
	gvaluetransform.c	\
	gvaluetypes.c

# these sources (also mentioned above) are generated.
BUILT_SOURCES = gmarshal.h gmarshal.c gobjectalias.h gobjectaliasdef.c

if ENABLE_DTRACE
gobject_probes.h: gobject_probes.d Makefile
	$(DTRACE) -C -h -s $< -o $@.tmp
	sed -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $@.tmp > $@ && rm -f $@.tmp
gobject_probes.o: gobject_probes.d Makefile
	$(DTRACE) -G -s $< -o $@
BUILT_SOURCES += gobject_probes.h gobject_probes.o
CLEANFILES += gobject_probes.h
libgobject_2_0_la_LIBADD += gobject_probes.o
endif

if ENABLE_SYSTEMTAP
tapset_in_files = gobject.stp.in
tapsetdir   = $(DESTDIR)@ABS_TAPSET_DIR@
tapset_DATA = $(tapset_in_files:.stp.in=.stp)
EXTRA_DIST += $(tapset_in_files)
endif

# non-header sources (headers should be specified in the above variables)
# that don't serve as direct make target sources, i.e. they don't have
# their own .lo rules and don't get publically installed
gobject_extra_sources = \
	gmarshal.list		\
	gmarshal.strings	\
	gobject.symbols


#
# setup GObject library sources and their dependancies
#
gobject_target_headers = $(gobject_public_h_sources)
gobject_target_sources = $(gobject_c_sources)
EXTRA_HEADERS =
EXTRA_DIST += \
	$(gobject_private_h_sources) 	\
	$(gobject_extra_sources) 	\
	makegobjectalias.pl		\
	marshal-genstrings.pl

#
# rules to generate built sources
#
# setup autogeneration dependancies
gen_sources = xgen-gmh xgen-gmc xgen-gms
CLEANFILES = $(gen_sources)

# normal autogeneration rules
# all autogenerated files need to be generated in the srcdir,
# so old versions get remade and are not confused with newer
# versions in the build dir. thus a development setup requires
# srcdir to be writable, passing --disable-rebuilds to
# ../configure will supress all autogeneration rules.

if CROSS_COMPILING
  glib_genmarshal=$(GLIB_GENMARSHAL)
else
  glib_genmarshal=./glib-genmarshal
endif

gmarshal.h: stamp-gmarshal.h
	@true
stamp-gmarshal.h: @REBUILD@ gmarshal.list glib-genmarshal$(EXEEXT)
	$(MAKE) glib-genmarshal$(EXEEXT)
	echo "#ifndef __G_MARSHAL_H__" > xgen-gmh \
	&& echo "#define __G_MARSHAL_H__" >> xgen-gmh \
	&& $(glib_genmarshal) --nostdinc --prefix=g_cclosure_marshal $(srcdir)/gmarshal.list --header >> xgen-gmh \
	&& echo "#endif /* __G_MARSHAL_H__ */" >> xgen-gmh \
	&& (cmp -s xgen-gmh gmarshal.h 2>/dev/null || cp xgen-gmh gmarshal.h) \
	&& rm -f xgen-gmh xgen-gmh~ \
	&& echo timestamp > $@

gmarshal.c: @REBUILD@ stamp-gmarshal.h
	$(glib_genmarshal) --nostdinc --prefix=g_cclosure_marshal $(srcdir)/gmarshal.list --body >> xgen-gmc \
	&& cp xgen-gmc gmarshal.c \
	&& rm -f xgen-gmc xgen-gmc~

gmarshal.strings: @REBUILD@ $(srcdir)/gmarshal.list
	grep '^[A-Z]' $(srcdir)/gmarshal.list \
	| sed -e 's/^/"g_cclosure_marshal_/' -e 's/:/__/' -e 's/,/_/g' -e 's/$$/",/' > xgen-gms \
	&& cp xgen-gms gmarshal.strings \
	&& rm -f xgen-gms xgen-gms~

glib-genmarshal.o: gmarshal.strings
gsignal.lo: gmarshal.c


# target platform:
libgobjectinclude_HEADERS = $(gobject_target_headers)
libgobject_2_0_la_SOURCES = $(gobject_target_sources)

#
# programs to compile and install
#
bin_PROGRAMS = gobject-query glib-genmarshal
bin_SCRIPTS = glib-mkenums
noinst_PROGRAMS = testgobject
# source files
gobject_query_SOURCES = gobject-query.c
glib_genmarshal_SOURCES = glib-genmarshal.c
testgobject_SOURCES = testgobject.c
# link programs against libgobject
progs_LDADD = ./libgobject-2.0.la $(libglib)
glib_genmarshal_LDADD = $(libglib)
gobject_query_LDADD = $(progs_LDADD)
testgobject_LDADD = $(progs_LDADD)

#
# auxillary files
#
EXTRA_DIST += 			\
	makefile.msc.in 	\
	gobject.rc.in		\
	libgobject-gdb.py.in	\
	glib-mkenums.in		\
	abicheck.sh		\
	pltcheck.sh

BUILT_EXTRA_DIST = \
	makefile.msc		\
	gobject.rc		\
	gmarshal.h		\
	gmarshal.c		\
	stamp-gmarshal.h	\
	gobjectalias.h		\
	gobjectaliasdef.c

gobject-win32-res.o: gobject.rc
	$(WINDRES) gobject.rc $@

gobject-2.0.lib: libgobject-2.0.la gobject.def
	lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgobject-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:gobject.def -out:$@

dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/gobject.vcproj
	files='$(BUILT_EXTRA_DIST)'; \
	for f in $$files; do \
	  if test -f $$f; then d=.; else d=$(srcdir); fi; \
	  cp $$d/$$f $(distdir) || exit 1; done

../build/win32/vs9/gobject.vcproj: $(top_srcdir)/build/win32/vs9/gobject.vcprojin
	for F in $(libgobject_2_0_la_SOURCES); do \
		case $$F in \
		*.c) echo '   <File RelativePath="..\..\..\gobject\'$$F'" />' \
		     ;; \
		esac; \
	done >libgobject.sourcefiles
	$(CPP) -P - <$(top_srcdir)/build/win32/vs9/gobject.vcprojin >$@

install-data-local: install-ms-lib install-def-file

uninstall-local: uninstall-ms-lib uninstall-def-file uninstall-gdb

distclean-local:
	if test $(srcdir) = .; then :; else \
	    rm -f $(BUILT_EXTRA_DIST); \
	    rm -f libgobject-gdb.py; \
	fi

# install gdb scripts
gdbdir = $(datadir)/glib-2.0/gdb
dist_gdb_SCRIPTS = gobject.py

libgobject-gdb.py: libgobject-gdb.py.in
	sed -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libgobject-gdb.py.in > libgobject-gdb.py

uninstall-gdb:
	-rm -r $(DESTDIR)$(datadir)/gdb

install-data-hook: libgobject-gdb.py
	mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load/$(ABS_GLIB_RUNTIME_LIBDIR)
	$(INSTALL) libgobject-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load/$(ABS_GLIB_RUNTIME_LIBDIR)/libgobject-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py
if HAVE_GLIB_RUNTIME_LIBDIR
	mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
	mv $(DESTDIR)$(libdir)/libgobject-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
	mv $(DESTDIR)$(libdir)/libgobject-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
	rm -f $(DESTDIR)$(libdir)/libgobject-2.0.so
	ln -s $(GLIB_RUNTIME_LIBDIR)/libgobject-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libgobject-2.0.so
endif