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); 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
279 monow_LDADD = $(mono_boehm_LDADD)
280 monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
281 monow_SOURCES = $(mono_boehm_SOURCES)
288 ../metadata/opcodes.c
290 # Don't link this against libmonoruntime to speed up rebuilds
292 $(monodir)/mono/utils/libmonoutils.la -lm \
389 local-propagation.c \
403 mini-generic-sharing.c \
434 devirtualization.cs \
438 generics-variant-types.il\
444 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
446 test_sources += nacl.cs
451 arch_sources = $(x86_sources)
457 arch_sources = $(amd64_sources)
458 arch_built=cpu-amd64.h
459 arch_define=__x86_64__
463 arch_sources = $(ppc_sources)
469 arch_sources = $(ppc_sources)
470 arch_built=cpu-ppc64.h
471 arch_define=__ppc64__
475 arch_sources = $(mips_sources)
476 arch_built=cpu-mips.h
481 # pick up arm_dpimacros.h
482 ARCH_CFLAGS = -I../arch/arm
483 arch_sources = $(arm_sources)
489 arch_sources = $(sparc_sources)
490 arch_built=cpu-sparc.h
491 arch_define=__sparc__
495 arch_sources = $(sparc_sources)
496 arch_built=cpu-sparc.h
497 arch_define=__sparc__
501 arch_sources = $(s390x_sources)
502 arch_built=cpu-s390x.h
507 arch_sources = $(ia64_sources)
508 arch_built = cpu-ia64.h
513 os_sources = $(windows_sources)
514 monobin_platform_ldflags=
518 os_sources = $(posix_sources)
519 monobin_platform_ldflags=
523 os_sources = $(darwin_sources) $(posix_sources)
524 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
525 monobin_platform_ldflags=-framework CoreFoundation
528 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
529 libmini_la_CFLAGS = $(mono_CFLAGS)
531 libmonoboehm_2_0_la_SOURCES =
532 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
533 libmonoboehm_2_0_la_LIBADD = libmini.la $(libs) $(LIBMONO_DTRACE_OBJECT)
534 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
536 libmonosgen_2_0_la_SOURCES =
537 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
538 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
539 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
542 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
543 # compile time dependencies on boehm/sgen.
545 libmini_static_la_SOURCES = $(libmini_la_SOURCES)
546 libmini_static_la_CFLAGS = $(AM_CFLAGS)
547 libmini_static_la_LDFLAGS = -static
548 libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
550 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
552 libmonoinclude_HEADERS = jit.h
554 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
556 basic-simd.exe: basic-simd.cs TestDriver.dll
557 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
559 nacl.exe: nacl.cs TestDriver.dll
560 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
562 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
563 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll
565 %.exe: %.cs TestDriver.dll
566 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
568 iltests.il: iltests.il.in Makefile.am
569 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
570 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
573 $(ILASM) -output=$@ $<
575 TestDriver.dll: $(srcdir)/TestDriver.cs
576 $(MCS) -out:$@ -target:library $<
578 generics-variant-types.dll: generics-variant-types.il
579 $(ILASM) -dll -output=$@ $<
587 # we don't always use the perl impl because it's an additional
588 # build dependency for the poor windows users
589 # $(arch_define) is the preprocessor symbol that enables all the opcodes
590 # for the specific platform in mini-ops.h
592 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
593 else !CROSS_COMPILING
595 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
597 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
599 endif !CROSS_COMPILING
601 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
602 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
604 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
605 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
607 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
608 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
610 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
611 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
613 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
614 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
616 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
617 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
619 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
620 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
622 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
623 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
625 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
626 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
629 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
631 # ensure the tests are actually correct
632 checktests: $(regtests)
633 for i in $(regtests); do $(RUNTIME) $$i; done
635 rcheck: mono $(regtests)
637 for i in $(regtests); do echo "running test $$i"; $(RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
639 $(RUNTIME) --regression $(regtests)
642 gctest: mono gc-test.exe
643 MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(RUNTIME) --regression gc-test.exe
645 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
646 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
648 aotcheck: mono $(regtests)
649 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
650 $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
651 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
652 rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
655 $(MAKE) aotcheck LLVM=1
658 $(MAKE) fullaotcheck GSHAREDVT=1
660 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
662 # This currently only works on amd64/arm
663 fullaotcheck: mono $(fullaot_regtests)
666 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/
667 cp $(fullaot_regtests) fullaot-tmp/
668 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
669 ln -s $$PWD/mono fullaot-tmp/
670 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
673 $(MAKE) fullaotcheck LLVM=1
676 MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe
679 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
682 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
684 stat1: mono bench.exe
685 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
686 perl viewstat.pl stats.pl
688 stat2: mono basic.exe
689 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
690 perl viewstat.pl -e stats.pl
692 stat3: mono bench.exe
693 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
694 perl viewstat.pl stats.pl
702 rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe
704 pkgconfigdir = $(libdir)/pkgconfig
707 BUILT_SOURCES = version.h $(arch_built)
709 BUILT_SOURCES = version.h
712 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
713 EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
716 $(x86_sources) cpu-x86.md \
717 $(amd64_sources) cpu-amd64.md \
718 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
719 $(arm_sources) cpu-arm.md \
720 $(mips_sources) cpu-mips.md \
721 $(sparc_sources) cpu-sparc.md \
722 $(s390x_sources) cpu-s390x.md \
723 $(ia64_sources) cpu-ia64.md \
725 $(darwin_sources) Info.plist \
730 if test -d $(top_srcdir)/.git; then \
732 LANG=C; export LANG; \
733 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
734 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
735 echo "#define FULL_VERSION \"$$branch/$$version\""; \
738 echo "#define FULL_VERSION \"tarball\""; \
741 # Utility target for patching libtool to speed up linking
743 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
744 chmod a+x ../../libtool
746 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
748 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
751 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
753 if HAS_EXTENSION_MODULE
755 Makefile.am: Makefile.am.in