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 = libmonosgen-static.la
99 boehm_libraries = libmono-2.0.la
100 boehm_binaries = mono
104 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
106 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
109 noinst_PROGRAMS = genmdesc
112 shared_libraries = $(boehm_libraries) $(sgen_libraries)
115 lib_LTLIBRARIES = $(shared_libraries)
116 noinst_LTLIBRARIES = libmono-static.la $(sgen_static_libraries)
119 noinst_LTLIBRARIES += libmono-moon.la
120 moon-do-build: $(BUILT_SOURCES) mono libmono-moon.la
121 moon-do-clean: maintainer-clean-generic
122 -test -z "mono$(EXEEXT)" || rm -f mono$(EXEEXT)
123 -test -z "libmono-moon.la" || rm -f libmono-moon.la
127 lib_LTLIBRARIES += libmono-llvm.la
128 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
129 libmono_llvm_la_LIBADD = $(LLVM_LIBS) $(LLVM_LDFLAGS)
131 libmono_llvm_la_LDFLAGS=-undefined suppress
133 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmono-$(API_VER).la $(libs)
142 mono_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
144 mono_sgen_SOURCES = $(mono_SOURCES)
145 mono_sgen_CFLAGS = $(SGEN_DEFINES) $(AM_CFLAGS)
147 # We build this after libmono was built so it contains the date when the final
149 buildver.h: libmono-static.la
150 @echo "const char *build_date = \"`date`\";" > buildver.h
152 mono-main.$(OBJEXT): buildver.h
153 mono_sgen-main.$(OBJEXT): buildver.h
156 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
158 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
164 LIBMONO_DTRACE_OBJECT =
168 # Link libmono into mono statically
169 # This leads to higher performance, especially with TLS
170 MONO_LIB=libmono-static.la
171 MONO_SGEN_LIB=libmonosgen-static.la
173 MONO_LIB=libmono-2.0.la
174 MONO_SGEN_LIB=libmonosgen-2.0.la
180 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
189 $(MONO_DTRACE_OBJECT)
192 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
200 $(MONO_DTRACE_OBJECT)
202 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
206 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
207 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
208 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
210 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
211 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
212 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
216 # Create monow.exe, linked for the 'windows' subsystem
218 monow_LDADD = $(mono_LDADD)
219 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
220 monow_SOURCES = $(mono_SOURCES)
227 ../metadata/opcodes.c
229 # Don't link this against libmonoruntime to speed up rebuilds
231 $(monodir)/mono/utils/libmonoutils.la -lm \
346 local-propagation.c \
361 mini-generic-sharing.c \
393 devirtualization.cs \
397 generics-variant-types.il\
401 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
404 if MONO_DEBUGGER_SUPPORTED
406 mdb_x86 = mdb-debug-info32-darwin.s
408 mdb_x86 = mdb-debug-info32.s
413 arch_sources = $(x86_sources) $(mdb_x86)
419 if MONO_DEBUGGER_SUPPORTED
420 arch_sources = $(amd64_sources) mdb-debug-info64.s
422 arch_sources = $(amd64_sources)
424 arch_built=cpu-amd64.h
425 arch_define=__x86_64__
429 arch_sources = $(ppc_sources)
435 arch_sources = $(ppc_sources)
436 arch_built=cpu-ppc64.h
437 arch_define=__ppc64__
441 arch_sources = $(mips_sources)
442 arch_built=cpu-mips.h
447 # pick up arm_dpimacros.h and arm_fpamacros.h
448 ARCH_CFLAGS = -I../arch/arm
449 arch_sources = $(arm_sources)
455 arch_sources = $(sparc_sources)
456 arch_built=cpu-sparc.h
457 arch_define=__sparc__
461 arch_sources = $(sparc_sources)
462 arch_built=cpu-sparc.h
463 arch_define=__sparc__
467 arch_sources = $(s390_sources)
468 arch_built=cpu-s390.h
473 arch_sources = $(s390x_sources)
474 arch_built=cpu-s390x.h
479 arch_sources = $(ia64_sources)
480 arch_built = cpu-ia64.h
485 arch_sources = $(alpha_sources) $(mono_debugger_sources)
486 arch_built = cpu-alpha.h
487 arch_define=__alpha__
491 # Only support 32-bit targets for now
492 arch_sources = $(hppa_sources)
493 arch_built = cpu-hppa.h
498 os_sources = $(windows_sources)
499 monobin_platform_ldflags=
503 os_sources = $(posix_sources)
504 monobin_platform_ldflags=
508 os_sources = $(darwin_sources) $(posix_sources)
509 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
510 monobin_platform_ldflags=-framework CoreFoundation
513 libmono_2_0_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
514 libmono_2_0_la_CFLAGS = $(mono_CFLAGS)
515 libmono_2_0_la_LIBADD = $(libs) $(LIBMONO_DTRACE_OBJECT)
517 libmonosgen_2_0_la_SOURCES = $(libmono_2_0_la_SOURCES)
518 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
519 libmonosgen_2_0_la_LIBADD = $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
522 libmono_moon_la_SOURCES = $(libmono_2_0_la_SOURCES)
524 libmono_moon_la_CFLAGS = $(mono_CFLAGS) $(MOONLIGHT_DEFINES)
525 libmono_moon_la_LIBADD = $(moon_libs) $(libgc_libs) $(LIBMONO_DTRACE_OBJECT)
527 libmono_moon_la_CFLAGS = $(mono_sgen_CFLAGS) $(MOONLIGHT_DEFINES)
528 libmono_moon_la_LIBADD = $(moon_libs) $(LIBMONO_DTRACE_OBJECT)
532 libmono_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
533 libmono_static_la_CFLAGS = $(mono_CFLAGS)
534 libmono_static_la_LDFLAGS = -static
535 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
537 libmonosgen_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
538 libmonosgen_static_la_CFLAGS = $(mono_sgen_CFLAGS)
539 libmonosgen_static_la_LDFLAGS = -static
540 libmonosgen_static_la_LIBADD = $(sgenstatic_libs) $(MONO_DTRACE_OBJECT)
542 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
543 nodist_libmono_static_la_CFLAGS = $(mono_CFLAGS)
545 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
547 libmonoinclude_HEADERS = jit.h
549 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
551 basic-simd.exe: basic-simd.cs
552 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
555 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
557 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
558 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll
560 %.exe: %.cs TestDriver.dll
561 $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
563 iltests.il: iltests.il.in Makefile.am
564 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
565 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
568 $(ILASM) -output=$@ $<
570 TestDriver.dll: $(srcdir)/TestDriver.cs
571 $(MCS) -out:$@ -target:library $<
573 generics-variant-types.dll: generics-variant-types.il
574 $(ILASM) -dll -output=$@ $<
582 # we don't always use the perl impl because it's an additional
583 # build dependency for the poor windows users
584 # $(arch_define) is the preprocessor symbol that enables all the opcodes
585 # for the specific platform in mini-ops.h
587 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
588 else !CROSS_COMPILING
589 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
590 endif !CROSS_COMPILING
592 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
593 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
595 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
596 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
598 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
599 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
601 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
602 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
604 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
605 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
607 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
608 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
610 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
611 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
613 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
614 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
616 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
617 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
619 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
620 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
622 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
623 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.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)
636 $(RUNTIME) --regression $(regtests)
638 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
640 aotcheck: mono $(regtests)
642 $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
643 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
647 $(MAKE) aotcheck LLVM=1
649 fullaot_regtests = $(regtests) aot-tests.exe
651 # This currently only works on amd64/arm
652 fullaotcheck: mono $(fullaot_regtests)
655 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/
656 cp $(fullaot_regtests) fullaot-tmp/
657 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
658 ln -s $$PWD/mono fullaot-tmp/
659 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
662 $(MAKE) fullaotcheck LLVM=1
665 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
668 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
670 stat1: mono bench.exe
671 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
672 perl viewstat.pl stats.pl
674 stat2: mono basic.exe
675 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
676 perl viewstat.pl -e stats.pl
678 stat3: mono bench.exe
679 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
680 perl viewstat.pl stats.pl
688 rm -f mono a.out gmon.out *.o buildver.h test.exe
690 pkgconfigdir = $(libdir)/pkgconfig
693 BUILT_SOURCES = version.h $(arch_built)
695 BUILT_SOURCES = version.h
698 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
699 EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
702 $(x86_sources) cpu-x86.md \
703 $(amd64_sources) cpu-amd64.md \
704 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
705 $(arm_sources) cpu-arm.md \
706 $(mips_sources) cpu-mips.md \
707 $(sparc_sources) cpu-sparc.md \
708 $(s390_sources) cpu-s390.md \
709 $(s390x_sources) cpu-s390x.md \
710 $(ia64_sources) cpu-ia64.md \
711 $(alpha_sources) cpu-alpha.md \
712 $(hppa_sources) cpu-hppa.md \
714 $(darwin_sources) Info.plist \
718 if test -d $(top_srcdir)/.git; then \
720 LANG=C; export LANG; \
721 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
722 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
723 echo "#define FULL_VERSION \"$$branch/$$version\""; \
726 echo "#define FULL_VERSION \"tarball\""; \
729 # Utility target for patching libtool to speed up linking
731 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
732 chmod a+x ../../libtool
735 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`