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
106 lib_LTLIBRARIES += libmono-llvm.la
107 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
108 libmono_llvm_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la $(LLVM_LIBS) $(LLVM_LDFLAGS) $(libs)
116 mono_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
118 mono_sgen_SOURCES = $(mono_SOURCES)
119 mono_sgen_CFLAGS = $(SGEN_DEFINES) $(AM_CFLAGS)
121 # We build this after libmono was built so it contains the date when the final
123 buildver.h: libmono-static.la
124 @echo "const char *build_date = \"`date`\";" > buildver.h
126 mono-main.$(OBJEXT): buildver.h
127 mono_sgen-main.$(OBJEXT): buildver.h
130 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
132 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
138 LIBMONO_DTRACE_OBJECT =
142 # Link libmono into mono statically
143 # This leads to higher performance, especially with TLS
144 MONO_LIB=libmono-static.la
145 MONO_SGEN_LIB=libmonosgen-static.la
147 MONO_LIB=libmono-2.0.la
148 MONO_SGEN_LIB=libmonosgen-2.0.la
154 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
162 $(MONO_DTRACE_OBJECT)
165 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
172 $(MONO_DTRACE_OBJECT)
174 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
178 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
179 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
180 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
182 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
183 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
184 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
188 # Create monow.exe, linked for the 'windows' subsystem
190 monow_LDADD = $(mono_LDADD)
191 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
192 monow_SOURCES = $(mono_SOURCES)
199 ../metadata/opcodes.c
201 # Don't link this against libmonoruntime to speed up rebuilds
203 $(monodir)/mono/utils/libmonoutils.la -lm \
317 local-propagation.c \
332 mini-generic-sharing.c \
364 devirtualization.cs \
368 generics-variant-types.il\
371 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
374 if MONO_DEBUGGER_SUPPORTED
376 mdb_x86 = mdb-debug-info32-darwin.s
378 mdb_x86 = mdb-debug-info32.s
383 arch_sources = $(x86_sources) $(mdb_x86)
389 if MONO_DEBUGGER_SUPPORTED
390 arch_sources = $(amd64_sources) mdb-debug-info64.s
392 arch_sources = $(amd64_sources)
394 arch_built=cpu-amd64.h
395 arch_define=__x86_64__
399 arch_sources = $(ppc_sources)
405 arch_sources = $(ppc_sources)
406 arch_built=cpu-ppc64.h
407 arch_define=__ppc64__
411 arch_sources = $(mips_sources)
412 arch_built=cpu-mips.h
417 # pick up arm_dpimacros.h and arm_fpamacros.h
418 ARCH_CFLAGS = -I../arch/arm
419 arch_sources = $(arm_sources)
425 arch_sources = $(sparc_sources)
426 arch_built=cpu-sparc.h
427 arch_define=__sparc__
431 arch_sources = $(sparc_sources)
432 arch_built=cpu-sparc.h
433 arch_define=__sparc__
437 arch_sources = $(s390_sources)
438 arch_built=cpu-s390.h
443 arch_sources = $(s390x_sources)
444 arch_built=cpu-s390x.h
449 arch_sources = $(ia64_sources)
450 arch_built = cpu-ia64.h
455 arch_sources = $(alpha_sources) $(mono_debugger_sources)
456 arch_built = cpu-alpha.h
457 arch_define=__alpha__
461 # Only support 32-bit targets for now
462 arch_sources = $(hppa_sources)
463 arch_built = cpu-hppa.h
468 os_sources = $(windows_sources)
469 monobin_platform_ldflags=
473 os_sources = $(posix_sources)
474 monobin_platform_ldflags=
478 os_sources = $(darwin_sources) $(posix_sources)
479 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
480 monobin_platform_ldflags=-framework CoreFoundation
483 libmono_2_0_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
484 libmono_2_0_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
486 libmonosgen_2_0_la_SOURCES = $(libmono_2_0_la_SOURCES)
487 libmonosgen_2_0_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
490 libmono_moon_la_SOURCES = $(libmono_2_0_la_SOURCES)
491 libmono_moon_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
494 libmono_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
495 libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
496 libmono_static_la_LDFLAGS = -static
497 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
499 libmonosgen_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
500 libmonosgen_static_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
501 libmonosgen_static_la_LDFLAGS = -static
502 libmonosgen_static_la_LIBADD = $(sgenstatic_libs) $(MONO_DTRACE_OBJECT)
504 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
505 nodist_libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
507 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
509 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
511 libmonoinclude_HEADERS = jit.h
513 libmono_2_0_la_LIBADD = \
514 $(libs) $(LIBMONO_DTRACE_OBJECT)
516 libmonosgen_2_0_la_LIBADD = \
517 $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
520 libmono_moon_la_LIBADD = $(libmono_2_0_la_LIBADD)
523 basic-simd.exe: basic-simd.cs
524 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
526 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
527 $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
529 %.exe: %.cs TestDriver.dll
530 $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
532 iltests.il: iltests.il.in Makefile.am
533 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
534 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
537 $(ILASM) -output=$@ $<
539 TestDriver.dll: $(srcdir)/TestDriver.cs
540 $(MCS) -out:$@ -target:library $<
542 generics-variant-types.dll: generics-variant-types.il
543 $(ILASM) -dll -output=$@ $<
545 # we don't always use the perl impl because it's an additional
546 # build dependency for the poor windows users
547 # $(arch_define) is the preprocessor symbol that enables all the opcodes
548 # for the specific platform in mini-ops.h
550 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir)
551 else !CROSS_COMPILING
552 GENMDESC_PRG=./genmdesc
553 endif !CROSS_COMPILING
555 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
556 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
558 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
559 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
561 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
562 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
564 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
565 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
567 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
568 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
570 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
571 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
573 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
574 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
576 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
577 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
579 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
580 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
582 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
583 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
585 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
586 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
588 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
589 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
592 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
594 # ensure the tests are actually correct
595 checktests: $(regtests)
596 for i in $(regtests); do $(RUNTIME) $$i; done
598 rcheck: mono $(regtests)
599 $(RUNTIME) --regression $(regtests)
601 aotcheck: mono $(regtests)
603 $(RUNTIME) --aot $(regtests) || exit 1
604 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
607 # This currently only works on amd64/arm
608 fullaotcheck: mono $(regtests)
611 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/
612 cp $(regtests) fullaot-tmp/
613 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --aot=full fullaot-tmp/* || exit 1
614 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
617 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
620 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
622 stat1: mono bench.exe
623 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
624 perl viewstat.pl stats.pl
626 stat2: mono basic.exe
627 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
628 perl viewstat.pl -e stats.pl
630 stat3: mono bench.exe
631 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
632 perl viewstat.pl stats.pl
640 rm -f mono a.out gmon.out *.o buildver.h test.exe
642 pkgconfigdir = $(libdir)/pkgconfig
645 BUILT_SOURCES = version.h $(arch_built)
647 BUILT_SOURCES = version.h
650 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
651 EXTRA_DIST = $(common_BURGSRC) TestDriver.cs ldscript ldscript.mono \
654 $(x86_sources) cpu-x86.md \
655 $(amd64_sources) cpu-amd64.md \
656 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
657 $(arm_sources) cpu-arm.md \
658 $(mips_sources) cpu-mips.md \
659 $(sparc_sources) cpu-sparc.md \
660 $(s390_sources) cpu-s390.md \
661 $(s390x_sources) cpu-s390x.md \
662 $(ia64_sources) cpu-ia64.md \
663 $(alpha_sources) cpu-alpha.md \
664 $(hppa_sources) cpu-hppa.md \
666 $(darwin_sources) Info.plist \
670 if test -d $(top_srcdir)/.git; then \
672 LANG=C; export LANG; \
673 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
674 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
675 echo "#define FULL_VERSION \"$$branch/$$version\""; \
678 echo "#define FULL_VERSION \"tarball\""; \
681 # Utility target for patching libtool to speed up linking
683 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
684 chmod a+x ../../libtool
687 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`