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/libmonoruntime-static.la \
23 $(monodir)/mono/io-layer/libwapi.la \
24 $(monodir)/mono/utils/libmonoutils.la \
28 CLASS=$(mcs_topdir)/class/lib/net_2_0
30 RUNTIME = MONO_PATH=$(CLASS) $(top_builddir)/runtime/mono-wrapper
31 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(top_builddir)/runtime/mono-wrapper
33 MCS = $(RUNTIME) $(CLASS)/gmcs.exe -unsafe -nowarn:0162
34 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
41 $(PLATFORM_CFLAGS) $(ARCH_CFLAGS)
43 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
47 # The mingw math.h has "extern inline" functions that dont appear in libs, so
48 # optimisation is required to actually inline them
52 # hack for automake to have the same source file in a library and a bin
53 genmdesc_CFLAGS = $(AM_CFLAGS)
56 monoldflags=$(export_ldflags)
57 monobinldflags=$(export_ldflags)
59 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
60 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
64 libmono_2_0_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
66 libmono_2_0_la_LDFLAGS=$(monoldflags) -version-info 1:0:0
72 bin_PROGRAMS = mono monow
77 noinst_PROGRAMS = genmdesc
79 lib_LTLIBRARIES = libmono-2.0.la
80 noinst_LTLIBRARIES = libmono-static.la
83 noinst_LTLIBRARIES += libmono-moon.la
91 # We build this after libmono was built so it contains the date when the final
93 buildver.h: libmono-static.la
94 @echo "const char *build_date = \"`date`\";" > buildver.h
96 main.$(OBJEXT): buildver.h
99 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
101 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
107 LIBMONO_DTRACE_OBJECT =
111 # Link libmono into mono statically
112 # This leads to higher performance, especially with TLS
113 MONO_LIB=libmono-static.la
115 MONO_LIB=libmono-2.0.la
123 $(MONO_DTRACE_OBJECT) \
127 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
131 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
132 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
133 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
135 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
136 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
137 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
141 # Create monow.exe, linked for the 'windows' subsystem
143 monow_LDADD = $(mono_LDADD)
144 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
145 monow_SOURCES = $(mono_SOURCES)
153 # Don't link this against libmonoruntime to speed up rebuilds
155 $(monodir)/mono/utils/libmonoutils.la $(monodir)/mono/metadata/opcodes.lo -lm \
265 local-propagation.c \
280 mini-generic-sharing.c \
308 devirtualization.cs \
312 generics-variant-types.il\
315 if MONO_DEBUGGER_SUPPORTED
317 mono_debugger_arch_sources = mdb-debug-info32-darwin.s
320 mono_debugger_arch_sources = mdb-debug-info64.s
323 mono_debugger_arch_sources = mdb-debug-info32.s
327 mono_debugger_sources = debug-debugger.c debug-debugger.h $(mono_debugger_arch_sources)
329 mono_debugger_sources =
332 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
335 arch_sources = $(x86_sources) $(mono_debugger_sources)
341 arch_sources = $(amd64_sources) $(mono_debugger_sources)
342 arch_built=cpu-amd64.h
343 arch_define=__x86_64__
347 arch_sources = $(ppc_sources)
353 arch_sources = $(ppc_sources)
354 arch_built=cpu-ppc64.h
355 arch_define=__ppc64__
359 arch_sources = $(mips_sources)
360 arch_built=cpu-mips.h
365 # pick up arm_dpimacros.h and arm_fpamacros.h
366 ARCH_CFLAGS = -I../arch/arm
367 arch_sources = $(arm_sources)
373 arch_sources = $(sparc_sources)
374 arch_built=cpu-sparc.h
375 arch_define=__sparc__
379 arch_sources = $(sparc_sources)
380 arch_built=cpu-sparc.h
381 arch_define=__sparc__
385 arch_sources = $(s390_sources)
386 arch_built=cpu-s390.h
391 arch_sources = $(s390x_sources)
392 arch_built=cpu-s390x.h
397 arch_sources = $(ia64_sources)
398 arch_built = cpu-ia64.h
403 arch_sources = $(alpha_sources) $(mono_debugger_sources)
404 arch_built = cpu-alpha.h
405 arch_define=__alpha__
409 # Only support 32-bit targets for now
410 arch_sources = $(hppa_sources)
411 arch_built = cpu-hppa.h
416 os_sources = $(windows_sources)
417 monobin_platform_ldflags=
421 os_sources = $(posix_sources)
422 monobin_platform_ldflags=
426 os_sources = $(darwin_sources) $(posix_sources)
427 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
428 monobin_platform_ldflags=-framework CoreFoundation
431 libmono_2_0_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
434 libmono_moon_la_SOURCES = $(libmono_2_0_la_SOURCES)
437 libmono_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
438 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
439 libmono_static_la_LDFLAGS = -static
440 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
442 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
444 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
446 libmonoinclude_HEADERS = jit.h
448 libmono_2_0_la_LIBADD = \
449 $(libs) $(LIBMONO_DTRACE_OBJECT)
452 libmono_moon_la_LIBADD = $(libmono_2_0_la_LIBADD)
455 basic-simd.exe: basic-simd.cs
456 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
458 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
459 $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
461 %.exe: %.cs TestDriver.dll
462 $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
464 iltests.il: iltests.il.in Makefile.am
465 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
466 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
469 $(ILASM) -output=$@ $<
471 TestDriver.dll: $(srcdir)/TestDriver.cs
472 $(MCS) -out:$@ -target:library $<
474 generics-variant-types.dll: generics-variant-types.il
475 $(ILASM) -dll -output=$@ $<
477 # we don't always use the perl impl because it's an additional
478 # build dependency for the poor windows users
479 # $(arch_define) is the preprocessor symbol that enables all the opcodes
480 # for the specific platform in mini-ops.h
482 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir)
483 else !CROSS_COMPILING
484 GENMDESC_PRG=./genmdesc
485 endif !CROSS_COMPILING
487 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
488 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
490 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
491 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
493 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
494 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
496 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
497 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
499 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
500 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
502 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
503 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
505 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
506 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
508 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
509 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
511 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
512 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
514 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
515 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
517 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
518 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
520 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
521 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
524 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
526 # ensure the tests are actually correct
527 checktests: $(regtests)
528 for i in $(regtests); do $(RUNTIME) $$i; done
530 rcheck: mono $(regtests)
531 $(RUNTIME) --regression $(regtests)
533 aotcheck: mono $(regtests)
535 $(RUNTIME) --aot $(regtests) || exit 1
536 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
539 # This currently only works on amd64/arm
540 fullaotcheck: mono $(regtests)
543 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/
544 cp $(regtests) fullaot-tmp/
545 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --aot=full fullaot-tmp/* || exit 1
546 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
549 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
552 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
554 stat1: mono bench.exe
555 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
556 perl viewstat.pl stats.pl
558 stat2: mono basic.exe
559 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
560 perl viewstat.pl -e stats.pl
562 stat3: mono bench.exe
563 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
564 perl viewstat.pl stats.pl
572 rm -f mono a.out gmon.out *.o buildver.h test.exe
574 pkgconfigdir = $(libdir)/pkgconfig
577 BUILT_SOURCES = version.h $(arch_built)
579 BUILT_SOURCES = version.h
582 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
583 EXTRA_DIST = $(common_BURGSRC) TestDriver.cs ldscript ldscript.mono \
586 $(x86_sources) cpu-x86.md \
587 $(amd64_sources) cpu-amd64.md \
588 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
589 $(arm_sources) cpu-arm.md \
590 $(mips_sources) cpu-mips.md \
591 $(sparc_sources) cpu-sparc.md \
592 $(s390_sources) cpu-s390.md \
593 $(s390x_sources) cpu-s390x.md \
594 $(ia64_sources) cpu-ia64.md \
595 $(alpha_sources) cpu-alpha.md \
596 $(hppa_sources) cpu-hppa.md \
598 $(darwin_sources) Info.plist \
602 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; \
603 if test -d $(srcdir)/.svn; then svn_info='svn info'; fi; \
604 if test -n "$$svn_info"; then \
606 LANG=C; export LANG; \
607 branch=`eval $$svn_info | sed -n -e '/URL/ s,.*source/\(.*\)/mono.*,/\1/mono,p'`; \
608 version=`eval $$svn_info | sed -n -e '/Revision/ s/.*: //p'`; \
609 echo "#define FULL_VERSION \"$$branch r$$version\""; \
612 echo "#define FULL_VERSION \"tarball\""; \
615 # Utility target for patching libtool to speed up linking
617 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
618 chmod a+x ../../libtool
621 etags -o TAGS `find .. -name "*.h" -o -name "*.c"`