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)
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)
69 monoldflags=$(export_ldflags)
70 monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
72 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
73 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags) $(extra_runtime_ldflags)
77 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
80 libmonoldflags= -avoid-version $(monoldflags)
82 libmonoldflags=$(monoldflags) -version-info 1:0:0
89 sgen_binaries = mono-sgen
90 sgen_libraries = libmonosgen-2.0.la
91 sgen_static_libraries = libmini-static.la $(sgenstatic_libs)
95 boehm_libraries = libmonoboehm-2.0.la
96 boehm_static_libraries = libmini-static.la $(static_libs)
97 boehm_binaries = mono-boehm
100 #The mono uses sgen, while libmono remains boehm
102 mono_bin_suffix = sgen
104 mono_bin_suffix = boehm
106 libmono_suffix = boehm
108 if DISABLE_EXECUTABLES
110 mono: mono-$(mono_bin_suffix)
113 mono.exe: mono-$(mono_bin_suffix).exe
117 (cd $(DESTDIR)$(bindir) && ln -sf mono-$(mono_bin_suffix) mono)
118 (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)
121 if DISABLE_EXECUTABLES
124 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
126 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
130 if DISABLE_EXECUTABLES
131 noinst_PROGRAMS = genmdesc
133 noinst_PROGRAMS = genmdesc mono
136 if DISABLE_EXECUTABLES
137 shared_libraries = $(boehm_libraries) $(sgen_libraries)
140 shared_libraries = $(boehm_libraries) $(sgen_libraries)
144 lib_LTLIBRARIES = $(shared_libraries)
147 mini_common_lib = libmini.la
152 if DISABLE_EXECUTABLES
153 noinst_LTLIBRARIES = $(mini_common_lib)
155 noinst_LTLIBRARIES = $(mini_common_lib) libmini-static.la
159 lib_LTLIBRARIES += libmono-llvm.la
160 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
161 libmono_llvm_la_LIBADD = $(LLVM_LIBS) $(LLVM_LDFLAGS)
163 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
165 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmonoboehm-$(API_VER).la $(libs)
171 mono_boehm_SOURCES = \
174 mono_CFLAGS = $(AM_CFLAGS)
176 mono_boehm_CFLAGS = $(AM_CFLAGS)
178 AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
180 mono_sgen_SOURCES = \
186 mono_sgen_CFLAGS = $(AM_CFLAGS)
188 # We build this after libmono was built so it contains the date when the final
191 if DISABLE_EXECUTABLES
192 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime.la
194 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la
196 @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
197 mono_boehm-main.$(OBJEXT): buildver-boehm.h
200 if DISABLE_EXECUTABLES
201 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen.la
203 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la
205 @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
206 mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h
209 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
211 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
217 LIBMONO_DTRACE_OBJECT =
221 # Link libmono into mono statically
222 # This leads to higher performance, especially with TLS
223 MONO_LIB=$(boehm_static_libraries)
224 MONO_SGEN_LIB=$(sgen_static_libraries)
226 MONO_LIB=libmonoboehm-2.0.la
227 MONO_SGEN_LIB=libmonosgen-2.0.la
233 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
242 $(MONO_DTRACE_OBJECT)
244 mono_boehm_LDFLAGS = \
245 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
253 $(MONO_DTRACE_OBJECT)
255 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
259 # mono_LDADD = $(mono_sgen_LDADD)
260 # mono_LDFLAGS = $(mono_sgen_LDFLAGS)
267 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
268 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
269 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
271 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
272 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
273 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
277 # Create monow.exe, linked for the 'windows' subsystem
280 monow_LDADD = $(mono_boehm_LDADD)
281 monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
282 monow_SOURCES = $(mono_boehm_SOURCES)
284 monow_LDADD = $(mono_sgen_LDADD)
285 monow_LDFLAGS = $(mono_sgen_LDFLAGS) -mwindows
286 monow_SOURCES = $(mono_sgen_SOURCES)
294 ../metadata/opcodes.c
296 # Don't link this against libmonoruntime to speed up rebuilds
298 $(monodir)/mono/utils/libmonoutils.la -lm \
401 local-propagation.c \
415 mini-generic-sharing.c \
421 mini-native-types.c \
448 devirtualization.cs \
452 generics-variant-types.il\
458 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
460 test_sources += nacl.cs
465 arch_sources = $(x86_sources)
471 arch_sources = $(amd64_sources)
472 arch_built=cpu-amd64.h
473 arch_define=__x86_64__
477 arch_sources = $(ppc_sources)
483 arch_sources = $(ppc_sources)
484 arch_built=cpu-ppc64.h
485 arch_define=__ppc64__
489 arch_sources = $(mips_sources)
490 arch_built=cpu-mips.h
495 # pick up arm_dpimacros.h
496 ARCH_CFLAGS = -I../arch/arm
497 arch_sources = $(arm_sources)
503 arch_sources = $(arm64_sources)
504 arch_built=cpu-arm64.h
505 arch_define=__aarch64__
509 arch_sources = $(sparc_sources)
510 arch_built=cpu-sparc.h
511 arch_define=__sparc__
515 arch_sources = $(sparc_sources)
516 arch_built=cpu-sparc.h
517 arch_define=__sparc__
521 arch_sources = $(s390x_sources)
522 arch_built=cpu-s390x.h
527 arch_sources = $(ia64_sources)
528 arch_built = cpu-ia64.h
533 os_sources = $(windows_sources)
534 monobin_platform_ldflags=
538 os_sources = $(posix_sources)
539 monobin_platform_ldflags=
543 os_sources = $(darwin_sources) $(posix_sources)
544 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
545 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
548 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
549 libmini_la_CFLAGS = $(mono_CFLAGS)
551 libmonoboehm_2_0_la_SOURCES =
552 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
553 libmonoboehm_2_0_la_LIBADD = libmini.la $(libs) $(LIBMONO_DTRACE_OBJECT)
554 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
556 libmonosgen_2_0_la_SOURCES =
557 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
558 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
559 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
562 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
563 # compile time dependencies on boehm/sgen.
565 libmini_static_la_SOURCES = $(libmini_la_SOURCES)
566 libmini_static_la_CFLAGS = $(AM_CFLAGS)
567 libmini_static_la_LDFLAGS = -static
568 libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
570 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
572 libmonoinclude_HEADERS = jit.h
574 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
576 basic-simd.exe: basic-simd.cs TestDriver.dll
577 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
579 nacl.exe: nacl.cs TestDriver.dll
580 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
582 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
583 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll
585 %.exe: %.cs TestDriver.dll
586 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
588 iltests.il: iltests.il.in Makefile.am
589 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
590 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
593 $(ILASM) -output=$@ $<
595 TestDriver.dll: $(srcdir)/TestDriver.cs
596 $(MCS) -out:$@ -target:library $<
598 generics-variant-types.dll: generics-variant-types.il
599 $(ILASM) -dll -output=$@ $<
607 # we don't always use the perl impl because it's an additional
608 # build dependency for the poor windows users
609 # $(arch_define) is the preprocessor symbol that enables all the opcodes
610 # for the specific platform in mini-ops.h
612 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
613 else !CROSS_COMPILING
615 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
617 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
619 endif !CROSS_COMPILING
621 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
622 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
624 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
625 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
627 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
628 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
630 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
631 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
633 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
634 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
636 cpu-arm64.h: cpu-arm64.md genmdesc$(EXEEXT)
637 $(GENMDESC_PRG) cpu-arm64.h arm64_cpu_desc $(srcdir)/cpu-arm64.md
639 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
640 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
642 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
643 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
645 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
646 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
648 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
649 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
652 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
654 # ensure the tests are actually correct
655 checktests: $(regtests)
656 for i in $(regtests); do $(RUNTIME) $$i; done
658 rcheck: mono $(regtests)
660 for i in $(regtests); do echo "running test $$i"; $(RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
662 $(RUNTIME) --regression $(regtests)
665 gctest: mono gc-test.exe
666 MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(RUNTIME) --regression gc-test.exe
668 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
669 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
671 aotcheck: mono $(regtests)
672 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
673 $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
674 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
675 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
678 $(MAKE) aotcheck LLVM=1
681 $(MAKE) fullaotcheck GSHAREDVT=1
683 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
685 # This currently only works on amd64/arm
686 fullaotcheck: mono $(fullaot_regtests)
689 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/
690 cp $(fullaot_regtests) fullaot-tmp/
691 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
692 ln -s $$PWD/mono fullaot-tmp/
693 for i in $(fullaot_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' || exit 1; done
696 $(MAKE) fullaotcheck LLVM=1
699 MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe
702 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
705 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
707 stat1: mono bench.exe
708 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
709 perl viewstat.pl stats.pl
711 stat2: mono basic.exe
712 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
713 perl viewstat.pl -e stats.pl
715 stat3: mono bench.exe
716 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
717 perl viewstat.pl stats.pl
725 rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe
727 pkgconfigdir = $(libdir)/pkgconfig
730 BUILT_SOURCES = version.h $(arch_built)
732 BUILT_SOURCES = version.h
735 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
736 EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
739 $(x86_sources) cpu-x86.md \
740 $(amd64_sources) cpu-amd64.md \
741 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
742 $(arm_sources) cpu-arm.md \
743 $(arm64_sources) cpu-arm64.md \
744 $(mips_sources) cpu-mips.md \
745 $(sparc_sources) cpu-sparc.md \
746 $(s390x_sources) cpu-s390x.md \
747 $(ia64_sources) cpu-ia64.md \
749 $(darwin_sources) Info.plist \
754 if test -d $(top_srcdir)/.git; then \
756 LANG=C; export LANG; \
757 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
758 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
759 echo "#define FULL_VERSION \"$$branch/$$version\""; \
762 echo "#define FULL_VERSION \"tarball\""; \
765 # Utility target for patching libtool to speed up linking
767 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
768 chmod a+x ../../libtool
770 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
772 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
775 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
777 if HAS_EXTENSION_MODULE
779 Makefile.am: Makefile.am.in