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