[sgen] Move the independent parts of SGen to a separate library.
[mono.git] / mono / metadata / Makefile.am
1 if HOST_WIN32
2 win32_sources = \
3         console-win32.c
4
5 platform_sources = $(win32_sources)
6
7 # Use -m here. This will use / as directory separator (C:/WINNT).
8 # The files that use MONO_ASSEMBLIES and/or MONO_CFG_DIR replace the
9 # / by \ if running under WIN32.
10 if CROSS_COMPILING
11 assembliesdir = ${libdir}
12 confdir = ${sysconfdir}
13 else
14 assembliesdir = `cygpath -m "${libdir}"`
15 confdir = `cygpath -m "${sysconfdir}"`
16 endif
17 export HOST_CC
18 # The mingw math.h has "extern inline" functions that dont appear in libs, so
19 # optimisation is required to actually inline them
20 AM_CFLAGS = -O
21 else
22
23 assembliesdir = $(exec_prefix)/lib
24 confdir = $(sysconfdir)
25 unix_sources = \
26         console-unix.c
27
28 platform_sources = $(unix_sources)
29 endif
30
31 if PLATFORM_ANDROID
32 platform_sources += ../../support/libm/complex.c
33 endif
34
35 if SHARED_MONO
36 if SUPPORT_BOEHM
37 bin_PROGRAMS = pedump
38 endif
39 endif
40
41 #
42 # libtool is not capable of creating static/shared versions of the same
43 # convenience lib, so we have to do it ourselves
44 #
45 if SUPPORT_SGEN
46 if DISABLE_EXECUTABLES
47 shared_sgen_libraries = libmonoruntimesgen.la 
48 else
49 if SHARED_MONO
50 shared_sgen_libraries = libmonoruntimesgen.la 
51 endif
52 endif
53 sgen_libraries = $(shared_sgen_libraries) libmonoruntimesgen-static.la 
54 endif
55
56 if SUPPORT_BOEHM
57 if DISABLE_EXECUTABLES
58 shared_boehm_libraries = libmonoruntime.la
59 else
60 if SHARED_MONO
61 shared_boehm_libraries = libmonoruntime.la
62 endif
63 endif
64 boehm_libraries = $(shared_boehm_libraries) libmonoruntime-static.la
65 endif
66
67 if DISABLE_EXECUTABLES
68 noinst_LTLIBRARIES = libmonoruntime-config.la $(shared_sgen_libraries) $(shared_boehm_libraries)
69 else
70 noinst_LTLIBRARIES = libmonoruntime-config.la $(boehm_libraries) $(sgen_libraries)
71 endif
72
73 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS)
74
75 #
76 # Make sure any prefix changes are updated in the binaries too.
77 #
78 # This won't result in many more false positives than AC_DEFINEing them
79 # in configure.ac.
80 #
81 mono-config-dirs.lo: Makefile
82
83 #
84 # This library is used to localize the usage of MONO_BINDIR etc. to just one source file, thus enabling
85 # ccache to work even if the value of these defines change. We need to use a convenience library since automake
86 # doesn't support per file cflags.
87 #
88 libmonoruntime_config_la_SOURCES = \
89         mono-config-dirs.h              \
90         mono-config-dirs.c
91 libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\" -DMONO_ASSEMBLIES=\"$(assembliesdir)\" -DMONO_CFG_DIR=\"$(confdir)\"
92
93 CLEANFILES = mono-bundle.stamp
94
95 null_sources = \
96         console-null.c
97
98 null_gc_sources = \
99         null-gc.c
100
101 common_sources = \
102         $(platform_sources)     \
103         assembly.c              \
104         attach.h                \
105         attach.c                \
106         char-conversions.h      \
107         cil-coff.h              \
108         class.c                 \
109         class-internals.h       \
110         cominterop.c            \
111         cominterop.h            \
112         console-io.h            \
113         coree.c                 \
114         coree.h                 \
115         culture-info.h          \
116         culture-info-tables.h   \
117         debug-helpers.c         \
118         debug-mono-symfile.h    \
119         debug-mono-symfile.c    \
120         decimal-ms.c            \
121         decimal-ms.h            \
122         domain-internals.h      \
123         environment.c           \
124         environment.h           \
125         exception.c             \
126         exception.h             \
127         file-io.c               \
128         file-io.h               \
129         filewatcher.c           \
130         filewatcher.h           \
131         gc-internal.h           \
132         icall.c                 \
133         icall-def.h             \
134         image.c                 \
135         jit-info.c              \
136         loader.c                \
137         locales.c               \
138         locales.h               \
139         lock-tracer.c           \
140         lock-tracer.h           \
141         marshal.c               \
142         marshal.h               \
143         mempool.c               \
144         mempool.h               \
145         mempool-internals.h     \
146         metadata.c              \
147         metadata-verify.c       \
148         metadata-internals.h    \
149         method-builder.h        \
150         method-builder.c        \
151         mono-basic-block.c      \
152         mono-basic-block.h      \
153         mono-config.c           \
154         mono-cq.c               \
155         mono-cq.h               \
156         mono-debug.h            \
157         mono-debug.c            \
158         mono-debug-debugger.h   \
159         mono-endian.c           \
160         mono-endian.h           \
161         mono-hash.h             \
162         mono-mlist.c            \
163         mono-mlist.h            \
164         mono-perfcounters.c     \
165         mono-perfcounters.h     \
166         mono-perfcounters-def.h \
167         mono-ptr-array.h        \
168         mono-route.c            \
169         mono-route.h            \
170         mono-wsq.c              \
171         mono-wsq.h              \
172         monitor.h               \
173         nacl-stub.c             \
174         normalization-tables.h  \
175         number-formatter.h      \
176         object-internals.h      \
177         opcodes.c               \
178         socket-io.c             \
179         socket-io.h             \
180         process.c               \
181         process.h               \
182         profiler.c              \
183         profiler-private.h      \
184         rand.h                  \
185         rand.c                  \
186         remoting.h              \
187         remoting.c              \
188         runtime.c               \
189         mono-security.c         \
190         security.h              \
191         security-core-clr.c     \
192         security-core-clr.h     \
193         security-manager.c      \
194         security-manager.h      \
195         string-icalls.c         \
196         string-icalls.h         \
197         sysmath.h               \
198         sysmath.c               \
199         tabledefs.h             \
200         threads.c               \
201         threads-types.h         \
202         threadpool.c            \
203         threadpool.h            \
204         threadpool-internals.h  \
205         threadpool-ms.c \
206         threadpool-ms.h \
207         threadpool-ms-io.c      \
208         threadpool-ms-io.h      \
209         tpool-poll.c    \
210         verify.c                \
211         verify-internals.h      \
212         wrapper-types.h \
213         reflection-internals.h  \
214         file-mmap-posix.c       \
215         file-mmap-windows.c     \
216         file-mmap.h     \
217         object-offsets.h        \
218         abi-details.h   \
219         metadata-cross-helpers.c        \
220         seq-points-data.h       \
221         seq-points-data.c
222
223
224 # These source files have compile time dependencies on GC code
225 gc_dependent_sources = \
226         appdomain.c     \
227         domain.c        \
228         gc-stats.c      \
229         gc.c            \
230         monitor.c       \
231         mono-hash.c     \
232         object.c        \
233         reflection.c
234
235 boehm_sources = \
236         boehm-gc.c
237
238 sgen_sources = \
239         sgen-os-posix.c         \
240         sgen-os-mach.c          \
241         sgen-os-win32.c         \
242         sgen-bridge.c           \
243         sgen-bridge.h           \
244         sgen-bridge-internal.h  \
245         sgen-old-bridge.c               \
246         sgen-new-bridge.c               \
247         sgen-tarjan-bridge.c            \
248         sgen-toggleref.c                \
249         sgen-toggleref.h                \
250         sgen-stw.c                              \
251         sgen-mono.c             \
252         sgen-client-mono.h
253
254 libmonoruntime_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(null_gc_sources) $(boehm_sources)
255 libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES)
256 libmonoruntime_la_LIBADD = libmonoruntime-config.la
257
258 libmonoruntimesgen_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(sgen_sources)
259 libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES)
260 libmonoruntimesgen_la_LIBADD = libmonoruntime-config.la
261
262 libmonoruntime_static_la_SOURCES = $(libmonoruntime_la_SOURCES)
263 libmonoruntime_static_la_LDFLAGS = -static
264 libmonoruntime_static_la_CFLAGS = $(BOEHM_DEFINES)
265 libmonoruntime_static_la_LIBADD = $(bundle_obj) $(libmonoruntime_la_LIBADD)
266
267 libmonoruntimesgen_static_la_SOURCES = $(libmonoruntimesgen_la_SOURCES)
268 libmonoruntimesgen_static_la_LDFLAGS = -static
269 libmonoruntimesgen_static_la_CFLAGS = $(SGEN_DEFINES)
270 libmonoruntimesgen_static_la_LIBADD = $(libmonoruntimesgen_la_LIBADD)
271
272 libmonoruntimeincludedir = $(includedir)/mono-$(API_VER)/mono/metadata
273
274 libmonoruntimeinclude_HEADERS = \
275         assembly.h              \
276         attrdefs.h              \
277         appdomain.h             \
278         blob.h                  \
279         class.h                 \
280         debug-helpers.h         \
281         debug-mono-symfile.h    \
282         threads.h               \
283         environment.h           \
284         exception.h             \
285         image.h                 \
286         loader.h                \
287         metadata.h              \
288         mono-config.h           \
289         mono-debug.h            \
290         mono-gc.h               \
291         sgen-bridge.h           \
292         object.h                \
293         opcodes.h               \
294         profiler.h              \
295         reflection.h            \
296         row-indexes.h           \
297         tokentype.h             \
298         verify.h                
299
300 if DTRACE_G_REQUIRED
301
302 PEDUMP_DTRACE_OBJECT = pedump-dtrace.$(OBJEXT)
303
304 pedump-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d libmonoruntime.la ../io-layer/libwapi.la ../utils/libmonoutils.la
305         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
306         --pic pedump-dtrace.$(OBJEXT) $(top_srcdir)/data/mono.d libmonoruntime.la ../io-layer/libwapi.la ../utils/libmonoutils.la
307
308 else
309 PEDUMP_DTRACE_OBJECT = 
310 endif
311
312 if SHARED_MONO
313 if SUPPORT_BOEHM
314 pedump_SOURCES =                \
315         pedump.c
316
317 pedump_LDADD = libmonoruntime.la ../io-layer/libwapi.la ../utils/libmonoutils.la \
318         $(LIBGC_LIBS) $(GLIB_LIBS) -lm $(LIBICONV) $(PEDUMP_DTRACE_OBJECT)
319
320 if PLATFORM_DARWIN
321 pedump_LDFLAGS=-framework CoreFoundation -framework Foundation
322 endif
323 endif
324 endif
325
326 EXTRA_DIST = $(win32_sources) $(unix_sources) $(null_sources) runtime.h \
327                 tpool-poll.c tpool-epoll.c tpool-kqueue.c \
328                 threadpool-ms-io-poll.c threadpool-ms-io-epoll.c threadpool-ms-io-kqueue.c