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
372 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
375 if MONO_DEBUGGER_SUPPORTED
377 mdb_x86 = mdb-debug-info32-darwin.s
379 mdb_x86 = mdb-debug-info32.s
384 arch_sources = $(x86_sources) $(mdb_x86)
390 if MONO_DEBUGGER_SUPPORTED
391 arch_sources = $(amd64_sources) mdb-debug-info64.s
393 arch_sources = $(amd64_sources)
395 arch_built=cpu-amd64.h
396 arch_define=__x86_64__
400 arch_sources = $(ppc_sources)
406 arch_sources = $(ppc_sources)
407 arch_built=cpu-ppc64.h
408 arch_define=__ppc64__
412 arch_sources = $(mips_sources)
413 arch_built=cpu-mips.h
418 # pick up arm_dpimacros.h and arm_fpamacros.h
419 ARCH_CFLAGS = -I../arch/arm
420 arch_sources = $(arm_sources)
426 arch_sources = $(sparc_sources)
427 arch_built=cpu-sparc.h
428 arch_define=__sparc__
432 arch_sources = $(sparc_sources)
433 arch_built=cpu-sparc.h
434 arch_define=__sparc__
438 arch_sources = $(s390_sources)
439 arch_built=cpu-s390.h
444 arch_sources = $(s390x_sources)
445 arch_built=cpu-s390x.h
450 arch_sources = $(ia64_sources)
451 arch_built = cpu-ia64.h
456 arch_sources = $(alpha_sources) $(mono_debugger_sources)
457 arch_built = cpu-alpha.h
458 arch_define=__alpha__
462 # Only support 32-bit targets for now
463 arch_sources = $(hppa_sources)
464 arch_built = cpu-hppa.h
469 os_sources = $(windows_sources)
470 monobin_platform_ldflags=
474 os_sources = $(posix_sources)
475 monobin_platform_ldflags=
479 os_sources = $(darwin_sources) $(posix_sources)
480 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
481 monobin_platform_ldflags=-framework CoreFoundation
484 libmono_2_0_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
485 libmono_2_0_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
487 libmonosgen_2_0_la_SOURCES = $(libmono_2_0_la_SOURCES)
488 libmonosgen_2_0_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
491 libmono_moon_la_SOURCES = $(libmono_2_0_la_SOURCES)
492 libmono_moon_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
495 libmono_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
496 libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
497 libmono_static_la_LDFLAGS = -static
498 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
500 libmonosgen_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
501 libmonosgen_static_la_CFLAGS = $(AM_CFLAGS) $(SGEN_DEFINES)
502 libmonosgen_static_la_LDFLAGS = -static
503 libmonosgen_static_la_LIBADD = $(sgenstatic_libs) $(MONO_DTRACE_OBJECT)
505 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
506 nodist_libmono_static_la_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
508 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
510 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
512 libmonoinclude_HEADERS = jit.h
514 libmono_2_0_la_LIBADD = \
515 $(libs) $(LIBMONO_DTRACE_OBJECT)
517 libmonosgen_2_0_la_LIBADD = \
518 $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
521 libmono_moon_la_LIBADD = $(libmono_2_0_la_LIBADD)
524 basic-simd.exe: basic-simd.cs
525 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
527 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
528 $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
530 %.exe: %.cs TestDriver.dll
531 $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
533 iltests.il: iltests.il.in Makefile.am
534 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
535 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
538 $(ILASM) -output=$@ $<
540 TestDriver.dll: $(srcdir)/TestDriver.cs
541 $(MCS) -out:$@ -target:library $<
543 generics-variant-types.dll: generics-variant-types.il
544 $(ILASM) -dll -output=$@ $<
552 # we don't always use the perl impl because it's an additional
553 # build dependency for the poor windows users
554 # $(arch_define) is the preprocessor symbol that enables all the opcodes
555 # for the specific platform in mini-ops.h
557 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
558 else !CROSS_COMPILING
559 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
560 endif !CROSS_COMPILING
562 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
563 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
565 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
566 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
568 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
569 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
571 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
572 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
574 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
575 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
577 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
578 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
580 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
581 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
583 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
584 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
586 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
587 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
589 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
590 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
592 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
593 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
595 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
596 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
599 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
601 # ensure the tests are actually correct
602 checktests: $(regtests)
603 for i in $(regtests); do $(RUNTIME) $$i; done
605 rcheck: mono $(regtests)
606 $(RUNTIME) --regression $(regtests)
608 aotcheck: mono $(regtests)
610 $(RUNTIME) --aot $(regtests) || exit 1
611 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
614 # This currently only works on amd64/arm
615 fullaotcheck: mono $(regtests)
618 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/
619 cp $(regtests) fullaot-tmp/
620 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --aot=full fullaot-tmp/* || exit 1
621 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
623 fsacheck: mono $(fsatests) fsacheck.c generics.exe
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 \
627 $(fsatests) generics-variant-types.dll TestDriver.dll fsa-tmp/
628 cp $(fsatests) fsa-tmp/
629 MONO_PATH=fsa-tmp $(top_builddir)/runtime/mono-wrapper --aot=full,static fsa-tmp/*.dll || exit 1
630 MONO_PATH=fsa-tmp $(top_builddir)/runtime/mono-wrapper --aot=full,static fsa-tmp/*.exe || exit 1
631 $(CC) -o $@.out -g -static $(VPATH)/fsacheck.c fsa-tmp/*.o \
632 -lmono-2.0 -lpthread -lm -ldl -lrt \
633 -DTARGET_X86 -L.libs -I${prefix}/include/mono-2.0 \
634 -I${prefix} -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
635 for i in $(fsatests); do echo $$i; MONO_PATH=fsa-tmp ./$@.out $$i || exit 1; done
638 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
641 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
643 stat1: mono bench.exe
644 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
645 perl viewstat.pl stats.pl
647 stat2: mono basic.exe
648 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
649 perl viewstat.pl -e stats.pl
651 stat3: mono bench.exe
652 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
653 perl viewstat.pl stats.pl
661 rm -f mono a.out gmon.out *.o buildver.h test.exe
663 pkgconfigdir = $(libdir)/pkgconfig
666 BUILT_SOURCES = version.h $(arch_built)
668 BUILT_SOURCES = version.h
671 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
672 EXTRA_DIST = $(common_BURGSRC) TestDriver.cs ldscript ldscript.mono \
675 $(x86_sources) cpu-x86.md \
676 $(amd64_sources) cpu-amd64.md \
677 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
678 $(arm_sources) cpu-arm.md \
679 $(mips_sources) cpu-mips.md \
680 $(sparc_sources) cpu-sparc.md \
681 $(s390_sources) cpu-s390.md \
682 $(s390x_sources) cpu-s390x.md \
683 $(ia64_sources) cpu-ia64.md \
684 $(alpha_sources) cpu-alpha.md \
685 $(hppa_sources) cpu-hppa.md \
687 $(darwin_sources) Info.plist \
691 if test -d $(top_srcdir)/.git; then \
693 LANG=C; export LANG; \
694 branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
695 version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
696 echo "#define FULL_VERSION \"$$branch/$$version\""; \
699 echo "#define FULL_VERSION \"tarball\""; \
702 # Utility target for patching libtool to speed up linking
704 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
705 chmod a+x ../../libtool
708 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`