Merge pull request #1323 from StephenMcConnel/bug-23591
[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 SHARED_MONO
32 if SUPPORT_BOEHM
33 bin_PROGRAMS = pedump
34 endif
35 endif
36
37 #
38 # libtool is not capable of creating static/shared versions of the same
39 # convenience lib, so we have to do it ourselves
40 #
41 if SUPPORT_SGEN
42 if DISABLE_EXECUTABLES
43 shared_sgen_libraries = libmonoruntimesgen.la 
44 else
45 if SHARED_MONO
46 shared_sgen_libraries = libmonoruntimesgen.la 
47 endif
48 endif
49 sgen_libraries = $(shared_sgen_libraries) libmonoruntimesgen-static.la 
50 endif
51
52 if SUPPORT_BOEHM
53 if DISABLE_EXECUTABLES
54 shared_boehm_libraries = libmonoruntime.la
55 else
56 if SHARED_MONO
57 shared_boehm_libraries = libmonoruntime.la
58 endif
59 endif
60 boehm_libraries = $(shared_boehm_libraries) libmonoruntime-static.la
61 endif
62
63 if DISABLE_EXECUTABLES
64 noinst_LTLIBRARIES = $(shared_sgen_libraries) $(shared_boehm_libraries)
65 else
66 noinst_LTLIBRARIES = $(boehm_libraries) $(sgen_libraries)
67 endif
68
69 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) -DMONO_BINDIR=\"$(bindir)/\" -DMONO_ASSEMBLIES=\"$(assembliesdir)\" -DMONO_CFG_DIR=\"$(confdir)\"
70
71 #
72 # Make sure any prefix changes are updated in the binaries too.
73 #
74 #  assembly.c uses MONO_ASSEMBLIES
75 #  mono-config.c uses MONO_CFG_DIR
76 #
77 # This won't result in many more false positives than AC_DEFINEing them
78 # in configure.ac.
79 #
80 assembly.lo mono-config.lo: Makefile
81
82 CLEANFILES = mono-bundle.stamp
83
84 libmonoruntime_static_la_LIBADD = $(bundle_obj) $(libmonoruntime_la_LIBADD)
85
86 null_sources = \
87         console-null.c
88
89 null_gc_sources = \
90         null-gc.c
91
92 common_sources = \
93         $(platform_sources)     \
94         assembly.c              \
95         attach.h                \
96         attach.c                \
97         char-conversions.h      \
98         cil-coff.h              \
99         class.c                 \
100         class-internals.h       \
101         cominterop.c            \
102         cominterop.h            \
103         console-io.h            \
104         coree.c                 \
105         coree.h                 \
106         culture-info.h          \
107         culture-info-tables.h   \
108         debug-helpers.c         \
109         debug-mono-symfile.h    \
110         debug-mono-symfile.c    \
111         decimal.c               \
112         decimal.h               \
113         domain-internals.h      \
114         environment.c           \
115         environment.h           \
116         exception.c             \
117         exception.h             \
118         file-io.c               \
119         file-io.h               \
120         filewatcher.c           \
121         filewatcher.h           \
122         gc-internal.h           \
123         gc-memfuncs.c           \
124         icall.c                 \
125         icall-def.h             \
126         image.c                 \
127         jit-info.c              \
128         loader.c                \
129         locales.c               \
130         locales.h               \
131         lock-tracer.c           \
132         lock-tracer.h           \
133         marshal.c               \
134         marshal.h               \
135         mempool.c               \
136         mempool.h               \
137         mempool-internals.h     \
138         metadata.c              \
139         metadata-verify.c       \
140         metadata-internals.h    \
141         method-builder.h        \
142         method-builder.c        \
143         mono-basic-block.c      \
144         mono-basic-block.h      \
145         mono-config.c           \
146         mono-cq.c               \
147         mono-cq.h               \
148         mono-debug.h            \
149         mono-debug.c            \
150         mono-debug-debugger.h   \
151         mono-endian.c           \
152         mono-endian.h           \
153         mono-hash.h             \
154         mono-mlist.c            \
155         mono-mlist.h            \
156         mono-perfcounters.c     \
157         mono-perfcounters.h     \
158         mono-perfcounters-def.h \
159         mono-ptr-array.h        \
160         mono-wsq.c              \
161         mono-wsq.h              \
162         monitor.h               \
163         nacl-stub.c             \
164         normalization-tables.h  \
165         number-formatter.h      \
166         object-internals.h      \
167         opcodes.c               \
168         socket-io.c             \
169         socket-io.h             \
170         process.c               \
171         process.h               \
172         profiler.c              \
173         profiler-private.h      \
174         rand.h                  \
175         rand.c                  \
176         remoting.h              \
177         remoting.c              \
178         runtime.c               \
179         security.c              \
180         security.h              \
181         security-core-clr.c     \
182         security-core-clr.h     \
183         security-manager.c      \
184         security-manager.h      \
185         string-icalls.c         \
186         string-icalls.h         \
187         sysmath.h               \
188         sysmath.c               \
189         tabledefs.h             \
190         threads.c               \
191         threads-types.h         \
192         threadpool.c            \
193         threadpool.h            \
194         threadpool-internals.h  \
195         verify.c                \
196         verify-internals.h      \
197         wrapper-types.h \
198         reflection-internals.h  \
199         file-mmap-posix.c       \
200         file-mmap-windows.c     \
201         file-mmap.h     \
202         object-offsets.h        \
203         abi-details.h   \
204         metadata-cross-helpers.c
205
206
207 # These source files have compile time dependencies on GC code
208 gc_dependent_sources = \
209         appdomain.c     \
210         domain.c        \
211         gc.c            \
212         monitor.c       \
213         mono-hash.c     \
214         object.c        \
215         reflection.c
216
217 boehm_sources = \
218         boehm-gc.c
219
220 sgen_sources = \
221         sgen-os-posix.c         \
222         sgen-os-mach.c          \
223         sgen-os-win32.c         \
224         sgen-gc.c               \
225         sgen-internal.c         \
226         sgen-marksweep.c        \
227         sgen-los.c              \
228         sgen-protocol.c \
229         sgen-bridge.c           \
230         sgen-bridge.h           \
231         sgen-old-bridge.c               \
232         sgen-new-bridge.c               \
233         sgen-tarjan-bridge.c            \
234         sgen-toggleref.c                \
235         sgen-toggleref.h                \
236         sgen-gc.h               \
237         sgen-conf.h             \
238         sgen-archdep.h          \
239         sgen-cardtable.c        \
240         sgen-cardtable.h        \
241         sgen-pointer-queue.c    \
242         sgen-pointer-queue.h    \
243         sgen-pinning.c  \
244         sgen-pinning.h  \
245         sgen-pinning-stats.c    \
246         sgen-workers.c  \
247         sgen-workers.h  \
248         sgen-gray.c     \
249         sgen-gray.h     \
250         sgen-major-copy-object.h \
251         sgen-minor-copy-object.h \
252         sgen-copy-object.h \
253         sgen-marksweep-scan-object-concurrent.h \
254         sgen-minor-scan-object.h \
255         sgen-marksweep-drain-gray-stack.h       \
256         sgen-protocol.h         \
257         sgen-scan-object.h      \
258         sgen-nursery-allocator.c        \
259         sgen-hash-table.c       \
260         sgen-hash-table.h       \
261         sgen-descriptor.c               \
262         sgen-descriptor.h               \
263         sgen-alloc.c            \
264         sgen-debug.c            \
265         sgen-simple-nursery.c   \
266         sgen-split-nursery.c    \
267         sgen-memory-governor.c  \
268         sgen-memory-governor.h  \
269         sgen-stw.c                              \
270         sgen-fin-weak-hash.c    \
271         sgen-layout-stats.c     \
272         sgen-layout-stats.h     \
273         sgen-qsort.c    \
274         sgen-qsort.h    \
275         sgen-tagged-pointer.h
276
277 libmonoruntime_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(null_gc_sources) $(boehm_sources)
278 libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES)
279
280 libmonoruntimesgen_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(sgen_sources)
281 libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES)
282
283 libmonoruntime_static_la_SOURCES = $(libmonoruntime_la_SOURCES)
284 libmonoruntime_static_la_LDFLAGS = -static
285 libmonoruntime_static_la_CFLAGS = $(BOEHM_DEFINES)
286
287 libmonoruntimesgen_static_la_SOURCES = $(libmonoruntimesgen_la_SOURCES)
288 libmonoruntimesgen_static_la_LDFLAGS = -static
289 libmonoruntimesgen_static_la_CFLAGS = $(SGEN_DEFINES)
290
291 libmonoruntimeincludedir = $(includedir)/mono-$(API_VER)/mono/metadata
292
293 libmonoruntimeinclude_HEADERS = \
294         assembly.h              \
295         attrdefs.h              \
296         appdomain.h             \
297         blob.h                  \
298         class.h                 \
299         debug-helpers.h         \
300         debug-mono-symfile.h    \
301         threads.h               \
302         environment.h           \
303         exception.h             \
304         image.h                 \
305         loader.h                \
306         metadata.h              \
307         mono-config.h           \
308         mono-debug.h            \
309         mono-gc.h               \
310         sgen-bridge.h           \
311         object.h                \
312         opcodes.h               \
313         profiler.h              \
314         reflection.h            \
315         row-indexes.h           \
316         tokentype.h             \
317         verify.h                
318
319 if DTRACE_G_REQUIRED
320
321 PEDUMP_DTRACE_OBJECT = pedump-dtrace.$(OBJEXT)
322
323 pedump-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d libmonoruntime.la ../io-layer/libwapi.la ../utils/libmonoutils.la
324         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
325         --pic pedump-dtrace.$(OBJEXT) $(top_srcdir)/data/mono.d libmonoruntime.la ../io-layer/libwapi.la ../utils/libmonoutils.la
326
327 else
328 PEDUMP_DTRACE_OBJECT = 
329 endif
330
331 if SHARED_MONO
332 if SUPPORT_BOEHM
333 pedump_SOURCES =                \
334         pedump.c
335
336 pedump_LDADD = libmonoruntime.la ../io-layer/libwapi.la ../utils/libmonoutils.la \
337         $(LIBGC_LIBS) $(GLIB_LIBS) -lm $(LIBICONV) $(PEDUMP_DTRACE_OBJECT)
338
339 if PLATFORM_DARWIN
340 pedump_LDFLAGS=-framework CoreFoundation -framework Foundation
341 endif
342 endif
343 endif
344
345 EXTRA_DIST = make-bundle.pl sample-bundle $(win32_sources) $(unix_sources) $(null_sources) runtime.h \
346                 tpool-poll.c tpool-epoll.c tpool-kqueue.c