[interp] Fix DEBUG_INTERP build (#16057)
[mono-project.git] / mono / mini / Makefile.am.in
bloba407491785b510dc228fdb41602b575a538d4f40
1 include $(top_srcdir)/mk/common.mk
3 ## Set the C++ linker based on configure settings, see comment in configure.ac
4 ## about why we need to do this.
5 CXXLD=$(MONO_CXXLD)
6 CCLD=$(MONO_CXXLD)
8 count=100000
9 mtest=for_loop
10 monodir=$(top_builddir)
11 mono=$(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),mono)
13 if HOST_WIN32
14 PLATFORM_PATH_SEPARATOR=;
15 else
16 PLATFORM_PATH_SEPARATOR=:
17 endif
19 # This is needed for automake dependency generation
20 if SUPPORT_NULLGC
21 libgc_libs=
22 libgc_static_libs=
23 else
24 libgc_libs=$(monodir)/libgc/libmonogc.la
25 libgc_static_libs=$(monodir)/libgc/libmonogc-static.la
26 endif
28 glib_libs = $(monodir)/mono/eglib/libeglib.la
30 boehm_libs=     \
31         $(monodir)/mono/metadata/libmonoruntime.la      \
32         $(monodir)/mono/utils/libmonoutils.la \
33         $(glib_libs) \
34         $(libgc_libs)
36 sgen_libs = \
37         $(monodir)/mono/metadata/libmonoruntimesgen.la  \
38         $(monodir)/mono/sgen/libmonosgen.la     \
39         $(monodir)/mono/utils/libmonoutils.la \
40         $(glib_libs)
42 if ENABLE_LLVM
44 include $(mono_build_root)/llvm/llvm_config.mk
45 LLVM_CFLAGS=$(LLVM_CFLAGS_INTERNAL) $(LLVM_CFLAGS_EXTERNAL)
46 LLVM_CXXFLAGS=$(LLVM_CXXFLAGS_INTERNAL) $(LLVM_CXXFLAGS_EXTERNAL)
47 LLVM_LDFLAGS=$(LLVM_LDFLAGS_INTERNAL) $(LLVM_LDFLAGS_EXTERNAL)
48 LLVM_LIBS=$(LLVM_LIBS_INTERNAL) $(LLVM_LIBS_EXTERNAL)
50 $(mono_build_root)/llvm/llvm_config.mk:
51         $(MAKE) -C $(top_builddir)/llvm $(mono_build_root)/llvm/llvm_config.mk
53 endif
56 if FULL_AOT_TESTS
57 # if the tests are going to run with framework assemblies compiled with
58 # -d:MOBILE, tell the runtime to remap framework assemblies using the mobile
59 # runtime info
60 MOBILE_RUNTIME_ARG=--runtime=mobile
61 else
62 MOBILE_RUNTIME_ARG=
63 endif
65 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
67 RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_builddir)/runtime/mono-wrapper)
69 MINI_RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE) $(MOBILE_RUNTIME_ARG)
70 TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/mono-wrapper
71 INTERP_RUNTIME = $(MINI_RUNTIME) --interpreter
72 RUNTIME_AOTCHECK = MONO_PATH="$(CLASS)$(PLATFORM_PATH_SEPARATOR)." $(RUNTIME_EXECUTABLE)
74 MCS = CSC_SDK_PATH_DISABLED= $(TOOLS_RUNTIME) --clr-memory-model $(CSC) -langversion:7.2 -nostdlib -unsafe -nowarn:0162 -nologo -noconfig -r:$(CLASS)/mscorlib.dll -r:$(CLASS)/System.dll -r:$(CLASS)/System.Core.dll
75 ILASM = $(TOOLS_RUNTIME) $(mcs_topdir)/class/lib/build/ilasm.exe
77 AM_CFLAGS = \
78         -I$(top_srcdir)         \
79         $(GLIB_CFLAGS)          \
80         $(LLVM_CFLAGS)          \
81         $(JEMALLOC_CFLAGS)      \
82         $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS)
84 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
86 if HOST_WIN32
87 export HOST_CC
88 # The mingw math.h has "extern inline" functions that dont appear in libs, so
89 # optimisation is required to actually inline them
90 PLATFORM_CFLAGS = -O
91 endif
93 monoldflags=$(export_ldflags)
94 monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
96 if HOST_WIN32
97 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
98 else
99 if HOST_ANDROID
100 libmonoldflags= -avoid-version $(monoldflags)
101 else
102 libmonoldflags=$(monoldflags) -version-info 1:0:0
103 endif
104 endif
106 if SUPPORT_SGEN
107 sgen_binaries = mono-sgen
108 sgen_libraries = libmonosgen-2.0.la
109 sgen_static_libraries = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(sgen_libs)
110 endif
112 if SUPPORT_BOEHM
113 boehm_libraries = libmonoboehm-2.0.la
114 boehm_static_libraries = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(boehm_libs)
115 boehm_binaries  = mono-boehm
116 endif
118 if SUPPORT_SGEN
119 mono_bin_suffix = sgen
120 libmono_suffix = sgen
121 else
122 mono_bin_suffix = boehm
123 libmono_suffix = boehm
124 endif
126 if DISABLE_EXECUTABLES
127 else
128 mono: mono-$(mono_bin_suffix)
129         ln -sf $< $@
131 mono.exe: mono-$(mono_bin_suffix).exe
132         ln -sf $< $@
134 install-exec-hook:
135         (cd $(DESTDIR)$(bindir) && ln -sf mono-$(mono_bin_suffix)$(EXEEXT) mono$(EXEEXT))
136         (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)
137 endif
139 if DISABLE_EXECUTABLES
140 else
141 if HOST_WIN32
142 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
143 else
144 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
145 endif
146 endif
148 if DISABLE_EXECUTABLES
149 noinst_PROGRAMS =
150 else
151 noinst_PROGRAMS = mono
152 endif
154 if DISABLE_EXECUTABLES
155 shared_libraries = $(boehm_libraries) $(sgen_libraries)
156 else
157 if SHARED_MONO
158 shared_libraries = $(boehm_libraries) $(sgen_libraries)
159 endif
160 endif
162 lib_LTLIBRARIES = $(shared_libraries)
164 if DISABLE_INTERPRETER
165 lib_LTLIBRARIES += $(interp_libs)
166 endif
168 if SHARED_MONO
169 mini_common_lib = libmini.la
170 else
171 mini_common_lib = 
172 endif
174 noinst_LTLIBRARIES = $(mini_common_lib)
176 noinst_LIBRARIES = libmain.a
178 libmain_a_SOURCES = main-sgen.c
179 if SUPPORT_BOEHM
180 libmain_a_SOURCES += main.c
181 endif
182 libmain_a_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
184 if LOADED_LLVM
185 lib_LTLIBRARIES += libmono-llvm.la
186 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp
187 libmono_llvm_la_LIBADD = $(glib_libs) $(LLVM_LIBS) $(LLVM_LDFLAGS)
189 if HOST_DARWIN
190 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace 
191 endif
192 endif
194 # we need this to prevent automake from generating a default mono_SOURCES = mono.c
195 mono_SOURCES =
197 mono_boehm_SOURCES =
198 mono_boehm_CFLAGS = $(AM_CFLAGS) @CXX_REMOVE_CFLAGS@
200 AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
202 mono_sgen_SOURCES =
203 mono_sgen_CFLAGS = $(AM_CFLAGS) @CXX_REMOVE_CFLAGS@
205 # We build this after libmono was built so it contains the date when the final
206 # link was done
207 if SUPPORT_BOEHM
208 buildver-boehm.h: libmini.la $(monodir)/mono/metadata/libmonoruntime.la
209         @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
210 libmain_a-main.$(OBJEXT): buildver-boehm.h
211 endif
213 buildver-sgen.h: libmini.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la
214         @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
216 libmain_a-main-sgen.$(OBJEXT): buildver-sgen.h
218 if DTRACE_G_REQUIRED
219 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
220 if STATIC_MONO
221 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
222 else
223 MONO_DTRACE_OBJECT = 
224 endif
225 else
226 MONO_DTRACE_OBJECT = 
227 LIBMONO_DTRACE_OBJECT = 
228 endif
230 if STATIC_MONO
231 # Link libmono into mono statically
232 # This leads to higher performance, especially with TLS
233 MONO_LIB=$(boehm_static_libraries)
234 MONO_SGEN_LIB=$(sgen_static_libraries)
235 else 
236 MONO_LIB=libmonoboehm-2.0.la
237 MONO_SGEN_LIB=libmonosgen-2.0.la
238 endif
240 if LOADED_LLVM
241 LLVMMONOF=
242 else
243 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
244 endif
246 if !HOST_WIN32
247 if HAVE_ZLIB
248 Z_LIBS= -lz
249 else
250 Z_LIBS=
251 endif
252 else
253 Z_LIBS=
254 endif
256 mono_boehm_LDADD = \
257         libmain_a-main.$(OBJEXT) \
258         $(MONO_LIB)             \
259         $(glib_libs)            \
260         $(LLVMMONOF)            \
261         $(LIBICONV)             \
262         $(Z_LIBS)               \
263         -lm                     \
264         $(MONO_DTRACE_OBJECT)
266 mono_boehm_LDFLAGS = \
267         $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) 
269 mono_sgen_LDADD = \
270         libmain_a-main-sgen.$(OBJEXT) \
271         $(MONO_SGEN_LIB)        \
272         $(glib_libs)            \
273         $(LLVMMONOF)            \
274         $(LIBICONV)             \
275         $(Z_LIBS)               \
276         -lm                     \
277         $(MONO_DTRACE_OBJECT)
280 mono_sgen_LDFLAGS = $(static_flags) $(monobinldflags) $(monobin_platform_ldflags)
282 if ENABLE_STATIC_GCC_LIBS
283 mono_sgen_LDFLAGS += -all-static
284 endif
286 if BITCODE
287 libmonoldflags += -no-undefined
288 endif
290 # if SUPPORT_SGEN
292 # mono_LDADD = $(mono_sgen_LDADD)
293 # mono_LDFLAGS = $(mono_sgen_LDFLAGS)
295 # endif
298 if DTRACE_G_REQUIRED
300 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
301         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
302         $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
304 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
305         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
306         --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
308 endif
310 # Create monow.exe, linked for the 'windows' subsystem
311 if HOST_WIN32
312 if SUPPORT_BOEHM
313 monow_LDADD = $(mono_boehm_LDADD)
314 monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
315 monow_SOURCES = $(mono_boehm_SOURCES)
316 else
317 monow_LDADD = $(mono_sgen_LDADD)
318 monow_LDFLAGS = $(mono_sgen_LDFLAGS) -mwindows
319 monow_SOURCES = $(mono_sgen_SOURCES)
320 endif
321 endif
323 wasm_sources = \
324         mini-wasm.c             \
325         mini-wasm.h             \
326         mini-wasm-debugger.c    \
327         debugger-engine.c       \
328         exceptions-wasm.c       \
329         tramp-wasm.c
331 x86_sources = \
332         mini-x86.c              \
333         mini-x86.h              \
334         exceptions-x86.c        \
335         tramp-x86.c     \
336         mini-x86-gsharedvt.c    \
337         tramp-x86-gsharedvt.c
339 amd64_sources = \
340         mini-amd64.c            \
341         mini-amd64.h            \
342         exceptions-amd64.c      \
343         tramp-amd64.c   \
344         mini-amd64-gsharedvt.c  \
345         mini-amd64-gsharedvt.h  \
346         tramp-amd64-gsharedvt.c
348 ppc_sources = \
349         mini-ppc.c              \
350         mini-ppc.h              \
351         exceptions-ppc.c        \
352         tramp-ppc.c
354 arm_sources = \
355         mini-arm.c              \
356         mini-arm.h              \
357         exceptions-arm.c        \
358         tramp-arm.c     \
359         mini-arm-gsharedvt.c    \
360         tramp-arm-gsharedvt.c
362 arm64_sources = \
363         mini-arm64.c            \
364         mini-arm64.h            \
365         exceptions-arm64.c      \
366         tramp-arm64.c   \
367         mini-arm64-gsharedvt.c  \
368         mini-arm64-gsharedvt.h  \
369         tramp-arm64-gsharedvt.c
371 mips_sources = \
372         mini-mips.c             \
373         mini-mips.h             \
374         exceptions-mips.c       \
375         tramp-mips.c
377 sparc_sources = \
378         mini-sparc.c            \
379         mini-sparc.h            \
380         exceptions-sparc.c      \
381         tramp-sparc.c
383 s390x_sources = \
384         mini-s390x.c            \
385         mini-s390x.h            \
386         support-s390x.h         \
387         exceptions-s390x.c      \
388         tramp-s390x.c
390 riscv_sources = \
391         mini-riscv.c \
392         mini-riscv.h \
393         exceptions-riscv.c \
394         tramp-riscv.c
396 darwin_sources = \
397         mini-darwin.c
399 windows_sources = \
400         mini-windows.c \
401         mini-windows-tls-callback.c \
402         mini-windows.h \
403         mini-windows-dllmain.c \
404         mini-windows-dlldac.c
406 posix_sources = \
407         mini-posix.c
409 if ENABLE_LLVM
410 if LOADED_LLVM
411 llvm_sources = \
412         mini-llvm-loaded.c
413 else
414 llvm_sources = \
415         mini-llvm.c             \
416         mini-llvm-loaded.c \
417         mini-llvm-cpp.cpp \
418         llvm-jit.cpp
419 endif
420 endif
422 interp_sources =        \
423         interp/interp.h \
424         interp/interp-internals.h       \
425         interp/interp.c \
426         interp/mintops.h        \
427         interp/mintops.def      \
428         interp/mintops.c        \
429         interp/transform.c
431 interp_libs = libmono-ee-interp.la
433 if !DISABLE_INTERPRETER
434 interp_libs_with_mini = $(interp_libs)
435 endif
437 if ENABLE_LLVM
438 llvm_runtime_sources = \
439         llvm-runtime.cpp
440 else
441 if ENABLE_LLVM_RUNTIME
442 llvm_runtime_sources = \
443         llvm-runtime.cpp
444 endif
445 endif
447 if ENABLE_NETCORE
448 netcore_sources = \
449         main-core.c
450 endif
452 common_sources = \
453         mini.c                  \
454         mini-runtime.c  \
455         seq-points.c    \
456         seq-points.h    \
457         ir-emit.h               \
458         method-to-ir.c          \
459         cfgdump.h               \
460         cfgdump.c               \
461         decompose.c             \
462         mini.h                  \
463         version.h               \
464         optflags-def.h          \
465         jit-icalls.h            \
466         jit-icalls.c            \
467         trace.c                 \
468         trace.h                 \
469         patch-info.h            \
470         mini-ops.h              \
471         mini-arch.h             \
472         dominators.c            \
473         cfold.c                 \
474         regalloc.h              \
475         helpers.c               \
476         liveness.c              \
477         ssa.c                   \
478         abcremoval.c            \
479         abcremoval.h            \
480         local-propagation.c     \
481         driver.c                \
482         debug-mini.c            \
483         linear-scan.c           \
484         aot-compiler.h          \
485         aot-compiler.c          \
486         aot-runtime.c           \
487         aot-runtime-wasm.c      \
488         wasm_m2n_invoke.g.h     \
489         graph.c                 \
490         mini-codegen.c          \
491         mini-exceptions.c       \
492         mini-trampolines.c      \
493         branch-opts.c           \
494         mini-generic-sharing.c  \
495         simd-methods.h          \
496         tasklets.c              \
497         tasklets.h              \
498         simd-intrinsics.c       \
499         mini-native-types.c \
500         mini-unwind.h           \
501         unwind.c                \
502         image-writer.h          \
503         image-writer.c          \
504         dwarfwriter.h           \
505         dwarfwriter.c           \
506         mini-gc.h               \
507         mini-gc.c               \
508         debugger-agent.h        \
509         debugger-engine.h       \
510         debugger-agent-stubs.c  \
511         debugger-state-machine.h        \
512         xdebug.c                        \
513         mini-llvm.h                     \
514         mini-llvm-cpp.h \
515         llvm-jit.h              \
516         alias-analysis.c        \
517         mini-cross-helpers.c \
518         arch-stubs.c            \
519         llvm-runtime.h  \
520         type-checking.c \
521         calls.c                 \
522         lldb.h                  \
523         lldb.c  \
524         memory-access.c \
525         intrinsics.c \
526         mini-profiler.c \
527         interp-stubs.c \
528         llvmonly-runtime.h \
529         llvmonly-runtime.c \
530         aot-runtime.h   \
531         ee.h \
532         mini-runtime.h
534 # keep in sync with mcs/class/Mono.Runtime.Tests
535 test_sources =                  \
536         basic-calls.cs          \
537         basic-long.cs           \
538         bench.cs                \
539         builtin-types.cs        \
540         objects.cs              \
541         arrays.cs               \
542         basic-float.cs          \
543         basic-math.cs           \
544         basic.cs                \
545         exceptions.cs           \
546         devirtualization.cs     \
547         iltests.il              \
548         test.cs                 \
549         generics.cs             \
550         generics-variant-types.il\
551         basic-simd.cs \
552         basic-vectors.cs \
553         aot-tests.cs \
554         gc-test.cs \
555         gshared.cs \
556         unaligned.cs    \
557         MemoryIntrinsics.il     \
558         mixed.cs        \
559         ratests.cs
561 regtests_UNIVERSAL = \
562         aot-tests.exe \
563         basic.exe \
564         basic-float.exe \
565         basic-long.exe \
566         basic-calls.exe \
567         builtin-types.exe \
568         gshared.exe \
569         objects.exe \
570         arrays.exe \
571         basic-math.exe \
572         exceptions.exe \
573         iltests.exe \
574         devirtualization.exe \
575         generics.exe \
576         basic-simd.exe \
577         unaligned.exe   \
578         basic-vectors.exe       \
579         ratests.exe
581 regtests_DISABLED = 
583 if FULL_AOT_TESTS
584 regtests_DISABLED += builtin-types.exe
585 endif
587 regtests = $(filter-out $(regtests_DISABLED),$(regtests_UNIVERSAL))
589 if WASM
590 arch_sources = $(wasm_sources)
591 arch_built=cpu-wasm.h
592 arch_define=__wasm__
593 target_define=TARGET_WASM
594 endif
596 if X86
597 arch_sources = $(x86_sources)
598 arch_built=cpu-x86.h
599 arch_define=__i386__
600 target_define=TARGET_X86
601 endif
603 if AMD64
604 arch_sources = $(amd64_sources)
605 arch_built=cpu-amd64.h
606 arch_define=__x86_64__
607 target_define=TARGET_AMD64
608 ARCH_FULLAOT_EXCLUDE=
609 endif
611 if POWERPC
612 arch_sources = $(ppc_sources)
613 arch_built=cpu-ppc.h
614 arch_define=__ppc__
615 target_define=TARGET_POWERPC
616 endif
618 if POWERPC64
619 arch_sources = $(ppc_sources)
620 arch_built=cpu-ppc64.h
621 arch_define=__ppc64__
622 target_define=TARGET_POWERPC
623 endif
625 if MIPS
626 arch_sources = $(mips_sources)
627 arch_built=cpu-mips.h
628 arch_define=__mips__
629 target_define=TARGET_MIPS
630 endif
632 if ARM
633 # pick up arm_dpimacros.h
634 ARCH_CFLAGS = -I../arch/arm
635 arch_sources = $(arm_sources)
636 arch_built=cpu-arm.h
637 arch_define=__arm__
638 target_define=TARGET_ARM
639 endif
641 if ARM64
642 arch_sources = $(arm64_sources)
643 arch_built=cpu-arm64.h
644 arch_define=__aarch64__
645 target_define=TARGET_ARM64
646 endif
648 if SPARC
649 arch_sources = $(sparc_sources)
650 arch_built=cpu-sparc.h
651 arch_define=__sparc__
652 target_define=TARGET_SPARC
653 endif
655 if SPARC64
656 arch_sources = $(sparc_sources)
657 arch_built=cpu-sparc.h
658 arch_define=__sparc__
659 target_define=TARGET_SPARC
660 endif
662 if S390X
663 arch_sources = $(s390x_sources)
664 arch_built=cpu-s390x.h
665 arch_define=__s390__
666 target_define=TARGET_S390X
667 endif
669 if RISCV32
670 arch_sources = $(riscv_sources)
671 arch_built = cpu-riscv32.h
672 arch_define = __riscv
673 target_define = TARGET_RISCV32
674 endif
676 if RISCV64
677 arch_sources = $(riscv_sources)
678 arch_built = cpu-riscv64.h
679 arch_define = __riscv
680 target_define = TARGET_RISCV64
681 endif
683 if HOST_WIN32
684 os_sources = $(windows_sources)
685 monobin_platform_ldflags=
686 endif
688 if HOST_SIGPOSIX
689 os_sources = $(posix_sources)
690 monobin_platform_ldflags=
691 endif
693 if HOST_DARWIN
694 os_sources = $(darwin_sources) $(posix_sources)
695 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
696 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
697 endif
699 if MONO_JEMALLOC_ENABLED
700 libmonoldflags += $(JEMALLOC_LDFLAGS)
701 endif
703 libmono_ee_interp_la_SOURCES = $(interp_sources)
704 libmono_ee_interp_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@ $(INTERP_CFLAGS)
705 if BITCODE
706 libmono_ee_interp_la_LDFLAGS = $(libmonoldflags)
707 if DISABLE_INTERPRETER
708 libmono_ee_interp_la_LIBADD = libmonosgen-2.0.la
709 endif
710 endif
712 if !WASM
713 extra_libmono_dbg_source = debugger-engine.c
714 endif
716 libmono_dbg_la_SOURCES = debugger-agent.c debugger-state-machine.c $(extra_libmono_dbg_source)
717 libmono_dbg_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
718 if BITCODE
719 if DISABLE_DEBUGGER_AGENT
720 libmono_dbg_la_LIBADD = libmonosgen-2.0.la
721 endif
722 endif
724 dbg_libs = libmono-dbg.la
726 if DISABLE_DEBUGGER_AGENT
727 lib_LTLIBRARIES += $(dbg_libs)
728 endif
730 if !DISABLE_DEBUGGER_AGENT
731 dbg_libs_with_mini = $(dbg_libs)
732 noinst_LTLIBRARIES += $(dbg_libs)
733 endif
736 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
737 # compile time dependencies on boehm/sgen.
739 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(arch_sources) $(os_sources) $(netcore_sources)
740 libmini_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
742 libmonoboehm_2_0_la_SOURCES =
743 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS) @CXX_ADD_CFLAGS@
745 libmonoboehm_2_0_la_LIBADD = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
746 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) 
748 libmonosgen_2_0_la_SOURCES =
749 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS) @CXX_ADD_CFLAGS@
751 libmonosgen_2_0_la_LIBADD = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
752 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) 
754 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
756 # These are public headers.
757 # They should not use glib.h, G_BEGIN_DECLS, guint, etc.
758 # They should be wrapped in MONO_BEGIN_DECLS / MONO_END_DECLS.
759 libmonoinclude_HEADERS = jit.h
761 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649,0618
763 basic-simd.exe: basic-simd.cs TestDriver.dll
764         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
766 basic-vectors.exe: basic-vectors.cs TestDriver.dll
767         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/System.Numerics.dll -r:$(CLASS)/System.Numerics.Vectors.dll
769 builtin-types.exe: builtin-types.cs TestDriver.dll
770         $(MCS) -out:$@ $(CSFLAGS) -define:ARCH_$(shell echo $$((8 * $(SIZEOF_VOID_P)))) $< -r:TestDriver.dll
772 nacl.exe: nacl.cs TestDriver.dll
773         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
775 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
776         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll -r:$(CLASS)/System.Core.dll
778 unaligned.exe: unaligned.cs TestDriver.dll MemoryIntrinsics.dll
779         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:MemoryIntrinsics.dll
781 %.exe: %.cs TestDriver.dll
782         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
784 %.exe: %.il
785         $(ILASM) -output=$@ $<
787 TestDriver.dll: $(srcdir)/TestDriver.cs $(srcdir)/TestHelpers.cs
788         $(MCS) -out:$@ -target:library $^
790 generics-variant-types.dll: generics-variant-types.il
791         $(ILASM) -dll -output=$@ $<
793 MemoryIntrinsics.dll: MemoryIntrinsics.il
794         $(ILASM) -dll -output=$@ $<
796 GENMDESC_OPTS=
798 GENMDESC_PRG=python $(srcdir)/genmdesc.py $(target_define) $(srcdir)
800 cpu-wasm.h: mini-ops.h cpu-wasm.md $(srcdir)/genmdesc.py
801         $(GENMDESC_PRG) cpu-wasm.h wasm_desc $(srcdir)/cpu-wasm.md
803 cpu-x86.h: mini-ops.h cpu-x86.md $(srcdir)/genmdesc.py
804         $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
806 cpu-amd64.h: mini-ops.h cpu-amd64.md $(srcdir)/genmdesc.py
807         $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
809 cpu-ppc.h: mini-ops.h cpu-ppc.md $(srcdir)/genmdesc.py
810         $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
812 cpu-ppc64.h: mini-ops.h cpu-ppc64.md $(srcdir)/genmdesc.py
813         $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
815 cpu-arm.h: mini-ops.h cpu-arm.md $(srcdir)/genmdesc.py
816         $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
818 cpu-arm64.h: mini-ops.h cpu-arm64.md $(srcdir)/genmdesc.py
819         $(GENMDESC_PRG) cpu-arm64.h arm64_cpu_desc $(srcdir)/cpu-arm64.md
821 cpu-sparc.h: mini-ops.h cpu-sparc.md $(srcdir)/genmdesc.py
822         $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
824 cpu-s390x.h: mini-ops.h cpu-s390x.md $(srcdir)/genmdesc.py
825         $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
827 cpu-mips.h: mini-ops.h cpu-mips.md $(srcdir)/genmdesc.py
828         $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
830 cpu-riscv32.h: cpu-riscv32.md $(srcdir)/genmdesc.py
831         $(GENMDESC_PRG) cpu-riscv32.h riscv32_cpu_desc $(srcdir)/cpu-riscv32.md
833 cpu-riscv64.h: cpu-riscv64.md $(srcdir)/genmdesc.py
834         $(GENMDESC_PRG) cpu-riscv64.h riscv64_cpu_desc $(srcdir)/cpu-riscv64.md
836 testi: mono test.exe
837         $(MINI_RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
839 test-local: $(regtests)
841 test-bundle-local:
842         mkdir -p $(TEST_BUNDLE_PATH)/tests/mini
843         cp -L $(regtests) TestDriver.dll MemoryIntrinsics.dll generics-variant-types.dll $(TEST_BUNDLE_PATH)/tests/mini/
844         cp -L mono-sgen $(TEST_BUNDLE_PATH)/
845         chmod +x $(TEST_BUNDLE_PATH)/mono-sgen
846 if SUPPORT_BOEHM
847         cp -L mono-boehm $(TEST_BUNDLE_PATH)/
848         chmod +x $(TEST_BUNDLE_PATH)/mono-boehm
849 endif
851 # ensure the tests are actually correct
852 checktests: $(regtests)
853         for i in $(regtests); do $(MINI_RUNTIME) $$i; done
855 rcheck-nunit: mono $(regtests)
856         $(MINI_RUNTIME) --regression $(regtests) > regressiontests.out 2>&1; cat regressiontests.out; \
857         if grep -q "100% pass" regressiontests.out; then successbool=True; failurescount=0; else successbool=False; failurescount=1; fi; \
858         echo "<?xml version='1.0' encoding='utf-8'?>\
859                 <test-results failures='$$failurescount' total='1' not-run='0' name='regression-tests.dummy' date='$$(date +%F)' time='$$(date +%T)'>\
860                         <test-suite name='regression-tests.dummy' success='$$successbool' time='0'>\
861                                 <results><test-case name='MonoTests.regressions.100percentsuccess' executed='True' success='$$successbool' time='0'>" > TestResult-regression.xml; \
862                                         if [ "$$successbool" = "False" ]; then echo "<failure><message><![CDATA[$$(cat regressiontests.out)]]></message><stack-trace></stack-trace></failure>" >> TestResult-regression.xml; fi; \
863                                 echo "</test-case></results>\
864                         </test-suite>\
865                 </test-results>" >> TestResult-regression.xml; exit $$failurescount
867 rcheck: mono $(regtests)
868         $(MINI_RUNTIME) --regression $(regtests)
870 richeck: mono $(regtests)
871         $(INTERP_RUNTIME) --regression $(regtests)
873 mixedcheck: mono mixed.exe
874         $(MINI_RUNTIME) --interp=jit=JitClass mixed.exe
876 check-seq-points:
878 # This test is fragile so disabled by default.
879 # single_imm_size support is incomplete.
880 # __declspec (thread) support breaks it.
881 # See https://github.com/mono/mono/pull/15599#issuecomment-509444313.
882 # See https://github.com/mono/mono/pull/15567.
883 # It was already previously disabled for ARM.
884 check-seq-points-force: mono $(regtests)
885         rm -f TestResult-op_il_seq_point.xml
886         for i in $(regtests); do $(srcdir)/test_op_il_seq_point.sh $(DEFAULT_PROFILE) $$i || ($(srcdir)/test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
887         for i in $(regtests); do $(srcdir)/test_op_il_seq_point.sh $(DEFAULT_PROFILE) $$i --aot || ($(srcdir)/test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
888         $(srcdir)/test_op_il_seq_point_headerfooter.sh
890 gctest: mono gc-test.exe
891         MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(MINI_RUNTIME) --regression gc-test.exe
893 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
894 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
896 aotcheck: mono $(regtests)
897         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
898         $(MINI_RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
899         for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
900         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
902 llvmaotcheck:
903         $(MAKE) aotcheck LLVM=1
905 gsharedvtcheck:
906         $(MAKE) fullaotcheck GSHAREDVT=1
908 hybridcheck:
909         $(MAKE) fullaotcheck HYBRID=1
911 # FIXME: force preemptive suspend while interpreter doesn't support coop/hybird suspend
912 fullaotmixedcheck:
913         $(MAKE) fullaotcheck MIXED=1 MONO_THREADS_SUSPEND=preemptive
915 fullaot_regtests = $(regtests)
916 fullaot_testing_deps = generics-variant-types.dll TestDriver.dll MemoryIntrinsics.dll
917 fullaot_testing_deps_commas = generics-variant-types.dll,TestDriver.dll,MemoryIntrinsics.dll
919 FULLAOT_LIBS_UNIVERSAL = \
920         mscorlib.dll \
921         System.Core.dll \
922         System.dll \
923         System.Xml.dll \
924         System.Security.dll \
925         Mono.Simd.dll \
926         Mono.Security.dll \
927         System.Numerics.dll \
928         System.Numerics.Vectors.dll \
929         Mono.Posix.dll \
930         System.Configuration.dll
932 FULLAOT_LIBS_DISABLED =
934 # Skip aoting the tests that aren't compiled 
935 # on the full aot profiles because they're skipped
936 # on mobile profiles
937 if FULL_AOT_TESTS
938 FULLAOT_LIBS_DISABLED += \
939         Mono.Posix.dll \
940         System.Configuration.dll
941 else
942 if FULL_AOT_INTERP_TESTS
943 FULLAOT_LIBS_DISABLED += \
944         Mono.Posix.dll \
945         System.Configuration.dll
946 endif
947 endif
949 FULLAOT_LIBS = $(filter-out $(FULLAOT_LIBS_DISABLED),$(FULLAOT_LIBS_UNIVERSAL))
951 FULLAOT_TMP_DIR=$(top_builddir)/mono/mini/fullaot-tmp
953 FULLAOT_AOT_ARGS=$(if $(HYBRID),hybrid,full,interp),$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)
954 FULLAOT_ARGS=$(if $(HYBRID),--hybrid-aot,--full-aot)
956 # This currently only works on amd64/arm
957 fullaotcheck: $(mono) $(fullaot_regtests) $(fullaot_testing_deps)
958         rm -rf $(FULLAOT_TMP_DIR)
959         mkdir $(FULLAOT_TMP_DIR)
960         $(MAKE) fullaot-libs AOT_FLAGS="$(FULLAOT_AOT_ARGS)"
961         cp $(fullaot_regtests) $(fullaot_testing_deps) $(FULLAOT_TMP_DIR)/
962         MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="$(FULLAOT_AOT_ARGS)" $(FULLAOT_TMP_DIR)/{$(fullaot_testing_deps_commas),*.exe} || exit 1
963         ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) $(FULLAOT_TMP_DIR)/
964         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
965         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 $(top_builddir)/runtime/mono-wrapper --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
967 # This can run in parallel
968 fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
970 fullaot-tmp/%.dylib: $(CLASS)/%
971         cp $(CLASS)/$* fullaot-tmp/
972         mkdir fullaot-tmp/$*-tmp
973         MONO_PATH="fullaot-tmp/$(PLATFORM_PATH_SEPARATOR)$(CLASS)" $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot=$(AOT_FLAGS),temp-path=fullaot-tmp/$*-tmp fullaot-tmp/$*
974         rm -rf fullaot-tmp/$*-tmp
976 llvmfullaotcheck:
977         $(MAKE) fullaotcheck LLVM=1 GSHAREDVT=1
979 llvmonly_regtests = $(fullaot_regtests) gshared.exe
981 llvmonlycheck: mono $(llvmonly_regtests)
982         rm -rf fullaot-tmp
983         mkdir fullaot-tmp
984         $(MAKE) fullaot-libs AOT_FLAGS="llvmonly,clangxx=clang++-6.0,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)"
985         cp $(llvmonly_regtests) $(fullaot_testing_deps) fullaot-tmp/
986         MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper  $(MOBILE_RUNTIME_ARG) --aot=llvmonly,clangxx=clang++-6.0 fullaot-tmp/{$(fullaot_testing_deps_commas),*.exe} || exit 1
987         ln -s $$PWD/mono fullaot-tmp/
988         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
990 gccheck: gc-test.exe
991         MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe     
993 bench: mono test.exe
994         time env $(MINI_RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
996 mbench: test.exe
997         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
999 stat1: mono bench.exe
1000         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression bench.exe
1001         perl viewstat.pl stats.pl
1003 stat2: mono basic.exe
1004         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression basic.exe
1005         perl viewstat.pl -e stats.pl
1007 stat3: mono bench.exe
1008         $(MINI_RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
1009         perl viewstat.pl stats.pl
1011 docu: mini.sgm
1012         docbook2txt mini.sgm
1014 # We need these because automake can't process normal make conditionals
1015 check_local_targets = $(if $(EMIT_NUNIT), rcheck-nunit, rcheck)
1017 check-local: $(check_local_targets)
1019 clean-local:
1020         rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResult-op_il_seq_point.xml*
1022 pkgconfigdir = $(libdir)/pkgconfig
1024 BUILT_SOURCES = version.h $(arch_built)
1026 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
1027 EXTRA_DIST = TestDriver.cs \
1028         TestHelpers.cs \
1029         genmdesc.py                             \
1030         $(test_sources)                         \
1031         $(wasm_sources) cpu-wasm.md             \
1032         $(x86_sources) cpu-x86.md               \
1033         $(amd64_sources) cpu-amd64.md           \
1034         $(ppc_sources) cpu-ppc.md cpu-ppc64.md  \
1035         $(arm_sources) cpu-arm.md               \
1036         $(arm64_sources) cpu-arm64.md           \
1037         $(mips_sources) cpu-mips.md             \
1038         $(sparc_sources) cpu-sparc.md           \
1039         $(s390x_sources) cpu-s390x.md           \
1040         $(riscv_sources) cpu-riscv32.md cpu-riscv64.md \
1041         $(windows_sources)                      \
1042         $(darwin_sources) Info.plist            \
1043         $(posix_sources)                                        \
1044         test_op_il_seq_point.sh                 \
1045         test_op_il_seq_point_headerfooter.sh    \
1046         Makefile.am.in
1048 version.h: Makefile
1049         if test -e $(top_srcdir)/.git; then \
1050                 (cd $(top_srcdir); \
1051                         LANG=C; export LANG; \
1052                         if test -z "$$ghprbPullId"; then \
1053                                 branch=`git branch | grep '^\*' | sed 's/.*detached .*/explicit/' | cut -d ' ' -f 2`; \
1054                         else \
1055                                 branch="pull-request-$$ghprbPullId"; \
1056                         fi; \
1057                         version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
1058                         echo "#define FULL_VERSION \"$$branch/$$version\""; \
1059                 ); \
1060         else \
1061                 if test -z "$$MONO_BRANCH" -o -z "$$MONO_BUILD_REVISION"; then \
1062                         echo "#define FULL_VERSION \"tarball\""; \
1063                 else \
1064                         echo "#define FULL_VERSION \"$$MONO_BRANCH/$$MONO_BUILD_REVISION\""; \
1065                 fi \
1066         fi > version.h
1068 # Utility target for patching libtool to speed up linking
1069 patch-libtool:
1070         sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
1071         chmod a+x ../../libtool
1073 # Utility target for patching libtool to get rid of the 'ranlib: file <file> has no symbols" warnings
1074 patch-osx-libtool:
1075         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
1076         chmod a+x ../../libtool
1078 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
1079 patch-automake:
1080         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
1082 tags:
1083         etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
1085 if ENABLE_LLVM
1086 llvm_makefile_dep = $(mono_build_root)/llvm/llvm_config.mk
1087 endif
1089 if HAS_EXTENSION_MODULE
1090 else
1091 Makefile.am: Makefile.am.in
1092         echo "##################### Generated from Makefile.am.in, do not modify ##########################" > $@
1093         cat $< >> $@
1095 endif
1097 # Per-library because linking doesn't like -xc++, it treats libraries as C++.
1098 CFLAGS := $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@)