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 \
22 $(monodir)/mono/metadata/libmonoruntimesgen.la \
23 $(monodir)/mono/io-layer/libwapi.la \
24 $(monodir)/mono/utils/libmonoutils.la \
29 $(monodir)/mono/metadata/libmonoruntimemoon.la \
30 $(monodir)/mono/io-layer/libwapi.la \
31 $(monodir)/mono/utils/libmonoutils.la \
36 $(monodir)/mono/metadata/libmonoruntime-static.la \
37 $(monodir)/mono/io-layer/libwapi.la \
38 $(monodir)/mono/utils/libmonoutils.la \
43 $(monodir)/mono/metadata/libmonoruntimesgen-static.la \
44 $(monodir)/mono/io-layer/libwapi.la \
45 $(monodir)/mono/utils/libmonoutils.la \
48 CLASS=$(mcs_topdir)/class/lib/net_4_0
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 = libmonosgen-static.la
99 bin_PROGRAMS = mono monow
101 bin_PROGRAMS = mono $(sgen_binaries)
104 noinst_PROGRAMS = genmdesc
107 shared_libraries = libmono-2.0.la $(sgen_libraries)
110 lib_LTLIBRARIES = $(shared_libraries)
111 noinst_LTLIBRARIES = libmono-static.la $(sgen_static_libraries)
114 noinst_LTLIBRARIES += libmono-moon.la
115 moon-do-build: $(BUILT_SOURCES) mono libmono-moon.la
116 moon-do-clean: maintainer-clean-generic
117 -test -z "mono$(EXEEXT)" || rm -f mono$(EXEEXT)
118 -test -z "libmono-moon.la" || rm -f libmono-moon.la
122 lib_LTLIBRARIES += libmono-llvm.la
123 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
124 libmono_llvm_la_LIBADD = $(LLVM_LIBS) $(LLVM_LDFLAGS)
126 libmono_llvm_la_LDFLAGS=-undefined suppress
128 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmono-$(API_VER).la $(libs)
137 mono_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
139 mono_sgen_SOURCES = $(mono_SOURCES)
140 mono_sgen_CFLAGS = $(SGEN_DEFINES) $(AM_CFLAGS)
142 # We build this after libmono was built so it contains the date when the final
144 buildver.h: libmono-static.la
145 @echo "const char *build_date = \"`date`\";" > buildver.h
147 mono-main.$(OBJEXT): buildver.h
148 mono_sgen-main.$(OBJEXT): buildver.h
151 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
153 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
159 LIBMONO_DTRACE_OBJECT =
163 # Link libmono into mono statically
164 # This leads to higher performance, especially with TLS
165 MONO_LIB=libmono-static.la
166 MONO_SGEN_LIB=libmonosgen-static.la
168 MONO_LIB=libmono-2.0.la
169 MONO_SGEN_LIB=libmonosgen-2.0.la
175 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
183 $(MONO_DTRACE_OBJECT)
186 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
193 $(MONO_DTRACE_OBJECT)
195 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
199 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
200 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
201 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
203 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
204 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
205 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
209 # Create monow.exe, linked for the 'windows' subsystem
211 monow_LDADD = $(mono_LDADD)
212 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
213 monow_SOURCES = $(mono_SOURCES)
220 ../metadata/opcodes.c
222 # Don't link this against libmonoruntime to speed up rebuilds
224 $(monodir)/mono/utils/libmonoutils.la -lm \
338 local-propagation.c \
353 mini-generic-sharing.c \
385 devirtualization.cs \
389 generics-variant-types.il\
392 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
395 if MONO_DEBUGGER_SUPPORTED
397 mdb_x86 = mdb-debug-info32-darwin.s
399 mdb_x86 = mdb-debug-info32.s
404 arch_sources = $(x86_sources) $(mdb_x86)
410 if MONO_DEBUGGER_SUPPORTED
411 arch_sources = $(amd64_sources) mdb-debug-info64.s
413 arch_sources = $(amd64_sources)
415 arch_built=cpu-amd64.h
416 arch_define=__x86_64__
420 arch_sources = $(ppc_sources)
426 arch_sources = $(ppc_sources)
427 arch_built=cpu-ppc64.h
428 arch_define=__ppc64__
432 arch_sources = $(mips_sources)
433 arch_built=cpu-mips.h
438 # pick up arm_dpimacros.h and arm_fpamacros.h
439 ARCH_CFLAGS = -I../arch/arm
440 arch_sources = $(arm_sources)
446 arch_sources = $(sparc_sources)
447 arch_built=cpu-sparc.h
448 arch_define=__sparc__
452 arch_sources = $(sparc_sources)
453 arch_built=cpu-sparc.h
454 arch_define=__sparc__
458 arch_sources = $(s390_sources)
459 arch_built=cpu-s390.h
464 arch_sources = $(s390x_sources)
465 arch_built=cpu-s390x.h
470 arch_sources = $(ia64_sources)
471 arch_built = cpu-ia64.h
476 arch_sources = $(alpha_sources) $(mono_debugger_sources)
477 arch_built = cpu-alpha.h
478 arch_define=__alpha__
482 # Only support 32-bit targets for now
483 arch_sources = $(hppa_sources)
484 arch_built = cpu-hppa.h
489 os_sources = $(windows_sources)
490 monobin_platform_ldflags=
494 os_sources = $(posix_sources)
495 monobin_platform_ldflags=
499 os_sources = $(darwin_sources) $(posix_sources)
500 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
501 monobin_platform_ldflags=-framework CoreFoundation
504 libmono_2_0_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
505 libmono_2_0_la_CFLAGS = $(mono_CFLAGS)
506 libmono_2_0_la_LIBADD = $(libs) $(LIBMONO_DTRACE_OBJECT)
508 libmonosgen_2_0_la_SOURCES = $(libmono_2_0_la_SOURCES)
509 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
510 libmonosgen_2_0_la_LIBADD = $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
513 libmono_moon_la_SOURCES = $(libmono_2_0_la_SOURCES)
515 libmono_moon_la_CFLAGS = $(mono_CFLAGS) $(MOONLIGHT_DEFINES)
516 libmono_moon_la_LIBADD = $(moon_libs) $(libgc_libs) $(LIBMONO_DTRACE_OBJECT)
518 libmono_moon_la_CFLAGS = $(mono_sgen_CFLAGS) $(MOONLIGHT_DEFINES)
519 libmono_moon_la_LIBADD = $(moon_libs) $(LIBMONO_DTRACE_OBJECT)
523 libmono_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
524 libmono_static_la_CFLAGS = $(mono_CFLAGS)
525 libmono_static_la_LDFLAGS = -static
526 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
528 libmonosgen_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
529 libmonosgen_static_la_CFLAGS = $(mono_sgen_CFLAGS)
530 libmonosgen_static_la_LDFLAGS = -static
531 libmonosgen_static_la_LIBADD = $(sgenstatic_libs) $(MONO_DTRACE_OBJECT)
533 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
534 nodist_libmono_static_la_CFLAGS = $(mono_CFLAGS)
536 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
538 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
540 libmonoinclude_HEADERS = jit.h
542 basic-simd.exe: basic-simd.cs
543 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
546 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
548 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
549 $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
551 %.exe: %.cs TestDriver.dll
552 $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
554 iltests.il: iltests.il.in Makefile.am
555 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
556 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
559 $(ILASM) -output=$@ $<
561 TestDriver.dll: $(srcdir)/TestDriver.cs
562 $(MCS) -out:$@ -target:library $<
564 generics-variant-types.dll: generics-variant-types.il
565 $(ILASM) -dll -output=$@ $<
573 # we don't always use the perl impl because it's an additional
574 # build dependency for the poor windows users
575 # $(arch_define) is the preprocessor symbol that enables all the opcodes
576 # for the specific platform in mini-ops.h
578 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
579 else !CROSS_COMPILING
580 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
581 endif !CROSS_COMPILING
583 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
584 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
586 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
587 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
589 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
590 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
592 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
593 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
595 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
596 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
598 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
599 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
601 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
602 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
604 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
605 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
607 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
608 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
610 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
611 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
613 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
614 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
616 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
617 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
620 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
622 # ensure the tests are actually correct
623 checktests: $(regtests)
624 for i in $(regtests); do $(RUNTIME) $$i; done
626 rcheck: mono $(regtests)
627 $(RUNTIME) --regression $(regtests)
629 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
631 aotcheck: mono $(regtests)
633 $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
634 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
638 $(MAKE) aotcheck LLVM=1
640 # This currently only works on amd64/arm
641 fullaotcheck: mono $(regtests)
644 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/
645 cp $(regtests) fullaot-tmp/
646 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
647 for i in $(regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' || exit 1; done
650 $(MAKE) fullaotcheck LLVM=1
653 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
656 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
658 stat1: mono bench.exe
659 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
660 perl viewstat.pl stats.pl
662 stat2: mono basic.exe
663 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
664 perl viewstat.pl -e stats.pl
666 stat3: mono bench.exe
667 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
668 perl viewstat.pl stats.pl
676 rm -f mono a.out gmon.out *.o buildver.h test.exe
678 pkgconfigdir = $(libdir)/pkgconfig
681 BUILT_SOURCES = version.h $(arch_built)
683 BUILT_SOURCES = version.h
686 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
687 EXTRA_DIST = $(common_BURGSRC) TestDriver.cs ldscript ldscript.mono \
690 $(x86_sources) cpu-x86.md \
691 $(amd64_sources) cpu-amd64.md \
692 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
693 $(arm_sources) cpu-arm.md \
694 $(mips_sources) cpu-mips.md \
695 $(sparc_sources) cpu-sparc.md \
696 $(s390_sources) cpu-s390.md \
697 $(s390x_sources) cpu-s390x.md \
698 $(ia64_sources) cpu-ia64.md \
699 $(alpha_sources) cpu-alpha.md \
700 $(hppa_sources) cpu-hppa.md \
702 $(darwin_sources) Info.plist \
706 if test -d $(top_srcdir)/.git; then \
708 LANG=C; export LANG; \
709 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
710 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
711 echo "#define FULL_VERSION \"$$branch/$$version\""; \
714 echo "#define FULL_VERSION \"tarball\""; \
717 # Utility target for patching libtool to speed up linking
719 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
720 chmod a+x ../../libtool
723 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`