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/libwapisgen.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/libwapisgen.la \
37 $(monodir)/mono/utils/libmonoutils.la \
40 CLASS=$(mcs_topdir)/class/lib/net_2_0
42 RUNTIME = MONO_PATH=$(CLASS) $(top_builddir)/runtime/mono-wrapper
43 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(top_builddir)/runtime/mono-wrapper
45 MCS = $(RUNTIME) $(CLASS)/gmcs.exe -unsafe -nowarn:0162
46 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
52 $(PLATFORM_CFLAGS) $(ARCH_CFLAGS)
54 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
58 # The mingw math.h has "extern inline" functions that dont appear in libs, so
59 # optimisation is required to actually inline them
63 # hack for automake to have the same source file in a library and a bin
64 genmdesc_CFLAGS = $(AM_CFLAGS)
67 monoldflags=$(export_ldflags)
68 monobinldflags=$(export_ldflags)
70 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
71 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
75 libmono_2_0_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
77 libmono_2_0_la_LDFLAGS=$(monoldflags) -version-info 1:0:0
83 sgen_binaries = mono-sgen
84 sgen_libraries = libmonosgen-2.0.la
85 sgen_static_libraries = libmonosgen-static.la
89 bin_PROGRAMS = mono monow
91 bin_PROGRAMS = mono $(sgen_binaries)
94 noinst_PROGRAMS = genmdesc
96 lib_LTLIBRARIES = libmono-2.0.la $(sgen_libraries)
97 noinst_LTLIBRARIES = libmono-static.la $(sgen_static_libraries)
100 noinst_LTLIBRARIES += libmono-moon.la
108 mono_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
110 mono_sgen_SOURCES = $(mono_SOURCES)
111 mono_sgen_CFLAGS = $(SGEN_DEFINES) $(AM_CFLAGS)
113 # We build this after libmono was built so it contains the date when the final
115 buildver.h: libmono-static.la
116 @echo "const char *build_date = \"`date`\";" > buildver.h
118 mono-main.$(OBJEXT): buildver.h
119 mono-sgen-main.$(OBJEXT): buildver.h
122 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
124 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
130 LIBMONO_DTRACE_OBJECT =
134 # Link libmono into mono statically
135 # This leads to higher performance, especially with TLS
136 MONO_LIB=libmono-static.la
137 MONO_SGEN_LIB=libmonosgen-static.la
139 MONO_LIB=libmono-2.0.la
140 MONO_SGEN_LIB=libmonosgen-2.0.la
148 $(MONO_DTRACE_OBJECT) \
152 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
159 $(MONO_DTRACE_OBJECT) \
162 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
166 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
167 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
168 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
170 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
171 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
172 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
176 # Create monow.exe, linked for the 'windows' subsystem
178 monow_LDADD = $(mono_LDADD)
179 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
180 monow_SOURCES = $(mono_SOURCES)
187 ../metadata/opcodes.c
189 # Don't link this against libmonoruntime to speed up rebuilds
191 $(monodir)/mono/utils/libmonoutils.la -lm \
301 local-propagation.c \
316 mini-generic-sharing.c \
346 devirtualization.cs \
350 generics-variant-types.il\
353 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
357 mdb_x86 = mdb-debug-info32-darwin.S
359 mdb_x86 = mdb-debug-info32.S
361 arch_sources = $(x86_sources) $(mdb_x86)
367 arch_sources = $(amd64_sources) mdb-debug-info64.S
368 arch_built=cpu-amd64.h
369 arch_define=__x86_64__
373 arch_sources = $(ppc_sources)
379 arch_sources = $(ppc_sources)
380 arch_built=cpu-ppc64.h
381 arch_define=__ppc64__
385 arch_sources = $(mips_sources)
386 arch_built=cpu-mips.h
391 # pick up arm_dpimacros.h and arm_fpamacros.h
392 ARCH_CFLAGS = -I../arch/arm
393 arch_sources = $(arm_sources)
399 arch_sources = $(sparc_sources)
400 arch_built=cpu-sparc.h
401 arch_define=__sparc__
405 arch_sources = $(sparc_sources)
406 arch_built=cpu-sparc.h
407 arch_define=__sparc__
411 arch_sources = $(s390_sources)
412 arch_built=cpu-s390.h
417 arch_sources = $(s390x_sources)
418 arch_built=cpu-s390x.h
423 arch_sources = $(ia64_sources)
424 arch_built = cpu-ia64.h
429 arch_sources = $(alpha_sources) $(mono_debugger_sources)
430 arch_built = cpu-alpha.h
431 arch_define=__alpha__
435 # Only support 32-bit targets for now
436 arch_sources = $(hppa_sources)
437 arch_built = cpu-hppa.h
442 os_sources = $(windows_sources)
443 monobin_platform_ldflags=
447 os_sources = $(posix_sources)
448 monobin_platform_ldflags=
452 os_sources = $(darwin_sources) $(posix_sources)
453 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
454 monobin_platform_ldflags=-framework CoreFoundation
457 libmono_2_0_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
458 libmono_2_0_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
460 libmonosgen_2_0_la_SOURCES = $(libmono_2_0_la_SOURCES)
461 libmonosgen_2_0_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
464 libmono_moon_la_SOURCES = $(libmono_2_0_la_SOURCES)
465 libmono_moon_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
468 libmono_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
469 libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
470 libmono_static_la_LDFLAGS = -static
471 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
473 libmonosgen_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
474 libmonosgen_static_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
475 libmonosgen_static_la_LDFLAGS = -static
476 libmonosgen_static_la_LIBADD = $(sgenstatic_libs) $(MONO_DTRACE_OBJECT)
478 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
479 nodist_libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
481 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
483 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
485 libmonoinclude_HEADERS = jit.h
487 libmono_2_0_la_LIBADD = \
488 $(libs) $(LIBMONO_DTRACE_OBJECT)
490 libmonosgen_2_0_la_LIBADD = \
491 $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
494 libmono_moon_la_LIBADD = $(libmono_2_0_la_LIBADD)
497 basic-simd.exe: basic-simd.cs
498 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
500 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
501 $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
503 %.exe: %.cs TestDriver.dll
504 $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
506 iltests.il: iltests.il.in Makefile.am
507 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
508 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
511 $(ILASM) -output=$@ $<
513 TestDriver.dll: $(srcdir)/TestDriver.cs
514 $(MCS) -out:$@ -target:library $<
516 generics-variant-types.dll: generics-variant-types.il
517 $(ILASM) -dll -output=$@ $<
519 # we don't always use the perl impl because it's an additional
520 # build dependency for the poor windows users
521 # $(arch_define) is the preprocessor symbol that enables all the opcodes
522 # for the specific platform in mini-ops.h
524 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir)
525 else !CROSS_COMPILING
526 GENMDESC_PRG=./genmdesc
527 endif !CROSS_COMPILING
529 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
530 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
532 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
533 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
535 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
536 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
538 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
539 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
541 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
542 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
544 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
545 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
547 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
548 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
550 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
551 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
553 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
554 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
556 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
557 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
559 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
560 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
562 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
563 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
566 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
568 # ensure the tests are actually correct
569 checktests: $(regtests)
570 for i in $(regtests); do $(RUNTIME) $$i; done
572 rcheck: mono $(regtests)
573 $(RUNTIME) --regression $(regtests)
575 aotcheck: mono $(regtests)
577 $(RUNTIME) --aot $(regtests) || exit 1
578 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
581 # This currently only works on amd64/arm
582 fullaotcheck: mono $(regtests)
585 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/
586 cp $(regtests) fullaot-tmp/
587 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --aot=full fullaot-tmp/* || exit 1
588 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
591 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
594 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
596 stat1: mono bench.exe
597 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
598 perl viewstat.pl stats.pl
600 stat2: mono basic.exe
601 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
602 perl viewstat.pl -e stats.pl
604 stat3: mono bench.exe
605 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
606 perl viewstat.pl stats.pl
614 rm -f mono a.out gmon.out *.o buildver.h test.exe
616 pkgconfigdir = $(libdir)/pkgconfig
619 BUILT_SOURCES = version.h $(arch_built)
621 BUILT_SOURCES = version.h
624 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
625 EXTRA_DIST = $(common_BURGSRC) TestDriver.cs ldscript ldscript.mono \
628 $(x86_sources) cpu-x86.md \
629 $(amd64_sources) cpu-amd64.md \
630 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
631 $(arm_sources) cpu-arm.md \
632 $(mips_sources) cpu-mips.md \
633 $(sparc_sources) cpu-sparc.md \
634 $(s390_sources) cpu-s390.md \
635 $(s390x_sources) cpu-s390x.md \
636 $(ia64_sources) cpu-ia64.md \
637 $(alpha_sources) cpu-alpha.md \
638 $(hppa_sources) cpu-hppa.md \
640 $(darwin_sources) Info.plist \
644 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; \
645 if test -d $(srcdir)/.svn; then svn_info='svn info'; fi; \
646 if test -n "$$svn_info"; then \
648 LANG=C; export LANG; \
649 branch=`eval $$svn_info | sed -n -e '/URL/ s,.*source/\(.*\)/mono.*,/\1/mono,p'`; \
650 version=`eval $$svn_info | sed -n -e '/Revision/ s/.*: //p'`; \
651 echo "#define FULL_VERSION \"$$branch r$$version\""; \
654 echo "#define FULL_VERSION \"tarball\""; \
657 # Utility target for patching libtool to speed up linking
659 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
660 chmod a+x ../../libtool
663 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`