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)
80 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
81 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
85 libmono_2_0_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
87 libmono_2_0_la_LDFLAGS=$(monoldflags) -version-info 1:0:0
93 sgen_binaries = mono-sgen
94 sgen_libraries = libmonosgen-2.0.la
95 sgen_static_libraries = libmini-static.la $(sgenstatic_libs)
99 boehm_libraries = libmono-2.0.la
100 boehm_static_libraries = libmini-static.la $(static_libs)
101 boehm_binaries = mono
104 if DISABLE_EXECUTABLES
107 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
109 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
113 noinst_PROGRAMS = genmdesc
115 if DISABLE_EXECUTABLES
116 shared_libraries = $(boehm_libraries) $(sgen_libraries)
119 shared_libraries = $(boehm_libraries) $(sgen_libraries)
123 lib_LTLIBRARIES = $(shared_libraries)
126 mini_common_lib = libmini.la
131 if DISABLE_EXECUTABLES
132 noinst_LTLIBRARIES = $(mini_common_lib)
134 noinst_LTLIBRARIES = $(mini_common_lib) libmini-static.la
138 noinst_LTLIBRARIES += libmono-moon.la
139 moon-do-build: $(BUILT_SOURCES) mono libmono-moon.la
140 moon-do-clean: maintainer-clean-generic
141 -test -z "mono$(EXEEXT)" || rm -f mono$(EXEEXT)
142 -test -z "libmono-moon.la" || rm -f libmono-moon.la
146 lib_LTLIBRARIES += libmono-llvm.la
147 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
148 libmono_llvm_la_LIBADD = $(LLVM_LIBS) $(LLVM_LDFLAGS)
150 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
152 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmono-$(API_VER).la $(libs)
161 mono_CFLAGS = $(AM_CFLAGS)
163 AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
165 mono_sgen_SOURCES = $(mono_SOURCES)
166 mono_sgen_CFLAGS = $(AM_CFLAGS)
168 # We build this after libmono was built so it contains the date when the final
171 buildver.h: libmini-static.la
172 @echo "const char *build_date = \"`date`\";" > buildver.h
173 mono-main.$(OBJEXT): buildver.h
176 buildver-sgen.h: libmini-static.la
177 @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
178 mono_sgen-main.$(OBJEXT): buildver-sgen.h
181 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
183 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
189 LIBMONO_DTRACE_OBJECT =
193 # Link libmono into mono statically
194 # This leads to higher performance, especially with TLS
195 MONO_LIB=$(boehm_static_libraries)
196 MONO_SGEN_LIB=$(sgen_static_libraries)
198 MONO_LIB=libmono-2.0.la
199 MONO_SGEN_LIB=libmonosgen-2.0.la
205 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
214 $(MONO_DTRACE_OBJECT)
217 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
225 $(MONO_DTRACE_OBJECT)
227 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
231 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
232 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
233 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
235 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
236 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
237 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
241 # Create monow.exe, linked for the 'windows' subsystem
243 monow_LDADD = $(mono_LDADD)
244 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
245 monow_SOURCES = $(mono_SOURCES)
252 ../metadata/opcodes.c
254 # Don't link this against libmonoruntime to speed up rebuilds
256 $(monodir)/mono/utils/libmonoutils.la -lm \
371 local-propagation.c \
386 mini-generic-sharing.c \
418 devirtualization.cs \
422 generics-variant-types.il\
427 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
430 if MONO_DEBUGGER_SUPPORTED
432 mdb_x86 = mdb-debug-info32-darwin.s
434 mdb_x86 = mdb-debug-info32.s
439 arch_sources = $(x86_sources) $(mdb_x86)
445 if MONO_DEBUGGER_SUPPORTED
446 arch_sources = $(amd64_sources) mdb-debug-info64.s
448 arch_sources = $(amd64_sources)
450 arch_built=cpu-amd64.h
451 arch_define=__x86_64__
455 arch_sources = $(ppc_sources)
461 arch_sources = $(ppc_sources)
462 arch_built=cpu-ppc64.h
463 arch_define=__ppc64__
467 arch_sources = $(mips_sources)
468 arch_built=cpu-mips.h
473 # pick up arm_dpimacros.h and arm_fpamacros.h
474 ARCH_CFLAGS = -I../arch/arm
475 arch_sources = $(arm_sources)
481 arch_sources = $(sparc_sources)
482 arch_built=cpu-sparc.h
483 arch_define=__sparc__
487 arch_sources = $(sparc_sources)
488 arch_built=cpu-sparc.h
489 arch_define=__sparc__
493 arch_sources = $(s390_sources)
494 arch_built=cpu-s390.h
499 arch_sources = $(s390x_sources)
500 arch_built=cpu-s390x.h
505 arch_sources = $(ia64_sources)
506 arch_built = cpu-ia64.h
511 arch_sources = $(alpha_sources) $(mono_debugger_sources)
512 arch_built = cpu-alpha.h
513 arch_define=__alpha__
517 # Only support 32-bit targets for now
518 arch_sources = $(hppa_sources)
519 arch_built = cpu-hppa.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
536 monobin_platform_ldflags=-framework CoreFoundation
539 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
540 libmini_la_CFLAGS = $(mono_CFLAGS)
542 libmono_2_0_la_SOURCES =
543 libmono_2_0_la_CFLAGS = $(mono_CFLAGS)
544 libmono_2_0_la_LIBADD = libmini.la $(libs) $(LIBMONO_DTRACE_OBJECT)
546 libmonosgen_2_0_la_SOURCES =
547 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
548 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
551 libmonosgen_2_0_la_LDFLAGS = -avoid-version
555 libmono_moon_la_SOURCES = $(libmini_la_SOURCES)
557 libmono_moon_la_CFLAGS = $(mono_CFLAGS) $(MOONLIGHT_DEFINES)
558 libmono_moon_la_LIBADD = $(moon_libs) $(libgc_libs) $(LIBMONO_DTRACE_OBJECT)
560 libmono_moon_la_CFLAGS = $(mono_sgen_CFLAGS) $(MOONLIGHT_DEFINES)
561 libmono_moon_la_LIBADD = $(moon_libs) $(LIBMONO_DTRACE_OBJECT)
566 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
567 # compile time dependencies on boehm/sgen.
569 libmini_static_la_SOURCES = $(libmini_la_SOURCES)
570 libmini_static_la_CFLAGS = $(AM_CFLAGS)
571 libmini_static_la_LDFLAGS = -static
572 libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
574 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
576 libmonoinclude_HEADERS = jit.h
578 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
580 basic-simd.exe: basic-simd.cs
581 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
584 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
586 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
587 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll
589 %.exe: %.cs TestDriver.dll
590 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
592 iltests.il: iltests.il.in Makefile.am
593 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
594 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
597 $(ILASM) -output=$@ $<
599 TestDriver.dll: $(srcdir)/TestDriver.cs
600 $(MCS) -out:$@ -target:library $<
602 generics-variant-types.dll: generics-variant-types.il
603 $(ILASM) -dll -output=$@ $<
611 # we don't always use the perl impl because it's an additional
612 # build dependency for the poor windows users
613 # $(arch_define) is the preprocessor symbol that enables all the opcodes
614 # for the specific platform in mini-ops.h
616 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
617 else !CROSS_COMPILING
618 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-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
637 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
639 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
640 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.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-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
649 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
651 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
652 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
654 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
655 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
658 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
660 # ensure the tests are actually correct
661 checktests: $(regtests)
662 for i in $(regtests); do $(RUNTIME) $$i; done
664 rcheck: mono $(regtests)
665 $(RUNTIME) --regression $(regtests)
667 gctest: mono gc-test.exe
668 MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(RUNTIME) --regression gc-test.exe
670 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
672 aotcheck: mono $(regtests)
673 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
674 $(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
681 fullaot_regtests = $(regtests) aot-tests.exe
683 # This currently only works on amd64/arm
684 fullaotcheck: mono $(fullaot_regtests)
687 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/
688 cp $(fullaot_regtests) fullaot-tmp/
689 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
690 ln -s $$PWD/mono fullaot-tmp/
691 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
694 $(MAKE) fullaotcheck LLVM=1
697 MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe
700 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
703 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
705 stat1: mono bench.exe
706 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
707 perl viewstat.pl stats.pl
709 stat2: mono basic.exe
710 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
711 perl viewstat.pl -e stats.pl
713 stat3: mono bench.exe
714 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
715 perl viewstat.pl stats.pl
723 rm -f mono a.out gmon.out *.o buildver.h buildver-sgen.h test.exe
725 pkgconfigdir = $(libdir)/pkgconfig
728 BUILT_SOURCES = version.h $(arch_built)
730 BUILT_SOURCES = version.h
733 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
734 EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
737 $(x86_sources) cpu-x86.md \
738 $(amd64_sources) cpu-amd64.md \
739 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
740 $(arm_sources) cpu-arm.md \
741 $(mips_sources) cpu-mips.md \
742 $(sparc_sources) cpu-sparc.md \
743 $(s390_sources) cpu-s390.md \
744 $(s390x_sources) cpu-s390x.md \
745 $(ia64_sources) cpu-ia64.md \
746 $(alpha_sources) cpu-alpha.md \
747 $(hppa_sources) cpu-hppa.md \
749 $(darwin_sources) Info.plist \
753 if test -d $(top_srcdir)/.git; then \
755 LANG=C; export LANG; \
756 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
757 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
758 echo "#define FULL_VERSION \"$$branch/$$version\""; \
761 echo "#define FULL_VERSION \"tarball\""; \
764 # Utility target for patching libtool to speed up linking
766 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
767 chmod a+x ../../libtool
769 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
771 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
774 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
776 #if HAS_EXTENSION_MODULE
777 #include $(top_srcdir)/../mono-extensions/mono/mini/Makefile.am