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)
44 # The mingw math.h has "extern inline" functions that dont appear in libs, so
45 # optimisation is required to actually inline them
49 # hack for automake to have the same source file in a library and a bin
50 genmdesc_CFLAGS = $(AM_CFLAGS)
53 monoldflags=$(export_ldflags)
54 monobinldflags=$(export_ldflags)
56 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
57 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
61 libmono_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
63 libmono_la_LDFLAGS=$(monoldflags)
69 bin_PROGRAMS = mono monow
74 noinst_PROGRAMS = genmdesc
76 lib_LTLIBRARIES = libmono.la
77 noinst_LTLIBRARIES = libmono-static.la
83 # We build this after libmono was built so it contains the date when the final
85 buildver.h: libmono-static.la
86 @echo "const char *build_date = \"`date`\";" > buildver.h
88 main.$(OBJEXT): buildver.h
91 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
93 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
99 LIBMONO_DTRACE_OBJECT =
103 # Link libmono into mono statically
104 # This leads to higher performance, especially with TLS
105 MONO_LIB=libmono-static.la
114 $(MONO_DTRACE_OBJECT)
117 $(static_flags) -export-dynamic $(monobinldflags)
121 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
122 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/dtrace-prelink.sh \
123 $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
125 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
126 DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/dtrace-prelink.sh \
127 --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
131 # Create monow.exe, linked for the 'windows' subsystem
133 monow_LDADD = $(mono_LDADD)
134 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
135 monow_SOURCES = $(mono_SOURCES)
143 # Don't link this against libmonoruntime to speed up rebuilds
145 $(monodir)/mono/utils/libmonoutils.la $(monodir)/mono/metadata/opcodes.lo -lm \
242 local-propagation.c \
277 devirtualization.cs \
281 generics-variant-types.il \
284 if MONO_DEBUGGER_SUPPORTED
286 mono_debugger_arch_sources = mdb-debug-info64.s
289 mono_debugger_arch_sources = mdb-debug-info32.s
292 mono_debugger_sources = debug-debugger.c debug-debugger.h $(mono_debugger_arch_sources)
294 mono_debugger_sources =
297 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
299 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-float.brg
302 arch_sources = $(x86_sources) $(mono_debugger_sources)
303 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-x86.brg
309 arch_sources = $(amd64_sources) $(mono_debugger_sources)
310 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-amd64.brg
311 arch_built=cpu-amd64.h
312 arch_define=__x86_64__
316 arch_sources = $(ppc_sources)
317 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-ppc.brg
323 arch_sources = $(ppc_sources)
324 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-ppc.brg
325 arch_built=cpu-ppc64.h
330 arch_sources = $(mips_sources)
331 arch_BURGSRC= $(srcdir)/inssel-long32-mips.brg $(srcdir)/inssel-mips.brg
332 arch_built=cpu-mips.h
337 # pick up arm_dpimacros.h and arm_fpamacros.h
338 ARCH_CFLAGS = -I../arch/arm
339 arch_sources = $(arm_sources)
340 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-arm.brg $(srcdir)/inssel-softfloat.brg
346 arch_sources = $(sparc_sources)
347 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-sparc.brg
348 arch_built=cpu-sparc.h
349 arch_define=__sparc__
353 arch_sources = $(sparc_sources)
354 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-sparc.brg
355 arch_built=cpu-sparc.h
356 arch_define=__sparc__
360 arch_sources = $(s390_sources)
361 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-s390.brg
362 arch_built=cpu-s390.h
367 arch_sources = $(s390x_sources)
368 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-s390x.brg
369 arch_built=cpu-s390x.h
374 arch_sources = $(ia64_sources)
375 arch_BURGSRC = $(srcdir)/inssel-long.brg $(srcdir)/inssel-ia64.brg
376 arch_built = cpu-ia64.h
381 arch_sources = $(alpha_sources) $(mono_debugger_sources)
382 arch_BURGSRC = $(srcdir)/inssel-long.brg $(srcdir)/inssel-alpha.brg
383 arch_built = cpu-alpha.h
384 arch_define=__alpha__
388 # Only support 32-bit targets for now
389 arch_sources = $(hppa_sources)
390 arch_BURGSRC = $(srcdir)/inssel-long32.brg $(srcdir)/inssel-hppa.brg
391 arch_built = cpu-hppa.h
395 libmono_la_SOURCES = $(common_sources) $(arch_sources)
398 nodist_libmono_la_SOURCES = inssel.h
400 nodist_libmono_la_SOURCES = inssel.c inssel.h
403 libmono_static_la_SOURCES = $(libmono_la_SOURCES)
404 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
405 libmono_static_la_LDFLAGS = -static
406 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
408 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
410 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
412 libmonoinclude_HEADERS = jit.h
414 libmono_la_LIBADD = \
415 $(libs) $(LIBMONO_DTRACE_OBJECT)
417 basic-simd.exe: basic-simd.cs
418 $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
420 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
421 $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
423 %.exe: %.cs TestDriver.dll
424 $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
426 iltests.il: iltests.il.in Makefile.am
427 echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
428 cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
431 $(ILASM) -output=$@ $<
433 TestDriver.dll: $(srcdir)/TestDriver.cs
434 $(MCS) -out:$@ -target:library $<
436 generics-variant-types.dll: generics-variant-types.il
437 $(ILASM) -dll -output=$@ $<
439 # we don't always use the perl impl because it's an additional
440 # build dependency for the poor windows users
441 # $(arch_define) is the preprocessor symbol that enables all the opcodes
442 # for the specific platform in mini-ops.h
444 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir)
445 else !CROSS_COMPILING
446 GENMDESC_PRG=./genmdesc
447 endif !CROSS_COMPILING
449 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
450 $(GENMDESC_PRG) $(srcdir)/cpu-x86.md cpu-x86.h x86_desc
452 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
453 $(GENMDESC_PRG) $(srcdir)/cpu-amd64.md cpu-amd64.h amd64_desc
455 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
456 $(GENMDESC_PRG) $(srcdir)/cpu-ppc.md cpu-ppc.h ppcg4
458 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
459 $(GENMDESC_PRG) $(srcdir)/cpu-ppc64.md cpu-ppc64.h ppcg4
461 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
462 $(GENMDESC_PRG) $(srcdir)/cpu-arm.md cpu-arm.h arm_cpu_desc
464 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
465 $(GENMDESC_PRG) $(srcdir)/cpu-sparc.md cpu-sparc.h sparc_desc
467 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
468 $(GENMDESC_PRG) $(srcdir)/cpu-s390.md cpu-s390.h s390_cpu_desc
470 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
471 $(GENMDESC_PRG) $(srcdir)/cpu-s390x.md cpu-s390x.h s390x_cpu_desc
473 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
474 $(GENMDESC_PRG) $(srcdir)/cpu-ia64.md cpu-ia64.h ia64_desc
476 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
477 $(GENMDESC_PRG) $(srcdir)/cpu-alpha.md cpu-alpha.h alpha_desc
479 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
480 $(GENMDESC_PRG) $(srcdir)/cpu-hppa.md cpu-hppa.h hppa_desc
482 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
483 $(GENMDESC_PRG) $(srcdir)/cpu-mips.md cpu-mips.h mips_desc
485 inssel.c inssel.h: $(BURGSRC)
486 $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
489 $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
491 # ensure the tests are actually correct
492 checktests: $(regtests)
493 for i in $(regtests); do $(RUNTIME) $$i; done
495 rcheck: mono $(regtests)
496 $(RUNTIME) --regression $(regtests)
498 aotcheck: mono $(regtests)
500 $(RUNTIME) --aot $(regtests) || exit 1
501 for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
505 time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
508 time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
510 stat1: mono bench.exe
511 $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
512 perl viewstat.pl stats.pl
514 stat2: mono basic.exe
515 $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
516 perl viewstat.pl -e stats.pl
518 stat3: mono bench.exe
519 $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe
520 perl viewstat.pl stats.pl
528 rm -f mono a.out gmon.out *.o buildver.h test.exe
530 pkgconfigdir = $(libdir)/pkgconfig
533 BUILT_SOURCES = version.h inssel.c inssel.h $(arch_built)
535 BUILT_SOURCES = version.h
538 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
539 EXTRA_DIST = $(common_BURGSRC) cprop.c TestDriver.cs ldscript ldscript.mono \
542 inssel-long.brg inssel-long32.brg \
543 inssel-softfloat.brg \
544 $(x86_sources) inssel-x86.brg cpu-x86.md \
545 $(amd64_sources) inssel-amd64.brg cpu-amd64.md \
546 $(ppc_sources) inssel-ppc.brg cpu-ppc.md \
547 $(arm_sources) inssel-arm.brg cpu-arm.md \
548 $(mips_sources) inssel-mips.brg inssel-long32-mips.brg cpu-mips.md \
549 $(sparc_sources) inssel-sparc.brg cpu-sparc.md \
550 $(s390_sources) inssel-s390.brg cpu-s390.md \
551 $(s390x_sources) inssel-s390x.brg cpu-s390x.md \
552 $(ia64_sources) inssel-ia64.brg cpu-ia64.md \
553 $(alpha_sources) inssel-alpha.brg cpu-alpha.md \
554 $(hppa_sources) inssel-hppa.brg cpu-hppa.md
557 if test -d $(top_srcdir)/.git/svn; then svn_info='git svn info'; fi; \
558 if test -d $(srcdir)/.svn; then svn_info='svn info'; fi; \
559 if test -n "$$svn_info"; then \
561 LANG=C; export LANG; \
562 branch=`$$svn_info | grep URL | sed -e 's/.*source//' -e 's,mono/?$$,,'`; \
563 version=`$$svn_info | grep Revision | sed 's/.*: //'`; \
564 echo "#define FULL_VERSION \"$$branch r$$version\""; \
567 echo "#define FULL_VERSION \"tarball\""; \
570 # Utility target for patching libtool to speed up linking
572 sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
573 chmod a+x ../../libtool