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)
29 $(monodir)/mono/metadata/libmonoruntimemoon.la \
30 $(monodir)/mono/io-layer/libwapi.la \
31 $(monodir)/mono/utils/libmonoutils.la \
32 $(GLIB_LIBS) $(LIBICONV)
36 $(monodir)/mono/metadata/libmonoruntime-static.la \
37 $(monodir)/mono/io-layer/libwapi.la \
38 $(monodir)/mono/utils/libmonoutils.la \
39 $(GLIB_LIBS) $(LIBICONV) \
43 $(monodir)/mono/metadata/libmonoruntimesgen-static.la \
44 $(monodir)/mono/io-layer/libwapi.la \
45 $(monodir)/mono/utils/libmonoutils.la \
46 $(GLIB_LIBS) $(LIBICONV)
48 CLASS=$(mcs_topdir)/class/lib/net_4_5
50 RUNTIME_EXECUTABLE = $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/runtime/mono-wrapper)
52 RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
53 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(RUNTIME_EXECUTABLE)
55 MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162
56 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
62 $(PLATFORM_CFLAGS) $(ARCH_CFLAGS)
64 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
68 # The mingw math.h has "extern inline" functions that dont appear in libs, so
69 # optimisation is required to actually inline them
73 # hack for automake to have the same source file in a library and a bin
74 genmdesc_CFLAGS = $(AM_CFLAGS)
77 monoldflags=$(export_ldflags)
78 monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
80 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
81 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags) $(extra_runtime_ldflags)
85 libmonoboehm_2_0_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
86 libmonosgen_2_0_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
88 libmonoboehm_2_0_la_LDFLAGS=$(monoldflags) -version-info 1:0:0
89 libmonosgen_2_0_la_LDFLAGS=$(monoldflags) -version-info 1:0:0
95 sgen_binaries = mono-sgen
96 sgen_libraries = libmonosgen-2.0.la
97 sgen_static_libraries = libmini-static.la $(sgenstatic_libs)
101 boehm_libraries = libmonoboehm-2.0.la
102 boehm_static_libraries = libmini-static.la $(static_libs)
103 boehm_binaries = mono-boehm
106 #The mono uses sgen, while libmono remains boehm
107 mono_bin_suffix = sgen
108 libmono_suffix = boehm
110 mono: mono-$(mono_bin_suffix)
114 ln -sf $(DESTDIR)$(bindir)/mono-$(libmono_suffix) $(DESTDIR)$(bindir)/mono
115 (cd $(DESTDIR)$(libdir); for i in libmono$(libmono_suffix)*; do ln -sf $$i `echo $$i | sed s/$(libmono_suffix)//` ; done)
118 if DISABLE_EXECUTABLES
121 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
123 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
127 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 noinst_LTLIBRARIES += libmono-moon.la
153 moon-do-build: $(BUILT_SOURCES) mono libmono-moon.la
154 moon-do-clean: maintainer-clean-generic
155 -test -z "mono$(EXEEXT)" || rm -f mono$(EXEEXT)
156 -test -z "libmono-moon.la" || rm -f libmono-moon.la
160 lib_LTLIBRARIES += libmono-llvm.la
161 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
162 libmono_llvm_la_LIBADD = $(LLVM_LIBS) $(LLVM_LDFLAGS)
164 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
166 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmono-$(API_VER).la $(libs)
172 mono_boehm_SOURCES = \
175 mono_CFLAGS = $(AM_CFLAGS)
177 mono_boehm_CFLAGS = $(AM_CFLAGS)
179 AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
181 mono_sgen_SOURCES = \
184 mono_sgen_CFLAGS = $(AM_CFLAGS)
186 # We build this after libmono was built so it contains the date when the final
189 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la
190 @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
191 mono_boehm-main.$(OBJEXT): buildver-boehm.h
194 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la
195 @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
196 mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h
199 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
201 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
207 LIBMONO_DTRACE_OBJECT =
211 # Link libmono into mono statically
212 # This leads to higher performance, especially with TLS
213 MONO_LIB=$(boehm_static_libraries)
214 MONO_SGEN_LIB=$(sgen_static_libraries)
216 MONO_LIB=libmonoboehm-2.0.la
217 MONO_LIBLIB=libmonosgen-2.0.la
223 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
232 $(MONO_DTRACE_OBJECT)
234 mono_boehm_LDFLAGS = \
235 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
243 $(MONO_DTRACE_OBJECT)
245 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
249 # mono_LDADD = $(mono_sgen_LDADD)
250 # mono_LDFLAGS = $(mono_sgen_LDFLAGS)
257 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
258 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
259 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
261 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
262 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
263 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
267 # 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)
278 ../metadata/opcodes.c
280 # Don't link this against libmonoruntime to speed up rebuilds
282 $(monodir)/mono/utils/libmonoutils.la -lm \
379 local-propagation.c \
394 mini-generic-sharing.c \
426 devirtualization.cs \
430 generics-variant-types.il\
436 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
438 test_sources += nacl.cs
443 if MONO_DEBUGGER_SUPPORTED
445 mdb_x86 = mdb-debug-info32-darwin.s
447 mdb_x86 = mdb-debug-info32.s
452 arch_sources = $(x86_sources) $(mdb_x86)
458 if MONO_DEBUGGER_SUPPORTED
459 arch_sources = $(amd64_sources) mdb-debug-info64.s
461 arch_sources = $(amd64_sources)
463 arch_built=cpu-amd64.h
464 arch_define=__x86_64__
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 = $(sparc_sources)
495 arch_built=cpu-sparc.h
496 arch_define=__sparc__
500 arch_sources = $(sparc_sources)
501 arch_built=cpu-sparc.h
502 arch_define=__sparc__
506 arch_sources = $(s390x_sources)
507 arch_built=cpu-s390x.h
512 arch_sources = $(ia64_sources)
513 arch_built = cpu-ia64.h
518 os_sources = $(windows_sources)
519 monobin_platform_ldflags=
523 os_sources = $(posix_sources)
524 monobin_platform_ldflags=
528 os_sources = $(darwin_sources) $(posix_sources)
529 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
530 monobin_platform_ldflags=-framework CoreFoundation
533 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
534 libmini_la_CFLAGS = $(mono_CFLAGS)
536 libmonoboehm_2_0_la_SOURCES =
537 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
538 libmonoboehm_2_0_la_LIBADD = libmini.la $(libs) $(LIBMONO_DTRACE_OBJECT)
539 libmonoboehm_2_0_la_LDFLAGS = $(monoldflags)
541 libmonosgen_2_0_la_SOURCES =
542 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
543 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
544 libmonosgen_2_0_la_LDFLAGS = $(monoldflags)
547 # libmono_2_0_la_SOURCES =
548 # libmono_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
549 # libmono_2_0_la_LIBADD = libmonosgen-2.0.la libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
554 libmonosgen_2_0_la_LDFLAGS = -avoid-version
558 libmono_moon_la_SOURCES = $(libmini_la_SOURCES)
560 libmono_moon_la_CFLAGS = $(mono_CFLAGS) $(MOONLIGHT_DEFINES)
561 libmono_moon_la_LIBADD = $(moon_libs) $(libgc_libs) $(LIBMONO_DTRACE_OBJECT)
563 libmono_moon_la_CFLAGS = $(mono_sgen_CFLAGS) $(MOONLIGHT_DEFINES)
564 libmono_moon_la_LIBADD = $(moon_libs) $(LIBMONO_DTRACE_OBJECT)
569 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
570 # compile time dependencies on boehm/sgen.
572 libmini_static_la_SOURCES = $(libmini_la_SOURCES)
573 libmini_static_la_CFLAGS = $(AM_CFLAGS)
574 libmini_static_la_LDFLAGS = -static
575 libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
577 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
579 libmonoinclude_HEADERS = jit.h
581 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
583 basic-simd.exe: basic-simd.cs TestDriver.dll
584 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
586 nacl.exe: nacl.cs TestDriver.dll
587 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
589 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
590 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll
592 %.exe: %.cs TestDriver.dll
593 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
595 iltests.il: iltests.il.in Makefile.am
596 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
597 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
600 $(ILASM) -output=$@ $<
602 TestDriver.dll: $(srcdir)/TestDriver.cs
603 $(MCS) -out:$@ -target:library $<
605 generics-variant-types.dll: generics-variant-types.il
606 $(ILASM) -dll -output=$@ $<
614 # we don't always use the perl impl because it's an additional
615 # build dependency for the poor windows users
616 # $(arch_define) is the preprocessor symbol that enables all the opcodes
617 # for the specific platform in mini-ops.h
619 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
620 else !CROSS_COMPILING
622 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
624 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
626 endif !CROSS_COMPILING
628 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
629 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
631 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
632 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
634 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
635 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
637 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
638 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
640 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
641 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
643 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
644 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
646 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
647 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
649 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
650 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
652 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
653 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
656 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
658 # ensure the tests are actually correct
659 checktests: $(regtests)
660 for i in $(regtests); do $(RUNTIME) $$i; done
662 rcheck: mono $(regtests)
664 for i in $(regtests); do echo "running test $$i"; $(RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
666 $(RUNTIME) --regression $(regtests)
669 gctest: mono gc-test.exe
670 MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(RUNTIME) --regression gc-test.exe
672 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
673 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
675 aotcheck: mono $(regtests)
676 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
677 $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
678 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
679 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
682 $(MAKE) aotcheck LLVM=1
685 $(MAKE) fullaotcheck GSHAREDVT=1
687 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
689 # This currently only works on amd64/arm
690 fullaotcheck: mono $(fullaot_regtests)
693 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/
694 cp $(fullaot_regtests) fullaot-tmp/
695 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
696 ln -s $$PWD/mono fullaot-tmp/
697 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
700 $(MAKE) fullaotcheck LLVM=1
703 MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe
706 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
709 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
711 stat1: mono bench.exe
712 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
713 perl viewstat.pl stats.pl
715 stat2: mono basic.exe
716 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
717 perl viewstat.pl -e stats.pl
719 stat3: mono bench.exe
720 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
721 perl viewstat.pl stats.pl
729 rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe
731 pkgconfigdir = $(libdir)/pkgconfig
734 BUILT_SOURCES = version.h $(arch_built) mono
736 BUILT_SOURCES = version.h mono
739 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
740 EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
743 $(x86_sources) cpu-x86.md \
744 $(amd64_sources) cpu-amd64.md \
745 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
746 $(arm_sources) cpu-arm.md \
747 $(mips_sources) cpu-mips.md \
748 $(sparc_sources) cpu-sparc.md \
749 $(s390x_sources) cpu-s390x.md \
750 $(ia64_sources) cpu-ia64.md \
752 $(darwin_sources) Info.plist \
757 if test -d $(top_srcdir)/.git; then \
759 LANG=C; export LANG; \
760 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
761 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
762 echo "#define FULL_VERSION \"$$branch/$$version\""; \
765 echo "#define FULL_VERSION \"tarball\""; \
768 # Utility target for patching libtool to speed up linking
770 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",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"`