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/libmonoruntimemoon.la \
29 $(monodir)/mono/io-layer/libwapi.la \
30 $(monodir)/mono/utils/libmonoutils.la \
35 $(monodir)/mono/metadata/libmonoruntime-static.la \
36 $(monodir)/mono/io-layer/libwapi.la \
37 $(monodir)/mono/utils/libmonoutils.la \
42 $(monodir)/mono/metadata/libmonoruntimesgen-static.la \
43 $(monodir)/mono/io-layer/libwapi.la \
44 $(monodir)/mono/utils/libmonoutils.la \
47 CLASS=$(mcs_topdir)/class/lib/net_2_0
49 RUNTIME_EXECUTABLE = $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/runtime/mono-wrapper)
51 RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
52 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(RUNTIME_EXECUTABLE)
54 MCS = $(RUNTIME) $(CLASS)/gmcs.exe -unsafe -nowarn:0162
55 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
61 $(PLATFORM_CFLAGS) $(ARCH_CFLAGS)
63 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
67 # The mingw math.h has "extern inline" functions that dont appear in libs, so
68 # optimisation is required to actually inline them
72 # hack for automake to have the same source file in a library and a bin
73 genmdesc_CFLAGS = $(AM_CFLAGS)
76 monoldflags=$(export_ldflags)
77 monobinldflags=$(export_ldflags)
79 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
80 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
84 libmono_2_0_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
86 libmono_2_0_la_LDFLAGS=$(monoldflags) -version-info 1:0:0
92 sgen_binaries = mono-sgen
93 sgen_libraries = libmonosgen-2.0.la
94 sgen_static_libraries = libmonosgen-static.la
98 bin_PROGRAMS = mono monow
100 bin_PROGRAMS = mono $(sgen_binaries)
103 noinst_PROGRAMS = genmdesc
106 shared_libraries = libmono-2.0.la
109 lib_LTLIBRARIES = $(shared_libraries) $(sgen_libraries)
110 noinst_LTLIBRARIES = libmono-static.la $(sgen_static_libraries)
113 noinst_LTLIBRARIES += libmono-moon.la
117 lib_LTLIBRARIES += libmono-llvm.la
118 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
119 libmono_llvm_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la $(LLVM_LIBS) $(LLVM_LDFLAGS) $(libs)
127 mono_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
129 mono_sgen_SOURCES = $(mono_SOURCES)
130 mono_sgen_CFLAGS = $(SGEN_DEFINES) $(AM_CFLAGS)
132 # We build this after libmono was built so it contains the date when the final
134 buildver.h: libmono-static.la
135 @echo "const char *build_date = \"`date`\";" > buildver.h
137 mono-main.$(OBJEXT): buildver.h
138 mono_sgen-main.$(OBJEXT): buildver.h
141 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
143 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
149 LIBMONO_DTRACE_OBJECT =
153 # Link libmono into mono statically
154 # This leads to higher performance, especially with TLS
155 MONO_LIB=libmono-static.la
156 MONO_SGEN_LIB=libmonosgen-static.la
158 MONO_LIB=libmono-2.0.la
159 MONO_SGEN_LIB=libmonosgen-2.0.la
165 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
173 $(MONO_DTRACE_OBJECT)
176 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
183 $(MONO_DTRACE_OBJECT)
185 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
189 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
190 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
191 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
193 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
194 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
195 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
199 # Create monow.exe, linked for the 'windows' subsystem
201 monow_LDADD = $(mono_LDADD)
202 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
203 monow_SOURCES = $(mono_SOURCES)
210 ../metadata/opcodes.c
212 # Don't link this against libmonoruntime to speed up rebuilds
214 $(monodir)/mono/utils/libmonoutils.la -lm \
328 local-propagation.c \
343 mini-generic-sharing.c \
375 devirtualization.cs \
379 generics-variant-types.il\
382 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
383 fsatests=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe devirtualization.exe basic-simd.exe
386 if MONO_DEBUGGER_SUPPORTED
388 mdb_x86 = mdb-debug-info32-darwin.s
390 mdb_x86 = mdb-debug-info32.s
395 arch_sources = $(x86_sources) $(mdb_x86)
401 if MONO_DEBUGGER_SUPPORTED
402 arch_sources = $(amd64_sources) mdb-debug-info64.s
404 arch_sources = $(amd64_sources)
406 arch_built=cpu-amd64.h
407 arch_define=__x86_64__
411 arch_sources = $(ppc_sources)
417 arch_sources = $(ppc_sources)
418 arch_built=cpu-ppc64.h
419 arch_define=__ppc64__
423 arch_sources = $(mips_sources)
424 arch_built=cpu-mips.h
429 # pick up arm_dpimacros.h and arm_fpamacros.h
430 ARCH_CFLAGS = -I../arch/arm
431 arch_sources = $(arm_sources)
437 arch_sources = $(sparc_sources)
438 arch_built=cpu-sparc.h
439 arch_define=__sparc__
443 arch_sources = $(sparc_sources)
444 arch_built=cpu-sparc.h
445 arch_define=__sparc__
449 arch_sources = $(s390_sources)
450 arch_built=cpu-s390.h
455 arch_sources = $(s390x_sources)
456 arch_built=cpu-s390x.h
461 arch_sources = $(ia64_sources)
462 arch_built = cpu-ia64.h
467 arch_sources = $(alpha_sources) $(mono_debugger_sources)
468 arch_built = cpu-alpha.h
469 arch_define=__alpha__
473 # Only support 32-bit targets for now
474 arch_sources = $(hppa_sources)
475 arch_built = cpu-hppa.h
480 os_sources = $(windows_sources)
481 monobin_platform_ldflags=
485 os_sources = $(posix_sources)
486 monobin_platform_ldflags=
490 os_sources = $(darwin_sources) $(posix_sources)
491 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
492 monobin_platform_ldflags=-framework CoreFoundation
495 libmono_2_0_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
496 libmono_2_0_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
498 libmonosgen_2_0_la_SOURCES = $(libmono_2_0_la_SOURCES)
499 libmonosgen_2_0_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
502 libmono_moon_la_SOURCES = $(libmono_2_0_la_SOURCES)
503 libmono_moon_la_CFLAGS = $(AM_CFLAGS) $(MOONLIGHT_DEFINES)
504 libmono_moon_la_LIBADD = $(moon_libs) $(LIBMONO_DTRACE_OBJECT)
507 libmono_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
508 libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
509 libmono_static_la_LDFLAGS = -static
510 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
512 libmonosgen_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
513 libmonosgen_static_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
514 libmonosgen_static_la_LDFLAGS = -static
515 libmonosgen_static_la_LIBADD = $(sgenstatic_libs) $(MONO_DTRACE_OBJECT)
517 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
518 nodist_libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
520 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
522 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
524 libmonoinclude_HEADERS = jit.h
526 libmono_2_0_la_LIBADD = \
527 $(libs) $(LIBMONO_DTRACE_OBJECT)
529 libmonosgen_2_0_la_LIBADD = \
530 $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
532 basic-simd.exe: basic-simd.cs
533 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
535 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
536 $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
538 %.exe: %.cs TestDriver.dll
539 $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
541 iltests.il: iltests.il.in Makefile.am
542 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
543 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
546 $(ILASM) -output=$@ $<
548 TestDriver.dll: $(srcdir)/TestDriver.cs
549 $(MCS) -out:$@ -target:library $<
551 generics-variant-types.dll: generics-variant-types.il
552 $(ILASM) -dll -output=$@ $<
560 # we don't always use the perl impl because it's an additional
561 # build dependency for the poor windows users
562 # $(arch_define) is the preprocessor symbol that enables all the opcodes
563 # for the specific platform in mini-ops.h
565 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
566 else !CROSS_COMPILING
567 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
568 endif !CROSS_COMPILING
570 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
571 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
573 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
574 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
576 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
577 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
579 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
580 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
582 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
583 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
585 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
586 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
588 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
589 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
591 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
592 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
594 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
595 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
597 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
598 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
600 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
601 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
603 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
604 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
607 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
609 # ensure the tests are actually correct
610 checktests: $(regtests)
611 for i in $(regtests); do $(RUNTIME) $$i; done
613 rcheck: mono $(regtests)
614 $(RUNTIME) --regression $(regtests)
616 aotcheck: mono $(regtests)
618 $(RUNTIME) --aot $(regtests) || exit 1
619 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
622 # This currently only works on amd64/arm
623 fullaotcheck: mono $(regtests)
626 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/
627 cp $(regtests) fullaot-tmp/
628 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --aot=full fullaot-tmp/* || exit 1
629 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
631 fsacheck: mono $(fsatests) fsacheck.c generics.exe
634 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 \
635 $(fsatests) generics-variant-types.dll TestDriver.dll fsa-tmp/
636 cp $(fsatests) fsa-tmp/
637 MONO_PATH=fsa-tmp $(top_builddir)/runtime/mono-wrapper --aot=full,static fsa-tmp/*.dll || exit 1
638 MONO_PATH=fsa-tmp $(top_builddir)/runtime/mono-wrapper --aot=full,static fsa-tmp/*.exe || exit 1
639 $(CC) -o $@.out -g -static $(VPATH)/fsacheck.c fsa-tmp/*.o \
640 -lmono-2.0 -lpthread -lm -ldl -lrt \
641 -DTARGET_X86 -L.libs -I${prefix}/include/mono-2.0 \
642 -I${prefix} -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
643 for i in $(fsatests); do echo $$i; MONO_PATH=fsa-tmp ./$@.out $$i || exit 1; done
646 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
649 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
651 stat1: mono bench.exe
652 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
653 perl viewstat.pl stats.pl
655 stat2: mono basic.exe
656 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
657 perl viewstat.pl -e stats.pl
659 stat3: mono bench.exe
660 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
661 perl viewstat.pl stats.pl
669 rm -f mono a.out gmon.out *.o buildver.h test.exe
671 pkgconfigdir = $(libdir)/pkgconfig
674 BUILT_SOURCES = version.h $(arch_built)
676 BUILT_SOURCES = version.h
679 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
680 EXTRA_DIST = $(common_BURGSRC) TestDriver.cs ldscript ldscript.mono \
683 $(x86_sources) cpu-x86.md \
684 $(amd64_sources) cpu-amd64.md \
685 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
686 $(arm_sources) cpu-arm.md \
687 $(mips_sources) cpu-mips.md \
688 $(sparc_sources) cpu-sparc.md \
689 $(s390_sources) cpu-s390.md \
690 $(s390x_sources) cpu-s390x.md \
691 $(ia64_sources) cpu-ia64.md \
692 $(alpha_sources) cpu-alpha.md \
693 $(hppa_sources) cpu-hppa.md \
695 $(darwin_sources) Info.plist \
699 if test -d $(top_srcdir)/.git; then \
701 LANG=C; export LANG; \
702 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
703 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
704 echo "#define FULL_VERSION \"$$branch/$$version\""; \
707 echo "#define FULL_VERSION \"tarball\""; \
710 # Utility target for patching libtool to speed up linking
712 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
713 chmod a+x ../../libtool
716 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`