[coop] Use unbalanced transition to GC Unsafe in mono_raise_exception
[mono-project.git] / mono / mini / Makefile.am.in
blob4bf47e2eafb77744fcd7b449187651d829b8f6b0
1 include $(top_srcdir)/mk/common.mk
3 count=100000
4 mtest=for_loop
5 monodir=$(top_builddir)
6 mono=$(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),mono)
8 if HOST_WIN32
9 PLATFORM_PATH_SEPARATOR=;
10 else
11 PLATFORM_PATH_SEPARATOR=:
12 endif
14 # This is needed for automake dependency generation
15 if SUPPORT_NULLGC
16 libgc_libs=
17 libgc_static_libs=
18 else
19 libgc_libs=$(monodir)/libgc/libmonogc.la
20 libgc_static_libs=$(monodir)/libgc/libmonogc-static.la
21 endif
23 glib_libs = $(monodir)/mono/eglib/libeglib.la
25 boehm_libs=     \
26         $(monodir)/mono/metadata/libmonoruntime.la      \
27         $(monodir)/mono/utils/libmonoutils.la \
28         $(glib_libs) \
29         $(libgc_libs)
31 sgen_libs = \
32         $(monodir)/mono/metadata/libmonoruntimesgen.la  \
33         $(monodir)/mono/sgen/libmonosgen.la     \
34         $(monodir)/mono/utils/libmonoutils.la \
35         $(glib_libs)
37 if ENABLE_LLVM
38 -include $(mono_build_root)/llvm/llvm_config.mk
39 LLVM_CFLAGS=$(LLVM_CFLAGS_INTERNAL) $(LLVM_CFLAGS_EXTERNAL)
40 LLVM_CXXFLAGS=$(LLVM_CXXFLAGS_INTERNAL) $(LLVM_CXXFLAGS_EXTERNAL)
41 LLVM_LDFLAGS=$(LLVM_LDFLAGS_INTERNAL) $(LLVM_LDFLAGS_EXTERNAL)
42 LLVM_LIBS=$(LLVM_LIBS_INTERNAL) $(LLVM_LIBS_EXTERNAL)
44 print-llvm-info:
45         echo "cflags: $(LLVM_CFLAGS)"
46         echo "cxxflags: $(LLVM_CXXFLAGS)"
47         echo "ldflags: $(LLVM_LDFLAGS)"
48         echo "libs: $(LLVM_LIBS)"
49 endif
52 if FULL_AOT_TESTS
53 # if the tests are going to run with framework assemblies compiled with
54 # -d:MOBILE, tell the runtime to remap framework assemblies using the mobile
55 # runtime info
56 MOBILE_RUNTIME_ARG=--runtime=mobile
57 else
58 MOBILE_RUNTIME_ARG=
59 endif
61 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
63 RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_builddir)/runtime/mono-wrapper)
65 MINI_RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE) $(MOBILE_RUNTIME_ARG)
66 TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/mono-wrapper
67 INTERP_RUNTIME = $(MINI_RUNTIME) --interpreter
68 RUNTIME_AOTCHECK = MONO_PATH="$(CLASS)$(PLATFORM_PATH_SEPARATOR)." $(RUNTIME_EXECUTABLE)
70 MCS = CSC_SDK_PATH_DISABLED= $(TOOLS_RUNTIME) $(CSC) -langversion:7.2 -unsafe -nowarn:0162 -nologo -noconfig -r:$(CLASS)/mscorlib.dll -r:$(CLASS)/System.dll -r:$(CLASS)/System.Core.dll
71 ILASM = $(TOOLS_RUNTIME) $(mcs_topdir)/class/lib/build/ilasm.exe
73 AM_CFLAGS = \
74         -I$(top_srcdir)         \
75         $(GLIB_CFLAGS)          \
76         $(LLVM_CFLAGS)          \
77         $(JEMALLOC_CFLAGS)      \
78         $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS)
80 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
82 if HOST_WIN32
83 export HOST_CC
84 # The mingw math.h has "extern inline" functions that dont appear in libs, so
85 # optimisation is required to actually inline them
86 PLATFORM_CFLAGS = -O
87 endif
89 monoldflags=$(export_ldflags)
90 monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
92 if HOST_WIN32
93 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
94 else
95 if HOST_ANDROID
96 libmonoldflags= -avoid-version $(monoldflags)
97 else
98 libmonoldflags=$(monoldflags) -version-info 1:0:0
99 endif
100 endif
102 if SUPPORT_SGEN
103 sgen_binaries = mono-sgen
104 sgen_libraries = libmonosgen-2.0.la
105 sgen_static_libraries = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(sgen_libs)
106 endif
108 if SUPPORT_BOEHM
109 boehm_libraries = libmonoboehm-2.0.la
110 boehm_static_libraries = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(boehm_libs)
111 boehm_binaries  = mono-boehm
112 endif
114 if SUPPORT_SGEN
115 mono_bin_suffix = sgen
116 libmono_suffix = sgen
117 else
118 mono_bin_suffix = boehm
119 libmono_suffix = boehm
120 endif
122 if DISABLE_EXECUTABLES
123 else
124 mono: mono-$(mono_bin_suffix)
125         ln -sf $< $@
127 mono.exe: mono-$(mono_bin_suffix).exe
128         ln -sf $< $@
130 install-exec-hook:
131         (cd $(DESTDIR)$(bindir) && ln -sf mono-$(mono_bin_suffix) mono)
132         (cd $(DESTDIR)$(libdir); shopt -s nullglob 2>/dev/null; for i in libmono$(libmono_suffix)*; do ln -sf $$i `echo $$i | sed s/$(libmono_suffix)//` ; done)
133 endif
135 if DISABLE_EXECUTABLES
136 else
137 if HOST_WIN32
138 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
139 else
140 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
141 endif
142 endif
144 if DISABLE_EXECUTABLES
145 noinst_PROGRAMS =
146 else
147 noinst_PROGRAMS = mono
148 endif
150 if DISABLE_EXECUTABLES
151 shared_libraries = $(boehm_libraries) $(sgen_libraries)
152 else
153 if SHARED_MONO
154 shared_libraries = $(boehm_libraries) $(sgen_libraries)
155 endif
156 endif
158 lib_LTLIBRARIES = $(shared_libraries)
160 if DISABLE_INTERPRETER
161 lib_LTLIBRARIES += $(interp_libs)
162 endif
164 if SHARED_MONO
165 mini_common_lib = libmini.la
166 else
167 mini_common_lib = 
168 endif
170 noinst_LTLIBRARIES = $(mini_common_lib)
172 noinst_LIBRARIES = libmain.a
174 libmain_a_SOURCES = main-sgen.c
175 if SUPPORT_BOEHM
176 libmain_a_SOURCES += main.c
177 endif
178 libmain_a_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
180 if LOADED_LLVM
181 lib_LTLIBRARIES += libmono-llvm.la
182 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp
183 libmono_llvm_la_LIBADD = $(glib_libs) $(LLVM_LIBS) $(LLVM_LDFLAGS)
185 if HOST_DARWIN
186 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace 
187 endif
188 endif
190 mono_boehm_SOURCES =
191 mono_boehm_CFLAGS = $(AM_CFLAGS) @CXX_REMOVE_CFLAGS@
193 AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
195 mono_sgen_SOURCES =
196 mono_sgen_CFLAGS = $(AM_CFLAGS) @CXX_REMOVE_CFLAGS@
198 # We build this after libmono was built so it contains the date when the final
199 # link was done
200 if SUPPORT_BOEHM
201 buildver-boehm.h: libmini.la $(monodir)/mono/metadata/libmonoruntime.la
202         @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
203 libmain_a-main.$(OBJEXT): buildver-boehm.h
204 endif
206 buildver-sgen.h: libmini.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la
207         @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
209 libmain_a-main-sgen.$(OBJEXT): buildver-sgen.h
211 if DTRACE_G_REQUIRED
212 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
213 if STATIC_MONO
214 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
215 else
216 MONO_DTRACE_OBJECT = 
217 endif
218 else
219 MONO_DTRACE_OBJECT = 
220 LIBMONO_DTRACE_OBJECT = 
221 endif
223 if STATIC_MONO
224 # Link libmono into mono statically
225 # This leads to higher performance, especially with TLS
226 MONO_LIB=$(boehm_static_libraries)
227 MONO_SGEN_LIB=$(sgen_static_libraries)
228 else 
229 MONO_LIB=libmonoboehm-2.0.la
230 MONO_SGEN_LIB=libmonosgen-2.0.la
231 endif
233 if LOADED_LLVM
234 LLVMMONOF=
235 else
236 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
237 endif
239 mono_boehm_LDADD = \
240         libmain_a-main.$(OBJEXT) \
241         $(MONO_LIB)             \
242         $(glib_libs)            \
243         $(LLVMMONOF)            \
244         -lm                     \
245         $(MONO_DTRACE_OBJECT)
247 mono_boehm_LDFLAGS = \
248         $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) 
250 mono_sgen_LDADD = \
251         libmain_a-main-sgen.$(OBJEXT) \
252         $(MONO_SGEN_LIB)        \
253         $(glib_libs)            \
254         $(LLVMMONOF)            \
255         -lm                     \
256         $(MONO_DTRACE_OBJECT)
258 mono_sgen_LDFLAGS = $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) 
260 if BITCODE
261 libmonoldflags += -no-undefined
262 endif
264 # if SUPPORT_SGEN
266 # mono_LDADD = $(mono_sgen_LDADD)
267 # mono_LDFLAGS = $(mono_sgen_LDFLAGS)
269 # endif
272 if DTRACE_G_REQUIRED
274 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
275         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
276         $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
278 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
279         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
280         --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
282 endif
284 # Create monow.exe, linked for the 'windows' subsystem
285 if HOST_WIN32
286 if SUPPORT_BOEHM
287 monow_LDADD = $(mono_boehm_LDADD)
288 monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
289 monow_SOURCES = $(mono_boehm_SOURCES)
290 else
291 monow_LDADD = $(mono_sgen_LDADD)
292 monow_LDFLAGS = $(mono_sgen_LDFLAGS) -mwindows
293 monow_SOURCES = $(mono_sgen_SOURCES)
294 endif
295 endif
297 wasm_sources = \
298         mini-wasm.c             \
299         mini-wasm.h             \
300         mini-wasm-debugger.c    \
301         debugger-engine.c       \
302         exceptions-wasm.c       \
303         tramp-wasm.c
305 x86_sources = \
306         mini-x86.c              \
307         mini-x86.h              \
308         exceptions-x86.c        \
309         tramp-x86.c     \
310         mini-x86-gsharedvt.c    \
311         tramp-x86-gsharedvt.c
313 amd64_sources = \
314         mini-amd64.c            \
315         mini-amd64.h            \
316         exceptions-amd64.c      \
317         tramp-amd64.c   \
318         mini-amd64-gsharedvt.c  \
319         mini-amd64-gsharedvt.h  \
320         tramp-amd64-gsharedvt.c
322 ppc_sources = \
323         mini-ppc.c              \
324         mini-ppc.h              \
325         exceptions-ppc.c        \
326         tramp-ppc.c
328 arm_sources = \
329         mini-arm.c              \
330         mini-arm.h              \
331         exceptions-arm.c        \
332         tramp-arm.c     \
333         mini-arm-gsharedvt.c    \
334         tramp-arm-gsharedvt.c
336 arm64_sources = \
337         mini-arm64.c            \
338         mini-arm64.h            \
339         exceptions-arm64.c      \
340         tramp-arm64.c   \
341         mini-arm64-gsharedvt.c  \
342         mini-arm64-gsharedvt.h  \
343         tramp-arm64-gsharedvt.c
345 mips_sources = \
346         mini-mips.c             \
347         mini-mips.h             \
348         exceptions-mips.c       \
349         tramp-mips.c
351 sparc_sources = \
352         mini-sparc.c            \
353         mini-sparc.h            \
354         exceptions-sparc.c      \
355         tramp-sparc.c
357 s390x_sources = \
358         mini-s390x.c            \
359         mini-s390x.h            \
360         support-s390x.h         \
361         exceptions-s390x.c      \
362         tramp-s390x.c
364 darwin_sources = \
365         mini-darwin.c
367 windows_sources = \
368         mini-windows.c \
369         mini-windows.h \
370         mini-windows-dllmain.c \
371         mini-windows-dlldac.c
373 posix_sources = \
374         mini-posix.c
376 if ENABLE_LLVM
377 if LOADED_LLVM
378 llvm_sources = \
379         mini-llvm-loaded.c
380 else
381 llvm_sources = \
382         mini-llvm.c             \
383         mini-llvm-loaded.c \
384         mini-llvm-cpp.cpp \
385         llvm-jit.cpp
386 endif
387 endif
389 interp_sources =        \
390         interp/hacks.h          \
391         interp/interp.h \
392         interp/interp-internals.h       \
393         interp/interp.c \
394         interp/mintops.h        \
395         interp/mintops.def      \
396         interp/mintops.c        \
397         interp/transform.c
399 interp_libs = libmono-ee-interp.la
401 if !DISABLE_INTERPRETER
402 interp_libs_with_mini = $(interp_libs)
403 endif
405 if ENABLE_LLVM
406 llvm_runtime_sources = \
407         llvm-runtime.cpp
408 else
409 if ENABLE_LLVM_RUNTIME
410 llvm_runtime_sources = \
411         llvm-runtime.cpp
412 endif
413 endif
415 common_sources = \
416         mini.c                  \
417         mini-runtime.c  \
418         seq-points.c    \
419         seq-points.h    \
420         ir-emit.h               \
421         method-to-ir.c          \
422         cfgdump.h               \
423         cfgdump.c               \
424         decompose.c             \
425         mini.h                  \
426         version.h               \
427         optflags-def.h          \
428         jit-icalls.h            \
429         jit-icalls.c            \
430         trace.c                 \
431         trace.h                 \
432         patch-info.h            \
433         mini-ops.h              \
434         mini-arch.h             \
435         dominators.c            \
436         cfold.c                 \
437         regalloc.h              \
438         helpers.c               \
439         liveness.c              \
440         ssa.c                   \
441         abcremoval.c            \
442         abcremoval.h            \
443         local-propagation.c     \
444         driver.c                \
445         debug-mini.c            \
446         linear-scan.c           \
447         aot-compiler.h          \
448         aot-compiler.c          \
449         aot-runtime.c           \
450         aot-runtime-wasm.c      \
451         wasm_m2n_invoke.g.h     \
452         graph.c                 \
453         mini-codegen.c          \
454         mini-exceptions.c       \
455         mini-trampolines.c      \
456         branch-opts.c           \
457         mini-generic-sharing.c  \
458         simd-methods.h          \
459         tasklets.c              \
460         tasklets.h              \
461         simd-intrinsics.c       \
462         mini-native-types.c \
463         mini-unwind.h           \
464         unwind.c                \
465         image-writer.h          \
466         image-writer.c          \
467         dwarfwriter.h           \
468         dwarfwriter.c           \
469         mini-gc.h               \
470         mini-gc.c               \
471         debugger-agent.h        \
472         debugger-engine.h       \
473         debugger-agent-stubs.c  \
474         debugger-state-machine.h        \
475         xdebug.c                        \
476         mini-llvm.h                     \
477         mini-llvm-cpp.h \
478         llvm-jit.h              \
479         alias-analysis.c        \
480         mini-cross-helpers.c \
481         arch-stubs.c            \
482         llvm-runtime.h  \
483         type-checking.c \
484         lldb.h                  \
485         lldb.c  \
486         memory-access.c \
487         intrinsics.c \
488         mini-profiler.c \
489         interp-stubs.c \
490         aot-runtime.h   \
491         ee.h \
492         mini-runtime.h
494 test_sources =                  \
495         basic-calls.cs          \
496         basic-long.cs           \
497         bench.cs                \
498         builtin-types.cs        \
499         objects.cs              \
500         arrays.cs               \
501         basic-float.cs          \
502         basic-math.cs           \
503         basic.cs                \
504         exceptions.cs           \
505         devirtualization.cs     \
506         iltests.il              \
507         test.cs                 \
508         generics.cs             \
509         generics-variant-types.il\
510         basic-simd.cs \
511         basic-vectors.cs \
512         aot-tests.cs \
513         gc-test.cs \
514         gshared.cs \
515         unaligned.cs    \
516         MemoryIntrinsics.il     \
517         mixed.cs        \
518         ratests.cs
520 regtests_UNIVERSAL = \
521         aot-tests.exe \
522         basic.exe \
523         basic-float.exe \
524         basic-long.exe \
525         basic-calls.exe \
526         builtin-types.exe \
527         gshared.exe \
528         objects.exe \
529         arrays.exe \
530         basic-math.exe \
531         exceptions.exe \
532         iltests.exe \
533         devirtualization.exe \
534         generics.exe \
535         basic-simd.exe \
536         unaligned.exe   \
537         basic-vectors.exe       \
538         ratests.exe
540 regtests_DISABLED = 
542 if FULL_AOT_TESTS
543 regtests_DISABLED += builtin-types.exe
544 endif
546 regtests = $(filter-out $(regtests_DISABLED),$(regtests_UNIVERSAL))
548 if WASM
549 arch_sources = $(wasm_sources)
550 arch_built=cpu-wasm.h
551 arch_define=__wasm__
552 target_define=TARGET_WASM
553 endif
555 if X86
556 arch_sources = $(x86_sources)
557 arch_built=cpu-x86.h
558 arch_define=__i386__
559 target_define=TARGET_X86
560 endif
562 if AMD64
563 arch_sources = $(amd64_sources)
564 arch_built=cpu-amd64.h
565 arch_define=__x86_64__
566 target_define=TARGET_AMD64
567 ARCH_FULLAOT_EXCLUDE=
568 endif
570 if POWERPC
571 arch_sources = $(ppc_sources)
572 arch_built=cpu-ppc.h
573 arch_define=__ppc__
574 target_define=TARGET_POWERPC
575 endif
577 if POWERPC64
578 arch_sources = $(ppc_sources)
579 arch_built=cpu-ppc64.h
580 arch_define=__ppc64__
581 target_define=TARGET_POWERPC
582 endif
584 if MIPS
585 arch_sources = $(mips_sources)
586 arch_built=cpu-mips.h
587 arch_define=__mips__
588 target_define=TARGET_MIPS
589 endif
591 if ARM
592 # pick up arm_dpimacros.h
593 ARCH_CFLAGS = -I../arch/arm
594 arch_sources = $(arm_sources)
595 arch_built=cpu-arm.h
596 arch_define=__arm__
597 target_define=TARGET_ARM
598 endif
600 if ARM64
601 arch_sources = $(arm64_sources)
602 arch_built=cpu-arm64.h
603 arch_define=__aarch64__
604 target_define=TARGET_ARM64
605 endif
607 if SPARC
608 arch_sources = $(sparc_sources)
609 arch_built=cpu-sparc.h
610 arch_define=__sparc__
611 target_define=TARGET_SPARC
612 endif
614 if SPARC64
615 arch_sources = $(sparc_sources)
616 arch_built=cpu-sparc.h
617 arch_define=__sparc__
618 target_define=TARGET_SPARC
619 endif
621 if S390X
622 arch_sources = $(s390x_sources)
623 arch_built=cpu-s390x.h
624 arch_define=__s390__
625 target_define=TARGET_S390X
626 endif
628 if HOST_WIN32
629 os_sources = $(windows_sources)
630 monobin_platform_ldflags=
631 endif
633 if HOST_SIGPOSIX
634 os_sources = $(posix_sources)
635 monobin_platform_ldflags=
636 endif
638 if HOST_DARWIN
639 os_sources = $(darwin_sources) $(posix_sources)
640 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
641 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
642 endif
644 if MONO_JEMALLOC_ENABLED
645 libmonoldflags += $(JEMALLOC_LDFLAGS)
646 endif
648 libmono_ee_interp_la_SOURCES = $(interp_sources)
649 libmono_ee_interp_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
650 if BITCODE
651 libmono_ee_interp_la_LDFLAGS = $(libmonoldflags)
652 if DISABLE_INTERPRETER
653 libmono_ee_interp_la_LIBADD = libmonosgen-2.0.la
654 endif
655 endif
657 if !WASM
658 extra_libmono_dbg_source = debugger-engine.c
659 endif
661 libmono_dbg_la_SOURCES = debugger-agent.c debugger-state-machine.c $(extra_libmono_dbg_source)
662 libmono_dbg_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
663 if BITCODE
664 if DISABLE_DEBUGGER_AGENT
665 libmono_dbg_la_LIBADD = libmonosgen-2.0.la
666 endif
667 endif
669 dbg_libs = libmono-dbg.la
671 if DISABLE_DEBUGGER_AGENT
672 lib_LTLIBRARIES += $(dbg_libs)
673 endif
675 if !DISABLE_DEBUGGER_AGENT
676 dbg_libs_with_mini = $(dbg_libs)
677 noinst_LTLIBRARIES += $(dbg_libs)
678 endif
681 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
682 # compile time dependencies on boehm/sgen.
684 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(arch_sources) $(os_sources)
685 libmini_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
687 libmonoboehm_2_0_la_SOURCES =
688 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS) @CXX_ADD_CFLAGS@
690 libmonoboehm_2_0_la_LIBADD = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
691 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) 
693 libmonosgen_2_0_la_SOURCES =
694 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS) @CXX_ADD_CFLAGS@
696 libmonosgen_2_0_la_LIBADD = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
697 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) 
699 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
701 # These are public headers.
702 # They should not use glib.h, G_BEGIN_DECLS, guint, etc.
703 # They should be wrapped in MONO_BEGIN_DECLS / MONO_END_DECLS.
704 libmonoinclude_HEADERS = jit.h
706 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649,0618
708 basic-simd.exe: basic-simd.cs TestDriver.dll
709         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
711 basic-vectors.exe: basic-vectors.cs TestDriver.dll
712         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/System.Numerics.dll -r:$(CLASS)/System.Numerics.Vectors.dll
714 builtin-types.exe: builtin-types.cs TestDriver.dll
715         $(MCS) -out:$@ $(CSFLAGS) -define:ARCH_$(shell echo $$((8 * $(SIZEOF_VOID_P)))) $< -r:TestDriver.dll
717 nacl.exe: nacl.cs TestDriver.dll
718         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
720 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
721         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll -r:$(CLASS)/System.Core.dll
723 unaligned.exe: unaligned.cs TestDriver.dll MemoryIntrinsics.dll
724         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:MemoryIntrinsics.dll
726 %.exe: %.cs TestDriver.dll
727         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
729 %.exe: %.il
730         $(ILASM) -output=$@ $<
732 TestDriver.dll: $(srcdir)/TestDriver.cs $(srcdir)/TestHelpers.cs
733         $(MCS) -out:$@ -target:library $^
735 generics-variant-types.dll: generics-variant-types.il
736         $(ILASM) -dll -output=$@ $<
738 MemoryIntrinsics.dll: MemoryIntrinsics.il
739         $(ILASM) -dll -output=$@ $<
741 GENMDESC_OPTS=
743 GENMDESC_PRG=python $(srcdir)/genmdesc.py $(target_define) $(srcdir)
745 cpu-wasm.h: mini-ops.h cpu-wasm.md
746         $(GENMDESC_PRG) cpu-wasm.h wasm_desc $(srcdir)/cpu-wasm.md
748 cpu-x86.h: mini-ops.h cpu-x86.md
749         $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
751 cpu-amd64.h: mini-ops.h cpu-amd64.md
752         $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
754 cpu-ppc.h: mini-ops.h cpu-ppc.md
755         $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
757 cpu-ppc64.h: mini-ops.h cpu-ppc64.md
758         $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
760 cpu-arm.h: mini-ops.h cpu-arm.md
761         $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
763 cpu-arm64.h: mini-ops.h cpu-arm64.md
764         $(GENMDESC_PRG) cpu-arm64.h arm64_cpu_desc $(srcdir)/cpu-arm64.md
766 cpu-sparc.h: mini-ops.h cpu-sparc.md
767         $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
769 cpu-s390x.h: mini-ops.h cpu-s390x.md
770         $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
772 cpu-mips.h: mini-ops.h cpu-mips.md
773         $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
775 testi: mono test.exe
776         $(MINI_RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
778 # ensure the tests are actually correct
779 checktests: $(regtests)
780         for i in $(regtests); do $(MINI_RUNTIME) $$i; done
782 rcheck-nunit: mono $(regtests)
783         $(MINI_RUNTIME) --regression $(regtests) > regressiontests.out 2>&1; cat regressiontests.out; \
784         if grep -q "100% pass" regressiontests.out; then successbool=True; failurescount=0; else successbool=False; failurescount=1; fi; \
785         echo "<?xml version='1.0' encoding='utf-8'?>\
786                 <test-results failures='$$failurescount' total='1' not-run='0' name='regression-tests.dummy' date='$$(date +%F)' time='$$(date +%T)'>\
787                         <test-suite name='regression-tests.dummy' success='$$successbool' time='0'>\
788                                 <results><test-case name='MonoTests.regressions.100percentsuccess' executed='True' success='$$successbool' time='0'>" > TestResult-regression.xml; \
789                                         if [ "$$successbool" = "False" ]; then echo "<failure><message><![CDATA[$$(cat regressiontests.out)]]></message><stack-trace></stack-trace></failure>" >> TestResult-regression.xml; fi; \
790                                 echo "</test-case></results>\
791                         </test-suite>\
792                 </test-results>" >> TestResult-regression.xml; exit $$failurescount
794 rcheck: mono $(regtests)
795         $(MINI_RUNTIME) --regression $(regtests)
797 richeck: mono $(regtests)
798         $(INTERP_RUNTIME) --regression $(regtests)
800 mixedcheck: mono mixed.exe
801         $(MINI_RUNTIME) --interp=jit=JitClass mixed.exe
803 if ARM
804 check-seq-points:
805 else
806 check-seq-points: mono $(regtests)
807         rm -f TestResult-op_il_seq_point.xml
808         for i in $(regtests); do $(srcdir)/test_op_il_seq_point.sh $$i || ($(srcdir)/test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
809         for i in $(regtests); do $(srcdir)/test_op_il_seq_point.sh $$i --aot || ($(srcdir)/test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
810         $(srcdir)/test_op_il_seq_point_headerfooter.sh
811 endif
813 gctest: mono gc-test.exe
814         MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(MINI_RUNTIME) --regression gc-test.exe
816 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
817 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
819 aotcheck: mono $(regtests)
820         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
821         $(MINI_RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
822         for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
823         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
825 llvmaotcheck:
826         $(MAKE) aotcheck LLVM=1
828 gsharedvtcheck:
829         $(MAKE) fullaotcheck GSHAREDVT=1
831 hybridcheck:
832         $(MAKE) fullaotcheck HYBRID=1
834 # FIXME: force preemptive suspend while interpreter doesn't support coop/hybird suspend
835 fullaotmixedcheck:
836         $(MAKE) fullaotcheck MIXED=1 MONO_THREADS_SUSPEND=preemptive
838 fullaot_regtests = $(regtests)
839 fullaot_testing_deps = generics-variant-types.dll TestDriver.dll MemoryIntrinsics.dll
840 fullaot_testing_deps_commas = generics-variant-types.dll,TestDriver.dll,MemoryIntrinsics.dll
842 FULLAOT_LIBS_UNIVERSAL = \
843         mscorlib.dll \
844         System.Core.dll \
845         System.dll \
846         System.Xml.dll \
847         System.Security.dll \
848         Mono.Simd.dll \
849         Mono.Security.dll \
850         System.Numerics.dll \
851         System.Numerics.Vectors.dll \
852         Mono.Posix.dll \
853         System.Configuration.dll
855 FULLAOT_LIBS_DISABLED =
857 if FULL_AOT_TESTS
858 # Skip aoting the tests that aren't compiled 
859 # on the full aot profiles because they're skipped
860 # on mobile profiles
861 FULLAOT_LIBS_DISABLED += \
862         Mono.Posix.dll \
863         System.Configuration.dll
864 endif
867 FULLAOT_LIBS = $(filter-out $(FULLAOT_LIBS_DISABLED),$(FULLAOT_LIBS_UNIVERSAL))
869 FULLAOT_TMP_DIR=$(top_builddir)/mono/mini/fullaot-tmp
871 FULLAOT_AOT_ARGS=$(if $(HYBRID),hybrid,full,interp)
872 FULLAOT_ARGS=$(if $(HYBRID),--hybrid-aot,--full-aot)
874 # This currently only works on amd64/arm
875 fullaotcheck: $(mono) $(fullaot_regtests) $(fullaot_testing_deps)
876         rm -rf $(FULLAOT_TMP_DIR)
877         mkdir $(FULLAOT_TMP_DIR)
878         $(MAKE) fullaot-libs AOT_FLAGS="$(FULLAOT_AOT_ARGS),$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" GSHAREDVT=$(GSHAREDVT)
879         cp $(regtests) $(fullaot_regtests) $(fullaot_testing_deps) $(FULLAOT_TMP_DIR)/
880         MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="$(FULLAOT_AOT_ARGS),$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" $(FULLAOT_TMP_DIR)/{$(fullaot_testing_deps_commas),*.exe} || exit 1
881         ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) $(FULLAOT_TMP_DIR)/
882         for i in $(fullaot_regtests); do echo $$i; MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) $(FULLAOT_ARGS) $(FULLAOT_TMP_DIR)/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
883         if test x$(MIXED) == x1; then failed=0;i=0; while test $$i -lt 900; do i=`expr $$i + 1`; bash -c "echo -n '.'"; MONO_PATH=$(FULLAOT_TMP_DIR) MONO_DEBUG=aot-skip=$$i ./mono --full-aot-interp $(FULLAOT_TMP_DIR)/basic.exe > $(FULLAOT_TMP_DIR)/mixed.log || failed=1; if test $$failed -eq 1; then echo "Failed at $$i"; exit $$failed; fi; done; fi
885 # This can run in parallel
886 fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
888 fullaot-tmp/%.dylib: $(CLASS)/%
889         cp $(CLASS)/$* fullaot-tmp/
890         mkdir fullaot-tmp/$*-tmp
891         MONO_PATH="fullaot-tmp/$(PLATFORM_PATH_SEPARATOR)$(CLASS)" $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) $(if $(GSHAREDVT),-O=gsharedvt) --aot=$(AOT_FLAGS),temp-path=fullaot-tmp/$*-tmp fullaot-tmp/$*
892         rm -rf fullaot-tmp/$*-tmp
894 llvmfullaotcheck:
895         $(MAKE) fullaotcheck LLVM=1
897 llvmonly_regtests = $(fullaot_regtests) gshared.exe
899 llvmonlycheck: mono $(llvmonly_regtests)
900         rm -rf fullaot-tmp
901         mkdir fullaot-tmp
902         $(MAKE) fullaot-libs AOT_FLAGS="llvmonly,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)"
903         cp $(llvmonly_regtests) $(fullaot_testing_deps) fullaot-tmp/
904         MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper  $(MOBILE_RUNTIME_ARG) --aot=llvmonly fullaot-tmp/{$(fullaot_testing_deps_commas),*.exe} || exit 1
905         ln -s $$PWD/mono fullaot-tmp/
906         for i in $(llvmonly_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) --llvmonly fullaot-tmp/$$i --exclude '!BITCODE' || exit 1; done
908 gccheck: gc-test.exe
909         MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe     
911 bench: mono test.exe
912         time env $(MINI_RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
914 mbench: test.exe
915         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
917 stat1: mono bench.exe
918         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression bench.exe
919         perl viewstat.pl stats.pl
921 stat2: mono basic.exe
922         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression basic.exe
923         perl viewstat.pl -e stats.pl
925 stat3: mono bench.exe
926         $(MINI_RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
927         perl viewstat.pl stats.pl
929 docu: mini.sgm
930         docbook2txt mini.sgm
932 # We need these because automake can't process normal make conditionals
933 check_local_targets = $(if $(EMIT_NUNIT), rcheck-nunit, rcheck)
935 check-local: $(check_local_targets)
937 clean-local:
938         rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResult-op_il_seq_point.xml*
940 pkgconfigdir = $(libdir)/pkgconfig
942 BUILT_SOURCES = version.h $(arch_built)
944 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
945 EXTRA_DIST = TestDriver.cs \
946         TestHelpers.cs \
947         genmdesc.py                             \
948         $(test_sources)                         \
949         $(wasm_sources) cpu-wasm.md             \
950         $(x86_sources) cpu-x86.md               \
951         $(amd64_sources) cpu-amd64.md           \
952         $(ppc_sources) cpu-ppc.md cpu-ppc64.md  \
953         $(arm_sources) cpu-arm.md               \
954         $(arm64_sources) cpu-arm64.md           \
955         $(mips_sources) cpu-mips.md             \
956         $(sparc_sources) cpu-sparc.md           \
957         $(s390x_sources) cpu-s390x.md           \
958         $(windows_sources)                      \
959         $(darwin_sources) Info.plist            \
960         $(posix_sources)                                        \
961         test_op_il_seq_point.sh                 \
962         test_op_il_seq_point_headerfooter.sh    \
963         Makefile.am.in
965 version.h: Makefile
966         if test -e $(top_srcdir)/.git; then \
967                 (cd $(top_srcdir); \
968                         LANG=C; export LANG; \
969                         if test -z "$$ghprbPullId"; then \
970                                 branch=`git branch | grep '^\*' | sed 's/.*detached .*/explicit/' | cut -d ' ' -f 2`; \
971                         else \
972                                 branch="pull-request-$$ghprbPullId"; \
973                         fi; \
974                         version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
975                         echo "#define FULL_VERSION \"$$branch/$$version\""; \
976                 ); \
977         else \
978                 if test -z "$$MONO_BRANCH" -o -z "$$MONO_BUILD_REVISION"; then \
979                         echo "#define FULL_VERSION \"tarball\""; \
980                 else \
981                         echo "#define FULL_VERSION \"$$MONO_BRANCH/$$MONO_BUILD_REVISION\""; \
982                 fi \
983         fi > version.h
985 # Utility target for patching libtool to speed up linking
986 patch-libtool:
987         sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
988         chmod a+x ../../libtool
990 # Utility target for patching libtool to get rid of the 'ranlib: file <file> has no symbols" warnings
991 patch-osx-libtool:
992         sed -e 's/old_archive_cmds=.*/old_archive_cmds="libtool -no_warning_for_no_symbols -static -o \\$$oldlib \\$$oldobjs"/g' < ../../libtool > 2; mv 2 ../../libtool
993         chmod a+x ../../libtool
995 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
996 patch-automake:
997         src="@echo \"  '. \$$name . ' ' x (8 - length (\$$name)) . '\""; dst="@echo \"'. \$$name . ' ' x (7 - length (\$$name)) .'\""; sed -e "s/$$src/$$dst/g" < $$EXE > 2 && cp 2 $$EXE && rm -f 2
999 tags:
1000         etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
1002 if ENABLE_LLVM
1003 llvm_makefile_dep = $(mono_build_root)/llvm/llvm_config.mk
1004 endif
1006 if HAS_EXTENSION_MODULE
1007 else
1008 Makefile.am: Makefile.am.in
1009         echo "##################### Generated from Makefile.am.in, do not modify ##########################" > $@
1010         cat $< >> $@
1012 endif
1014 # Per-library because linking doesn't like -xc++, it treats libraries as C++.
1015 CFLAGS := $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@)