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/$(DEFAULT_PROFILE)
39 RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_builddir)/runtime/mono-wrapper)
41 MINI_RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
42 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(RUNTIME_EXECUTABLE)
44 MCS = $(MINI_RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162
45 ILASM = $(MINI_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 $(sgen_static_libs)
85 boehm_libraries = libmonoboehm-2.0.la
86 boehm_static_libraries = libmini-static.la $(boehm_static_libs)
87 boehm_binaries = mono-boehm
90 # The mono executable 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 $(boehm_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 \
396 local-propagation.c \
407 mini-generic-sharing.c \
412 mini-native-types.c \
438 devirtualization.cs \
442 generics-variant-types.il\
448 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
450 test_sources += nacl.cs
455 arch_sources = $(x86_sources)
461 arch_sources = $(amd64_sources)
462 arch_built=cpu-amd64.h
463 arch_define=__x86_64__
464 ARCH_FULLAOT_EXCLUDE=--exclude DYNCALL --exclude GSHAREDVT
468 arch_sources = $(ppc_sources)
474 arch_sources = $(ppc_sources)
475 arch_built=cpu-ppc64.h
476 arch_define=__ppc64__
480 arch_sources = $(mips_sources)
481 arch_built=cpu-mips.h
486 # pick up arm_dpimacros.h
487 ARCH_CFLAGS = -I../arch/arm
488 arch_sources = $(arm_sources)
494 arch_sources = $(arm64_sources)
495 arch_built=cpu-arm64.h
496 arch_define=__aarch64__
500 arch_sources = $(sparc_sources)
501 arch_built=cpu-sparc.h
502 arch_define=__sparc__
506 arch_sources = $(sparc_sources)
507 arch_built=cpu-sparc.h
508 arch_define=__sparc__
512 arch_sources = $(s390x_sources)
513 arch_built=cpu-s390x.h
518 arch_sources = $(ia64_sources)
519 arch_built = cpu-ia64.h
524 os_sources = $(windows_sources)
525 monobin_platform_ldflags=
529 os_sources = $(posix_sources)
530 monobin_platform_ldflags=
534 os_sources = $(darwin_sources) $(posix_sources)
535 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
536 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
539 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
540 libmini_la_CFLAGS = $(mono_CFLAGS)
542 libmonoboehm_2_0_la_SOURCES =
543 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
544 libmonoboehm_2_0_la_LIBADD = libmini.la $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
545 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
547 libmonosgen_2_0_la_SOURCES =
548 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
549 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
550 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
553 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
554 # compile time dependencies on boehm/sgen.
556 libmini_static_la_SOURCES = $(libmini_la_SOURCES)
557 libmini_static_la_CFLAGS = $(AM_CFLAGS)
558 libmini_static_la_LDFLAGS = -static
559 libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
561 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
563 libmonoinclude_HEADERS = jit.h
565 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
567 basic-simd.exe: basic-simd.cs TestDriver.dll
568 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
570 nacl.exe: nacl.cs TestDriver.dll
571 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
573 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
574 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll
576 %.exe: %.cs TestDriver.dll
577 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
579 iltests.il: iltests.il.in Makefile.am
580 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
581 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
584 $(ILASM) -output=$@ $<
586 TestDriver.dll: $(srcdir)/TestDriver.cs
587 $(MCS) -out:$@ -target:library $<
589 generics-variant-types.dll: generics-variant-types.il
590 $(ILASM) -dll -output=$@ $<
598 # we don't always use the perl impl because it's an additional
599 # build dependency for the poor windows users
600 # $(arch_define) is the preprocessor symbol that enables all the opcodes
601 # for the specific platform in mini-ops.h
603 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
604 else !CROSS_COMPILING
606 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
608 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
610 endif !CROSS_COMPILING
612 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
613 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
615 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
616 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
618 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
619 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
621 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
622 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
624 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
625 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
627 cpu-arm64.h: cpu-arm64.md genmdesc$(EXEEXT)
628 $(GENMDESC_PRG) cpu-arm64.h arm64_cpu_desc $(srcdir)/cpu-arm64.md
630 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
631 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
633 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
634 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
636 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
637 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
639 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
640 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
643 $(MINI_RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
645 # ensure the tests are actually correct
646 checktests: $(regtests)
647 for i in $(regtests); do $(MINI_RUNTIME) $$i; done
649 rcheck: mono $(regtests)
651 for i in $(regtests); do echo "running test $$i"; $(MINI_RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
653 -($(MINI_RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | $(srcdir)/emitnunit.pl
654 exit $$(cat regressionexitcode.out)
657 rcheck2: mono $(regtests)
658 $(MINI_RUNTIME) --regression $(regtests)
660 check-seq-points: mono $(regtests)
661 rm -f TestResults_op_il_seq_point.xml
662 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
663 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
664 $(srcdir)/test_op_il_seq_point_headerfooter.sh
666 gctest: mono gc-test.exe
667 MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(MINI_RUNTIME) --regression gc-test.exe
669 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
670 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
672 aotcheck: mono $(regtests)
673 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
674 $(MINI_RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
675 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
676 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
679 $(MAKE) aotcheck LLVM=1
682 $(MAKE) fullaotcheck GSHAREDVT=1
684 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
691 System.Configuration.dll \
692 System.Security.dll \
697 # This currently only works on amd64/arm
698 fullaotcheck: mono $(fullaot_regtests)
701 $(MAKE) fullaot-libs AOT_FLAGS=full
702 cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
703 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot=full fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
704 ln -s $$PWD/mono fullaot-tmp/
705 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
707 # This can run in parallel
708 fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
710 fullaot-tmp/%.dylib: $(CLASS)/%
711 cp $(CLASS)/$* fullaot-tmp/
712 mkdir fullaot-tmp/$*-tmp
713 MONO_PATH=fullaot-tmp/:$(CLASS) $(top_builddir)/runtime/mono-wrapper --aot=$(AOT_FLAGS),temp-path=fullaot-tmp/$*-tmp fullaot-tmp/$*
714 rm -rf fullaot-tmp/$*-tmp
717 $(MAKE) fullaotcheck LLVM=1
720 MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe
723 time env $(MINI_RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
726 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
728 stat1: mono bench.exe
729 $(MINI_RUNTIME) --verbose --statfile stats.pl --regression bench.exe
730 perl viewstat.pl stats.pl
732 stat2: mono basic.exe
733 $(MINI_RUNTIME) --verbose --statfile stats.pl --regression basic.exe
734 perl viewstat.pl -e stats.pl
736 stat3: mono bench.exe
737 $(MINI_RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
738 perl viewstat.pl stats.pl
743 check-local: rcheck check-seq-points
746 rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResults_op_il_seq_point.xml*
748 pkgconfigdir = $(libdir)/pkgconfig
750 BUILT_SOURCES = version.h $(arch_built)
752 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
753 EXTRA_DIST = TestDriver.cs \
757 $(x86_sources) cpu-x86.md \
758 $(amd64_sources) cpu-amd64.md \
759 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
760 $(arm_sources) cpu-arm.md \
761 $(arm64_sources) cpu-arm64.md \
762 $(mips_sources) cpu-mips.md \
763 $(sparc_sources) cpu-sparc.md \
764 $(s390x_sources) cpu-s390x.md \
765 $(ia64_sources) cpu-ia64.md \
767 $(darwin_sources) Info.plist \
769 test_op_il_seq_point.sh \
770 test_op_il_seq_point_headerfooter.sh \
774 if test -d $(top_srcdir)/.git; then \
776 LANG=C; export LANG; \
777 branch=`git branch | grep '^\*' | sed 's/(detached from .*/explicit/' | cut -d ' ' -f 2`; \
778 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
779 echo "#define FULL_VERSION \"$$branch/$$version\""; \
782 echo "#define FULL_VERSION \"tarball\""; \
785 # Utility target for patching libtool to speed up linking
787 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
788 chmod a+x ../../libtool
790 # Utility target for patching libtool to get rid of the 'ranlib: file <file> has no symbols" warnings
792 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
793 chmod a+x ../../libtool
795 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
797 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
800 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
802 if HAS_EXTENSION_MODULE
804 Makefile.am: Makefile.am.in