3 monodir=$(top_builddir)
5 # This is needed for automake dependency generation
7 libgc_libs=$(monodir)/libgc/libmonogc.la
8 libgc_static_libs=$(monodir)/libgc/libmonogc-static.la
10 libgc_libs=$(LIBGC_LIBS)
11 libgc_static_libs=$(LIBGC_STATIC_LIBS)
15 $(monodir)/mono/metadata/libmonoruntime.la \
16 $(monodir)/mono/io-layer/libwapi.la \
17 $(monodir)/mono/utils/libmonoutils.la \
18 $(GLIB_LIBS) $(LIBICONV) \
22 $(monodir)/mono/metadata/libmonoruntimesgen.la \
23 $(monodir)/mono/io-layer/libwapi.la \
24 $(monodir)/mono/utils/libmonoutils.la \
25 $(GLIB_LIBS) $(LIBICONV)
28 $(monodir)/mono/metadata/libmonoruntime-static.la \
29 $(monodir)/mono/io-layer/libwapi.la \
30 $(monodir)/mono/utils/libmonoutils.la \
31 $(GLIB_LIBS) $(LIBICONV) \
35 $(monodir)/mono/metadata/libmonoruntimesgen-static.la \
36 $(monodir)/mono/io-layer/libwapi.la \
37 $(monodir)/mono/utils/libmonoutils.la \
38 $(GLIB_LIBS) $(LIBICONV)
40 CLASS=$(mcs_topdir)/class/lib/net_4_5
42 RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_builddir)/runtime/mono-wrapper)
44 RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
45 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(RUNTIME_EXECUTABLE)
47 MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162
48 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
54 $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS)
56 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
60 # The mingw math.h has "extern inline" functions that dont appear in libs, so
61 # optimisation is required to actually inline them
65 # hack for automake to have the same source file in a library and a bin
66 genmdesc_CFLAGS = $(AM_CFLAGS)
68 monoldflags=$(export_ldflags)
69 monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
72 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
75 libmonoldflags= -avoid-version $(monoldflags)
77 libmonoldflags=$(monoldflags) -version-info 1:0:0
82 sgen_binaries = mono-sgen
83 sgen_libraries = libmonosgen-2.0.la
84 sgen_static_libraries = libmini-static.la $(sgenstatic_libs)
88 boehm_libraries = libmonoboehm-2.0.la
89 boehm_static_libraries = libmini-static.la $(static_libs)
90 boehm_binaries = mono-boehm
93 #The mono uses sgen, while libmono remains boehm
95 mono_bin_suffix = sgen
97 mono_bin_suffix = boehm
99 libmono_suffix = boehm
101 if DISABLE_EXECUTABLES
103 mono: mono-$(mono_bin_suffix)
106 mono.exe: mono-$(mono_bin_suffix).exe
110 (cd $(DESTDIR)$(bindir) && ln -sf mono-$(mono_bin_suffix) mono)
111 (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)
114 if DISABLE_EXECUTABLES
117 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
119 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
123 if DISABLE_EXECUTABLES
124 noinst_PROGRAMS = genmdesc
126 noinst_PROGRAMS = genmdesc mono
129 if DISABLE_EXECUTABLES
130 shared_libraries = $(boehm_libraries) $(sgen_libraries)
133 shared_libraries = $(boehm_libraries) $(sgen_libraries)
137 lib_LTLIBRARIES = $(shared_libraries)
140 mini_common_lib = libmini.la
145 if DISABLE_EXECUTABLES
146 noinst_LTLIBRARIES = $(mini_common_lib)
148 noinst_LTLIBRARIES = $(mini_common_lib) libmini-static.la
152 lib_LTLIBRARIES += libmono-llvm.la
153 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
154 libmono_llvm_la_LIBADD = $(GLIB_LIBS) $(LLVM_LIBS) $(LLVM_LDFLAGS)
156 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
158 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmonoboehm-$(API_VER).la $(libs)
162 mono_boehm_SOURCES = \
165 mono_CFLAGS = $(AM_CFLAGS)
167 mono_boehm_CFLAGS = $(AM_CFLAGS)
169 AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
171 mono_sgen_SOURCES = \
177 mono_sgen_CFLAGS = $(AM_CFLAGS)
179 # We build this after libmono was built so it contains the date when the final
182 if DISABLE_EXECUTABLES
183 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime.la
185 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la
187 @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
188 mono_boehm-main.$(OBJEXT): buildver-boehm.h
191 if DISABLE_EXECUTABLES
192 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen.la
194 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la
196 @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
197 mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h
198 main-sgen.$(OBJEXT): buildver-sgen.h
201 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
203 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
209 LIBMONO_DTRACE_OBJECT =
213 # Link libmono into mono statically
214 # This leads to higher performance, especially with TLS
215 MONO_LIB=$(boehm_static_libraries)
216 MONO_SGEN_LIB=$(sgen_static_libraries)
218 MONO_LIB=libmonoboehm-2.0.la
219 MONO_SGEN_LIB=libmonosgen-2.0.la
225 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
234 $(MONO_DTRACE_OBJECT)
236 mono_boehm_LDFLAGS = \
237 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
245 $(MONO_DTRACE_OBJECT)
247 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
251 # mono_LDADD = $(mono_sgen_LDADD)
252 # mono_LDFLAGS = $(mono_sgen_LDFLAGS)
259 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
260 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
261 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
263 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
264 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
265 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
269 # Create monow.exe, linked for the 'windows' subsystem
272 monow_LDADD = $(mono_boehm_LDADD)
273 monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
274 monow_SOURCES = $(mono_boehm_SOURCES)
276 monow_LDADD = $(mono_sgen_LDADD)
277 monow_LDFLAGS = $(mono_sgen_LDFLAGS) -mwindows
278 monow_SOURCES = $(mono_sgen_SOURCES)
287 ../metadata/opcodes.c
289 # Don't link this against libmonoruntime to speed up rebuilds
291 $(monodir)/mono/utils/libmonoutils.la -lm \
400 local-propagation.c \
414 mini-generic-sharing.c \
420 mini-native-types.c \
446 devirtualization.cs \
450 generics-variant-types.il\
456 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
458 test_sources += nacl.cs
463 arch_sources = $(x86_sources)
469 arch_sources = $(amd64_sources)
470 arch_built=cpu-amd64.h
471 arch_define=__x86_64__
472 ARCH_FULLAOT_EXCLUDE=--exclude DYNCALL --exclude GSHAREDVT
476 arch_sources = $(ppc_sources)
482 arch_sources = $(ppc_sources)
483 arch_built=cpu-ppc64.h
484 arch_define=__ppc64__
488 arch_sources = $(mips_sources)
489 arch_built=cpu-mips.h
494 # pick up arm_dpimacros.h
495 ARCH_CFLAGS = -I../arch/arm
496 arch_sources = $(arm_sources)
502 arch_sources = $(arm64_sources)
503 arch_built=cpu-arm64.h
504 arch_define=__aarch64__
508 arch_sources = $(sparc_sources)
509 arch_built=cpu-sparc.h
510 arch_define=__sparc__
514 arch_sources = $(sparc_sources)
515 arch_built=cpu-sparc.h
516 arch_define=__sparc__
520 arch_sources = $(s390x_sources)
521 arch_built=cpu-s390x.h
526 arch_sources = $(ia64_sources)
527 arch_built = cpu-ia64.h
532 os_sources = $(windows_sources)
533 monobin_platform_ldflags=
537 os_sources = $(posix_sources)
538 monobin_platform_ldflags=
542 os_sources = $(darwin_sources) $(posix_sources)
543 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
544 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
547 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
548 libmini_la_CFLAGS = $(mono_CFLAGS)
550 libmonoboehm_2_0_la_SOURCES =
551 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
552 libmonoboehm_2_0_la_LIBADD = libmini.la $(libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
553 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
555 libmonosgen_2_0_la_SOURCES =
556 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
557 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
558 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
561 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
562 # compile time dependencies on boehm/sgen.
564 libmini_static_la_SOURCES = $(libmini_la_SOURCES)
565 libmini_static_la_CFLAGS = $(AM_CFLAGS)
566 libmini_static_la_LDFLAGS = -static
567 libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
569 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
571 libmonoinclude_HEADERS = jit.h
573 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
575 basic-simd.exe: basic-simd.cs TestDriver.dll
576 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
578 nacl.exe: nacl.cs TestDriver.dll
579 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
581 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
582 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll
584 %.exe: %.cs TestDriver.dll
585 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
587 iltests.il: iltests.il.in Makefile.am
588 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
589 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
592 $(ILASM) -output=$@ $<
594 TestDriver.dll: $(srcdir)/TestDriver.cs
595 $(MCS) -out:$@ -target:library $<
597 generics-variant-types.dll: generics-variant-types.il
598 $(ILASM) -dll -output=$@ $<
606 # we don't always use the perl impl because it's an additional
607 # build dependency for the poor windows users
608 # $(arch_define) is the preprocessor symbol that enables all the opcodes
609 # for the specific platform in mini-ops.h
611 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
612 else !CROSS_COMPILING
614 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
616 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
618 endif !CROSS_COMPILING
620 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
621 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
623 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
624 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
626 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
627 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
629 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
630 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
632 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
633 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
635 cpu-arm64.h: cpu-arm64.md genmdesc$(EXEEXT)
636 $(GENMDESC_PRG) cpu-arm64.h arm64_cpu_desc $(srcdir)/cpu-arm64.md
638 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
639 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
641 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
642 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
644 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
645 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
647 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
648 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
651 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
653 # ensure the tests are actually correct
654 checktests: $(regtests)
655 for i in $(regtests); do $(RUNTIME) $$i; done
657 rcheck: mono $(regtests)
659 for i in $(regtests); do echo "running test $$i"; $(RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
661 -($(RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | ./emitnunit.pl
662 exit $$(cat regressionexitcode.out)
665 rcheck2: mono $(regtests)
666 $(RUNTIME) --regression $(regtests)
668 check-seq-points: mono $(regtests)
669 rm -f TestResults_op_il_seq_point.xml
670 for i in $(regtests); do ./test_op_il_seq_point.sh $$i || (./test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
671 for i in $(regtests); do ./test_op_il_seq_point.sh $$i --aot || (./test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
672 ./test_op_il_seq_point_headerfooter.sh
674 gctest: mono gc-test.exe
675 MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(RUNTIME) --regression gc-test.exe
677 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
678 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
680 aotcheck: mono $(regtests)
681 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
682 $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
683 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
684 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
687 $(MAKE) aotcheck LLVM=1
690 $(MAKE) fullaotcheck GSHAREDVT=1
692 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
694 # This currently only works on amd64/arm
695 fullaotcheck: mono $(fullaot_regtests)
698 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/
699 cp $(fullaot_regtests) fullaot-tmp/
700 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
701 ln -s $$PWD/mono fullaot-tmp/
702 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
705 $(MAKE) fullaotcheck LLVM=1
708 MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe
711 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
714 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
716 stat1: mono bench.exe
717 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
718 perl viewstat.pl stats.pl
720 stat2: mono basic.exe
721 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
722 perl viewstat.pl -e stats.pl
724 stat3: mono bench.exe
725 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
726 perl viewstat.pl stats.pl
731 check-local: rcheck check-seq-points
734 rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResults_op_il_seq_point.xml*
736 pkgconfigdir = $(libdir)/pkgconfig
738 BUILT_SOURCES = version.h $(arch_built)
740 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
741 EXTRA_DIST = TestDriver.cs \
744 $(x86_sources) cpu-x86.md \
745 $(amd64_sources) cpu-amd64.md \
746 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
747 $(arm_sources) cpu-arm.md \
748 $(arm64_sources) cpu-arm64.md \
749 $(mips_sources) cpu-mips.md \
750 $(sparc_sources) cpu-sparc.md \
751 $(s390x_sources) cpu-s390x.md \
752 $(ia64_sources) cpu-ia64.md \
754 $(darwin_sources) Info.plist \
756 test_op_il_seq_point.sh \
757 test_op_il_seq_point_headerfooter.sh \
761 if test -d $(top_srcdir)/.git; then \
763 LANG=C; export LANG; \
764 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
765 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
766 echo "#define FULL_VERSION \"$$branch/$$version\""; \
769 echo "#define FULL_VERSION \"tarball\""; \
772 # Utility target for patching libtool to speed up linking
774 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
775 chmod a+x ../../libtool
777 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
779 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
782 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
784 if HAS_EXTENSION_MODULE
786 Makefile.am: Makefile.am.in