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
40 $(PLATFORM_CFLAGS) $(ARCH_CFLAGS)
42 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
46 # The mingw math.h has "extern inline" functions that dont appear in libs, so
47 # optimisation is required to actually inline them
51 # hack for automake to have the same source file in a library and a bin
52 genmdesc_CFLAGS = $(AM_CFLAGS)
55 monoldflags=$(export_ldflags)
56 monobinldflags=$(export_ldflags)
58 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
59 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
63 libmono_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
65 libmono_la_LDFLAGS=$(monoldflags)
71 bin_PROGRAMS = mono monow
76 noinst_PROGRAMS = genmdesc
78 lib_LTLIBRARIES = libmono.la
79 noinst_LTLIBRARIES = libmono-static.la
85 # We build this after libmono was built so it contains the date when the final
87 buildver.h: libmono-static.la
88 @echo "const char *build_date = \"`date`\";" > buildver.h
90 main.$(OBJEXT): buildver.h
93 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
95 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
101 LIBMONO_DTRACE_OBJECT =
105 # Link libmono into mono statically
106 # This leads to higher performance, especially with TLS
107 MONO_LIB=libmono-static.la
117 $(MONO_DTRACE_OBJECT) \
121 $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
125 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
126 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
127 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
129 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
130 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
131 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
135 # Create monow.exe, linked for the 'windows' subsystem
137 monow_LDADD = $(mono_LDADD)
138 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
139 monow_SOURCES = $(mono_SOURCES)
147 # Don't link this against libmonoruntime to speed up rebuilds
149 $(monodir)/mono/utils/libmonoutils.la $(monodir)/mono/metadata/opcodes.lo -lm \
228 # Disabled for now to fix the windows build
260 local-propagation.c \
275 mini-generic-sharing.c \
300 devirtualization.cs \
304 generics-variant-types.il\
307 if MONO_DEBUGGER_SUPPORTED
309 mono_debugger_arch_sources = mdb-debug-info32-darwin.s
312 mono_debugger_arch_sources = mdb-debug-info64.s
315 mono_debugger_arch_sources = mdb-debug-info32.s
319 mono_debugger_sources = debug-debugger.c debug-debugger.h $(mono_debugger_arch_sources)
321 mono_debugger_sources =
324 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
327 arch_sources = $(x86_sources) $(mono_debugger_sources)
333 arch_sources = $(amd64_sources) $(mono_debugger_sources)
334 arch_built=cpu-amd64.h
335 arch_define=__x86_64__
339 arch_sources = $(ppc_sources)
345 arch_sources = $(ppc_sources)
346 arch_built=cpu-ppc64.h
347 arch_define=__ppc64__
351 arch_sources = $(mips_sources)
352 arch_built=cpu-mips.h
357 # pick up arm_dpimacros.h and arm_fpamacros.h
358 ARCH_CFLAGS = -I../arch/arm
359 arch_sources = $(arm_sources)
365 arch_sources = $(sparc_sources)
366 arch_built=cpu-sparc.h
367 arch_define=__sparc__
371 arch_sources = $(sparc_sources)
372 arch_built=cpu-sparc.h
373 arch_define=__sparc__
377 arch_sources = $(s390_sources)
378 arch_built=cpu-s390.h
383 arch_sources = $(s390x_sources)
384 arch_built=cpu-s390x.h
389 arch_sources = $(ia64_sources)
390 arch_built = cpu-ia64.h
395 arch_sources = $(alpha_sources) $(mono_debugger_sources)
396 arch_built = cpu-alpha.h
397 arch_define=__alpha__
401 # Only support 32-bit targets for now
402 arch_sources = $(hppa_sources)
403 arch_built = cpu-hppa.h
408 os_sources = $(windows_sources)
409 monobin_platform_ldflags=
413 os_sources = $(posix_sources)
414 monobin_platform_ldflags=
418 os_sources = $(darwin_sources) $(posix_sources)
419 monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist
422 libmono_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
424 libmono_static_la_SOURCES = $(libmono_la_SOURCES)
425 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
426 libmono_static_la_LDFLAGS = -static
427 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
429 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
431 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
433 libmonoinclude_HEADERS = jit.h
435 libmono_la_LIBADD = \
436 $(libs) $(LIBMONO_DTRACE_OBJECT)
438 basic-simd.exe: basic-simd.cs
439 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
441 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
442 $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
444 %.exe: %.cs TestDriver.dll
445 $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
447 iltests.il: iltests.il.in Makefile.am
448 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
449 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
452 $(ILASM) -output=$@ $<
454 TestDriver.dll: $(srcdir)/TestDriver.cs
455 $(MCS) -out:$@ -target:library $<
457 generics-variant-types.dll: generics-variant-types.il
458 $(ILASM) -dll -output=$@ $<
460 # we don't always use the perl impl because it's an additional
461 # build dependency for the poor windows users
462 # $(arch_define) is the preprocessor symbol that enables all the opcodes
463 # for the specific platform in mini-ops.h
465 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir)
466 else !CROSS_COMPILING
467 GENMDESC_PRG=./genmdesc
468 endif !CROSS_COMPILING
470 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
471 $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
473 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
474 $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
476 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
477 $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
479 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
480 $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
482 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
483 $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
485 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
486 $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
488 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
489 $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
491 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
492 $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
494 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
495 $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
497 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
498 $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
500 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
501 $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
503 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
504 $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
507 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
509 # ensure the tests are actually correct
510 checktests: $(regtests)
511 for i in $(regtests); do $(RUNTIME) $$i; done
513 rcheck: mono $(regtests)
514 $(RUNTIME) --regression $(regtests)
516 aotcheck: mono $(regtests)
518 $(RUNTIME) --aot $(regtests) || exit 1
519 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
522 # This currently only works on amd64/arm
523 fullaotcheck: mono $(regtests)
526 cp $(CLASS)/mscorlib.dll $(CLASS)/Mono.Simd.dll $(regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
527 cp $(regtests) fullaot-tmp/
528 MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --aot=full fullaot-tmp/* || exit 1
529 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
532 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
535 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
537 stat1: mono bench.exe
538 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
539 perl viewstat.pl stats.pl
541 stat2: mono basic.exe
542 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
543 perl viewstat.pl -e stats.pl
545 stat3: mono bench.exe
546 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
547 perl viewstat.pl stats.pl
555 rm -f mono a.out gmon.out *.o buildver.h test.exe
557 pkgconfigdir = $(libdir)/pkgconfig
560 BUILT_SOURCES = version.h $(arch_built)
562 BUILT_SOURCES = version.h
565 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
566 EXTRA_DIST = $(common_BURGSRC) cprop.c TestDriver.cs ldscript ldscript.mono \
569 $(x86_sources) cpu-x86.md \
570 $(amd64_sources) cpu-amd64.md \
571 $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
572 $(arm_sources) cpu-arm.md \
573 $(mips_sources) cpu-mips.md \
574 $(sparc_sources) cpu-sparc.md \
575 $(s390_sources) cpu-s390.md \
576 $(s390x_sources) cpu-s390x.md \
577 $(ia64_sources) cpu-ia64.md \
578 $(alpha_sources) cpu-alpha.md \
579 $(hppa_sources) cpu-hppa.md \
585 if test -d $(top_srcdir)/.git/svn; 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; \
586 if test -d $(srcdir)/.svn; then svn_info='svn info'; fi; \
587 if test -n "$$svn_info"; then \
589 LANG=C; export LANG; \
590 branch=`eval $$svn_info | sed -n -e '/URL/ s,.*source/\(.*\)/mono.*,/\1/mono,p'`; \
591 version=`eval $$svn_info | sed -n -e '/Revision/ s/.*: //p'`; \
592 echo "#define FULL_VERSION \"$$branch r$$version\""; \
595 echo "#define FULL_VERSION \"tarball\""; \
598 # Utility target for patching libtool to speed up linking
600 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
601 chmod a+x ../../libtool