3 monodir=$(top_builddir)
5 # This is needed for automake dependency generation
6 libgc_libs=$(monodir)/libgc/libmonogc.la
7 libgc_static_libs=$(monodir)/libgc/libmonogc-static.la
10 $(monodir)/mono/metadata/libmonoruntime.la \
11 $(monodir)/mono/io-layer/libwapi.la \
12 $(monodir)/mono/utils/libmonoutils.la \
13 $(GLIB_LIBS) $(LIBICONV) \
17 $(monodir)/mono/metadata/libmonoruntimesgen.la \
18 $(monodir)/mono/sgen/libmonosgen.la \
19 $(monodir)/mono/io-layer/libwapi.la \
20 $(monodir)/mono/utils/libmonoutils.la \
21 $(GLIB_LIBS) $(LIBICONV)
24 $(monodir)/mono/metadata/libmonoruntime-static.la \
25 $(monodir)/mono/io-layer/libwapi.la \
26 $(monodir)/mono/utils/libmonoutils.la \
27 $(GLIB_LIBS) $(LIBICONV) \
31 $(monodir)/mono/metadata/libmonoruntimesgen-static.la \
32 $(monodir)/mono/sgen/libmonosgen-static.la \
33 $(monodir)/mono/io-layer/libwapi.la \
34 $(monodir)/mono/utils/libmonoutils.la \
35 $(GLIB_LIBS) $(LIBICONV)
37 CLASS=$(mcs_topdir)/class/lib/net_4_5
39 RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_builddir)/runtime/mono-wrapper)
41 RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
42 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(RUNTIME_EXECUTABLE)
44 MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162
45 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
51 $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS)
53 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
57 # The mingw math.h has "extern inline" functions that dont appear in libs, so
58 # optimisation is required to actually inline them
62 # hack for automake to have the same source file in a library and a bin
63 genmdesc_CFLAGS = $(AM_CFLAGS)
65 monoldflags=$(export_ldflags)
66 monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
69 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
72 libmonoldflags= -avoid-version $(monoldflags)
74 libmonoldflags=$(monoldflags) -version-info 1:0:0
79 sgen_binaries = mono-sgen
80 sgen_libraries = libmonosgen-2.0.la
81 sgen_static_libraries = libmini-static.la $(sgenstatic_libs)
85 boehm_libraries = libmonoboehm-2.0.la
86 boehm_static_libraries = libmini-static.la $(static_libs)
87 boehm_binaries = mono-boehm
90 #The mono uses sgen, while libmono remains boehm
92 mono_bin_suffix = sgen
94 mono_bin_suffix = boehm
96 libmono_suffix = boehm
98 if DISABLE_EXECUTABLES
100 mono: mono-$(mono_bin_suffix)
103 mono.exe: mono-$(mono_bin_suffix).exe
107 (cd $(DESTDIR)$(bindir) && ln -sf mono-$(mono_bin_suffix) mono)
108 (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)
111 if DISABLE_EXECUTABLES
114 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
116 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
120 if DISABLE_EXECUTABLES
121 noinst_PROGRAMS = genmdesc
123 noinst_PROGRAMS = genmdesc mono
126 if DISABLE_EXECUTABLES
127 shared_libraries = $(boehm_libraries) $(sgen_libraries)
130 shared_libraries = $(boehm_libraries) $(sgen_libraries)
134 lib_LTLIBRARIES = $(shared_libraries)
137 mini_common_lib = libmini.la
142 if DISABLE_EXECUTABLES
143 noinst_LTLIBRARIES = $(mini_common_lib)
145 noinst_LTLIBRARIES = $(mini_common_lib) libmini-static.la
149 lib_LTLIBRARIES += libmono-llvm.la
150 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
151 libmono_llvm_la_LIBADD = $(GLIB_LIBS) $(LLVM_LIBS) $(LLVM_LDFLAGS)
153 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
155 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmonoboehm-$(API_VER).la $(libs)
159 mono_boehm_SOURCES = \
162 mono_CFLAGS = $(AM_CFLAGS)
164 mono_boehm_CFLAGS = $(AM_CFLAGS)
166 AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
168 mono_sgen_SOURCES = \
174 mono_sgen_CFLAGS = $(AM_CFLAGS)
176 # We build this after libmono was built so it contains the date when the final
179 if DISABLE_EXECUTABLES
180 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime.la
182 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la
184 @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
185 mono_boehm-main.$(OBJEXT): buildver-boehm.h
188 if DISABLE_EXECUTABLES
189 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la
191 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la $(monodir)/mono/sgen/libmonosgen-static.la
193 @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
194 mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h
195 main-sgen.$(OBJEXT): buildver-sgen.h
198 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
200 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
206 LIBMONO_DTRACE_OBJECT =
210 # Link libmono into mono statically
211 # This leads to higher performance, especially with TLS
212 MONO_LIB=$(boehm_static_libraries)
213 MONO_SGEN_LIB=$(sgen_static_libraries)
215 MONO_LIB=libmonoboehm-2.0.la
216 MONO_SGEN_LIB=libmonosgen-2.0.la
222 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
231 $(MONO_DTRACE_OBJECT)
233 mono_boehm_LDFLAGS = \
234 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
242 $(MONO_DTRACE_OBJECT)
244 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
248 # mono_LDADD = $(mono_sgen_LDADD)
249 # mono_LDFLAGS = $(mono_sgen_LDFLAGS)
256 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
257 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
258 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
260 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
261 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
262 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
266 # Create monow.exe, linked for the 'windows' subsystem
269 monow_LDADD = $(mono_boehm_LDADD)
270 monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
271 monow_SOURCES = $(mono_boehm_SOURCES)
273 monow_LDADD = $(mono_sgen_LDADD)
274 monow_LDFLAGS = $(mono_sgen_LDFLAGS) -mwindows
275 monow_SOURCES = $(mono_sgen_SOURCES)
284 ../metadata/opcodes.c
286 # Don't link this against libmonoruntime to speed up rebuilds
288 $(monodir)/mono/utils/libmonoutils.la -lm \
394 local-propagation.c \
405 mini-generic-sharing.c \
410 mini-native-types.c \
436 devirtualization.cs \
440 generics-variant-types.il\
446 regtests=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe
448 test_sources += nacl.cs
453 arch_sources = $(x86_sources)
459 arch_sources = $(amd64_sources)
460 arch_built=cpu-amd64.h
461 arch_define=__x86_64__
462 ARCH_FULLAOT_EXCLUDE=--exclude DYNCALL --exclude GSHAREDVT
466 arch_sources = $(ppc_sources)
472 arch_sources = $(ppc_sources)
473 arch_built=cpu-ppc64.h
474 arch_define=__ppc64__
478 arch_sources = $(mips_sources)
479 arch_built=cpu-mips.h
484 # pick up arm_dpimacros.h
485 ARCH_CFLAGS = -I../arch/arm
486 arch_sources = $(arm_sources)
492 arch_sources = $(arm64_sources)
493 arch_built=cpu-arm64.h
494 arch_define=__aarch64__
498 arch_sources = $(sparc_sources)
499 arch_built=cpu-sparc.h
500 arch_define=__sparc__
504 arch_sources = $(sparc_sources)
505 arch_built=cpu-sparc.h
506 arch_define=__sparc__
510 arch_sources = $(s390x_sources)
511 arch_built=cpu-s390x.h
516 arch_sources = $(ia64_sources)
517 arch_built = cpu-ia64.h
522 os_sources = $(windows_sources)
523 monobin_platform_ldflags=
527 os_sources = $(posix_sources)
528 monobin_platform_ldflags=
532 os_sources = $(darwin_sources) $(posix_sources)
533 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
534 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
537 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
538 libmini_la_CFLAGS = $(mono_CFLAGS)
540 libmonoboehm_2_0_la_SOURCES =
541 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
542 libmonoboehm_2_0_la_LIBADD = libmini.la $(libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
543 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
545 libmonosgen_2_0_la_SOURCES =
546 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
547 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
548 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
551 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
552 # compile time dependencies on boehm/sgen.
554 libmini_static_la_SOURCES = $(libmini_la_SOURCES)
555 libmini_static_la_CFLAGS = $(AM_CFLAGS)
556 libmini_static_la_LDFLAGS = -static
557 libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
559 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
561 libmonoinclude_HEADERS = jit.h
563 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
565 basic-simd.exe: basic-simd.cs TestDriver.dll
566 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
568 nacl.exe: nacl.cs TestDriver.dll
569 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
571 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
572 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll
574 %.exe: %.cs TestDriver.dll
575 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
577 iltests.il: iltests.il.in Makefile.am
578 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
579 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
582 $(ILASM) -output=$@ $<
584 TestDriver.dll: $(srcdir)/TestDriver.cs
585 $(MCS) -out:$@ -target:library $<
587 generics-variant-types.dll: generics-variant-types.il
588 $(ILASM) -dll -output=$@ $<
596 # we don't always use the perl impl because it's an additional
597 # build dependency for the poor windows users
598 # $(arch_define) is the preprocessor symbol that enables all the opcodes
599 # for the specific platform in mini-ops.h
601 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
602 else !CROSS_COMPILING
604 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
606 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
608 endif !CROSS_COMPILING
610 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
611 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
613 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
614 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
616 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
617 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
619 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
620 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
622 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
623 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
625 cpu-arm64.h: cpu-arm64.md genmdesc$(EXEEXT)
626 $(GENMDESC_PRG) cpu-arm64.h arm64_cpu_desc $(srcdir)/cpu-arm64.md
628 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
629 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
631 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
632 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
634 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
635 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
637 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
638 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
641 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
643 # ensure the tests are actually correct
644 checktests: $(regtests)
645 for i in $(regtests); do $(RUNTIME) $$i; done
647 rcheck: mono $(regtests)
649 for i in $(regtests); do echo "running test $$i"; $(RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
651 -($(RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | $(srcdir)/emitnunit.pl
652 exit $$(cat regressionexitcode.out)
655 rcheck2: mono $(regtests)
656 $(RUNTIME) --regression $(regtests)
658 check-seq-points: mono $(regtests)
659 rm -f TestResults_op_il_seq_point.xml
660 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
661 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
662 $(srcdir)/test_op_il_seq_point_headerfooter.sh
664 gctest: mono gc-test.exe
665 MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(RUNTIME) --regression gc-test.exe
667 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
668 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
670 aotcheck: mono $(regtests)
671 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
672 $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
673 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
674 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
677 $(MAKE) aotcheck LLVM=1
680 $(MAKE) fullaotcheck GSHAREDVT=1
682 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
684 # This currently only works on amd64/arm
685 fullaotcheck: mono $(fullaot_regtests)
688 cp $(CLASS)/mscorlib.dll $(CLASS)/System.Core.dll $(CLASS)/System.dll $(CLASS)/Mono.Posix.dll $(CLASS)/System.Configuration.dll $(CLASS)/System.Security.dll $(CLASS)/System.Xml.dll $(CLASS)/Mono.Security.dll $(CLASS)/Mono.Simd.dll $(regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
689 cp $(fullaot_regtests) fullaot-tmp/
690 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
691 ln -s $$PWD/mono fullaot-tmp/
692 for i in $(fullaot_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
695 $(MAKE) fullaotcheck LLVM=1
698 MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe
701 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
704 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
706 stat1: mono bench.exe
707 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
708 perl viewstat.pl stats.pl
710 stat2: mono basic.exe
711 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
712 perl viewstat.pl -e stats.pl
714 stat3: mono bench.exe
715 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
716 perl viewstat.pl stats.pl
721 check-local: rcheck check-seq-points
724 rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResults_op_il_seq_point.xml*
726 pkgconfigdir = $(libdir)/pkgconfig
728 BUILT_SOURCES = version.h $(arch_built)
730 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
731 EXTRA_DIST = TestDriver.cs \
735 $(x86_sources) cpu-x86.md \
736 $(amd64_sources) cpu-amd64.md \
737 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
738 $(arm_sources) cpu-arm.md \
739 $(arm64_sources) cpu-arm64.md \
740 $(mips_sources) cpu-mips.md \
741 $(sparc_sources) cpu-sparc.md \
742 $(s390x_sources) cpu-s390x.md \
743 $(ia64_sources) cpu-ia64.md \
745 $(darwin_sources) Info.plist \
747 test_op_il_seq_point.sh \
748 test_op_il_seq_point_headerfooter.sh \
752 if test -d $(top_srcdir)/.git; then \
754 LANG=C; export LANG; \
755 branch=`git branch | grep '^\*' | sed 's/(detached from .*/explicit/' | cut -d ' ' -f 2`; \
756 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
757 echo "#define FULL_VERSION \"$$branch/$$version\""; \
760 echo "#define FULL_VERSION \"tarball\""; \
763 # Utility target for patching libtool to speed up linking
765 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
766 chmod a+x ../../libtool
768 # Utility target for patching libtool to get rid of the 'ranlib: file <file> has no symbols" warnings
770 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
771 chmod a+x ../../libtool
773 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
775 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
778 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
780 if HAS_EXTENSION_MODULE
782 Makefile.am: Makefile.am.in