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 \
28 $(monodir)/mono/metadata/libmonoruntime-static.la \
29 $(monodir)/mono/io-layer/libwapi.la \
30 $(monodir)/mono/utils/libmonoutils.la \
35 $(monodir)/mono/metadata/libmonoruntimesgen-static.la \
36 $(monodir)/mono/io-layer/libwapi.la \
37 $(monodir)/mono/utils/libmonoutils.la \
40 CLASS=$(mcs_topdir)/class/lib/net_2_0
42 RUNTIME_EXECUTABLE = $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/runtime/mono-wrapper)
44 RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
45 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(RUNTIME_EXECUTABLE)
47 MCS = $(RUNTIME) $(CLASS)/gmcs.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)
72 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
73 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
77 libmono_2_0_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
79 libmono_2_0_la_LDFLAGS=$(monoldflags) -version-info 1:0:0
85 sgen_binaries = mono-sgen
86 sgen_libraries = libmonosgen-2.0.la
87 sgen_static_libraries = libmonosgen-static.la
91 bin_PROGRAMS = mono monow
93 bin_PROGRAMS = mono $(sgen_binaries)
96 noinst_PROGRAMS = genmdesc
98 lib_LTLIBRARIES = libmono-2.0.la $(sgen_libraries)
99 noinst_LTLIBRARIES = libmono-static.la $(sgen_static_libraries)
102 noinst_LTLIBRARIES += libmono-moon.la
110 mono_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
112 mono_sgen_SOURCES = $(mono_SOURCES)
113 mono_sgen_CFLAGS = $(SGEN_DEFINES) $(AM_CFLAGS)
115 # We build this after libmono was built so it contains the date when the final
117 buildver.h: libmono-static.la
118 @echo "const char *build_date = \"`date`\";" > buildver.h
120 mono-main.$(OBJEXT): buildver.h
121 mono-sgen-main.$(OBJEXT): buildver.h
124 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
126 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
132 LIBMONO_DTRACE_OBJECT =
136 # Link libmono into mono statically
137 # This leads to higher performance, especially with TLS
138 MONO_LIB=libmono-static.la
139 MONO_SGEN_LIB=libmonosgen-static.la
141 MONO_LIB=libmono-2.0.la
142 MONO_SGEN_LIB=libmonosgen-2.0.la
150 $(MONO_DTRACE_OBJECT) \
154 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
161 $(MONO_DTRACE_OBJECT) \
164 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
168 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
169 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
170 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
172 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
173 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
174 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
178 # Create monow.exe, linked for the 'windows' subsystem
180 monow_LDADD = $(mono_LDADD)
181 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
182 monow_SOURCES = $(mono_SOURCES)
189 ../metadata/opcodes.c
191 # Don't link this against libmonoruntime to speed up rebuilds
193 $(monodir)/mono/utils/libmonoutils.la -lm \
303 local-propagation.c \
318 mini-generic-sharing.c \
348 devirtualization.cs \
352 generics-variant-types.il\
355 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
359 mdb_x86 = mdb-debug-info32-darwin.s
361 mdb_x86 = mdb-debug-info32.s
363 arch_sources = $(x86_sources) $(mdb_x86)
369 arch_sources = $(amd64_sources) mdb-debug-info64.s
370 arch_built=cpu-amd64.h
371 arch_define=__x86_64__
375 arch_sources = $(ppc_sources)
381 arch_sources = $(ppc_sources)
382 arch_built=cpu-ppc64.h
383 arch_define=__ppc64__
387 arch_sources = $(mips_sources)
388 arch_built=cpu-mips.h
393 # pick up arm_dpimacros.h and arm_fpamacros.h
394 ARCH_CFLAGS = -I../arch/arm
395 arch_sources = $(arm_sources)
401 arch_sources = $(sparc_sources)
402 arch_built=cpu-sparc.h
403 arch_define=__sparc__
407 arch_sources = $(sparc_sources)
408 arch_built=cpu-sparc.h
409 arch_define=__sparc__
413 arch_sources = $(s390_sources)
414 arch_built=cpu-s390.h
419 arch_sources = $(s390x_sources)
420 arch_built=cpu-s390x.h
425 arch_sources = $(ia64_sources)
426 arch_built = cpu-ia64.h
431 arch_sources = $(alpha_sources) $(mono_debugger_sources)
432 arch_built = cpu-alpha.h
433 arch_define=__alpha__
437 # Only support 32-bit targets for now
438 arch_sources = $(hppa_sources)
439 arch_built = cpu-hppa.h
444 os_sources = $(windows_sources)
445 monobin_platform_ldflags=
449 os_sources = $(posix_sources)
450 monobin_platform_ldflags=
454 os_sources = $(darwin_sources) $(posix_sources)
455 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
456 monobin_platform_ldflags=-framework CoreFoundation
459 libmono_2_0_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
460 libmono_2_0_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
462 libmonosgen_2_0_la_SOURCES = $(libmono_2_0_la_SOURCES)
463 libmonosgen_2_0_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
466 libmono_moon_la_SOURCES = $(libmono_2_0_la_SOURCES)
467 libmono_moon_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
470 libmono_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
471 libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
472 libmono_static_la_LDFLAGS = -static
473 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
475 libmonosgen_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
476 libmonosgen_static_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
477 libmonosgen_static_la_LDFLAGS = -static
478 libmonosgen_static_la_LIBADD = $(sgenstatic_libs) $(MONO_DTRACE_OBJECT)
480 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
481 nodist_libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
483 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
485 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
487 libmonoinclude_HEADERS = jit.h
489 libmono_2_0_la_LIBADD = \
490 $(libs) $(LIBMONO_DTRACE_OBJECT)
492 libmonosgen_2_0_la_LIBADD = \
493 $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
496 libmono_moon_la_LIBADD = $(libmono_2_0_la_LIBADD)
499 basic-simd.exe: basic-simd.cs
500 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
502 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
503 $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
505 %.exe: %.cs TestDriver.dll
506 $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
508 iltests.il: iltests.il.in Makefile.am
509 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
510 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
513 $(ILASM) -output=$@ $<
515 TestDriver.dll: $(srcdir)/TestDriver.cs
516 $(MCS) -out:$@ -target:library $<
518 generics-variant-types.dll: generics-variant-types.il
519 $(ILASM) -dll -output=$@ $<
521 # we don't always use the perl impl because it's an additional
522 # build dependency for the poor windows users
523 # $(arch_define) is the preprocessor symbol that enables all the opcodes
524 # for the specific platform in mini-ops.h
526 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir)
527 else !CROSS_COMPILING
528 GENMDESC_PRG=./genmdesc
529 endif !CROSS_COMPILING
531 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
532 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
534 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
535 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
537 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
538 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
540 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
541 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
543 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
544 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
546 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
547 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
549 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
550 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
552 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
553 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
555 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
556 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
558 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
559 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
561 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
562 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
564 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
565 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
568 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
570 # ensure the tests are actually correct
571 checktests: $(regtests)
572 for i in $(regtests); do $(RUNTIME) $$i; done
574 rcheck: mono $(regtests)
575 $(RUNTIME) --regression $(regtests)
577 aotcheck: mono $(regtests)
579 $(RUNTIME) --aot $(regtests) || exit 1
580 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
583 # This currently only works on amd64/arm
584 fullaotcheck: mono $(regtests)
587 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/
588 cp $(regtests) fullaot-tmp/
589 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --aot=full fullaot-tmp/* || exit 1
590 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
593 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
596 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
598 stat1: mono bench.exe
599 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
600 perl viewstat.pl stats.pl
602 stat2: mono basic.exe
603 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
604 perl viewstat.pl -e stats.pl
606 stat3: mono bench.exe
607 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
608 perl viewstat.pl stats.pl
616 rm -f mono a.out gmon.out *.o buildver.h test.exe
618 pkgconfigdir = $(libdir)/pkgconfig
621 BUILT_SOURCES = version.h $(arch_built)
623 BUILT_SOURCES = version.h
626 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
627 EXTRA_DIST = $(common_BURGSRC) TestDriver.cs ldscript ldscript.mono \
630 $(x86_sources) cpu-x86.md \
631 $(amd64_sources) cpu-amd64.md \
632 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
633 $(arm_sources) cpu-arm.md \
634 $(mips_sources) cpu-mips.md \
635 $(sparc_sources) cpu-sparc.md \
636 $(s390_sources) cpu-s390.md \
637 $(s390x_sources) cpu-s390x.md \
638 $(ia64_sources) cpu-ia64.md \
639 $(alpha_sources) cpu-alpha.md \
640 $(hppa_sources) cpu-hppa.md \
642 $(darwin_sources) Info.plist \
646 if test -d $(top_srcdir)/.git; then svn_info="git log --no-color --first-parent -n1 --grep=git-svn-id: --pretty=format:%b | sed -n -e 's,git-svn-id: \(.*\)@\(.*\) .*,URL: \1 Revision: \2,p'"; fi; \
647 if test -d $(srcdir)/.svn; then svn_info='svn info'; fi; \
648 if test -n "$$svn_info"; then \
650 LANG=C; export LANG; \
651 branch=`eval $$svn_info | sed -n -e '/URL/ s,.*source/\(.*\)/mono.*,/\1/mono,p'`; \
652 version=`eval $$svn_info | sed -n -e '/Revision/ s/.*: //p'`; \
653 echo "#define FULL_VERSION \"$$branch r$$version\""; \
656 echo "#define FULL_VERSION \"tarball\""; \
659 # Utility target for patching libtool to speed up linking
661 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
662 chmod a+x ../../libtool
665 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`