Merge pull request #2431 from alexanderkyte/tests_with_excludes
[mono.git] / mono / mini / Makefile.am.in
index 794512a093d1c7df389ece26bc218b4f286b53e9..17de03c02481664d3729f175cc97f36eb4376511 100755 (executable)
@@ -3,15 +3,10 @@ mtest=for_loop
 monodir=$(top_builddir)
 
 # This is needed for automake dependency generation
-if INCLUDED_LIBGC
 libgc_libs=$(monodir)/libgc/libmonogc.la
 libgc_static_libs=$(monodir)/libgc/libmonogc-static.la
-else
-libgc_libs=$(LIBGC_LIBS)
-libgc_static_libs=$(LIBGC_STATIC_LIBS)
-endif
 
-libs=  \
+boehm_libs=    \
        $(monodir)/mono/metadata/libmonoruntime.la      \
        $(monodir)/mono/io-layer/libwapi.la     \
        $(monodir)/mono/utils/libmonoutils.la \
@@ -20,32 +15,34 @@ libs=       \
 
 sgen_libs = \
        $(monodir)/mono/metadata/libmonoruntimesgen.la  \
+       $(monodir)/mono/sgen/libmonosgen.la     \
        $(monodir)/mono/io-layer/libwapi.la     \
        $(monodir)/mono/utils/libmonoutils.la \
        $(GLIB_LIBS) $(LIBICONV)
 
-static_libs=   \
+boehm_static_libs=     \
        $(monodir)/mono/metadata/libmonoruntime-static.la       \
        $(monodir)/mono/io-layer/libwapi.la     \
        $(monodir)/mono/utils/libmonoutils.la \
        $(GLIB_LIBS) $(LIBICONV) \
        $(libgc_static_libs)
 
-sgenstatic_libs = \
+sgen_static_libs = \
        $(monodir)/mono/metadata/libmonoruntimesgen-static.la   \
+       $(monodir)/mono/sgen/libmonosgen-static.la      \
        $(monodir)/mono/io-layer/libwapi.la     \
        $(monodir)/mono/utils/libmonoutils.la \
        $(GLIB_LIBS) $(LIBICONV)
 
-CLASS=$(mcs_topdir)/class/lib/net_4_5
+CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
 
 RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_builddir)/runtime/mono-wrapper)
 
-RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
+MINI_RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(RUNTIME_EXECUTABLE)
 
-MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162
-ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
+MCS = $(MINI_RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162
+ILASM = $(MINI_RUNTIME) $(CLASS)/ilasm.exe
 
 AM_CFLAGS = \
        -I$(top_srcdir)         \
@@ -81,22 +78,22 @@ endif
 if SUPPORT_SGEN
 sgen_binaries = mono-sgen
 sgen_libraries = libmonosgen-2.0.la
-sgen_static_libraries = libmini-static.la $(sgenstatic_libs)
+sgen_static_libraries = libmini-static.la $(sgen_static_libs)
 endif
 
 if SUPPORT_BOEHM
 boehm_libraries = libmonoboehm-2.0.la
-boehm_static_libraries = libmini-static.la $(static_libs)
+boehm_static_libraries = libmini-static.la $(boehm_static_libs)
 boehm_binaries  = mono-boehm
 endif
 
-#The mono uses sgen, while libmono remains boehm
 if SUPPORT_SGEN
 mono_bin_suffix = sgen
+libmono_suffix = sgen
 else
 mono_bin_suffix = boehm
-endif
 libmono_suffix = boehm
+endif
 
 if DISABLE_EXECUTABLES
 else
@@ -150,12 +147,12 @@ endif
 
 if LOADED_LLVM
 lib_LTLIBRARIES += libmono-llvm.la
-libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
+libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp
 libmono_llvm_la_LIBADD = $(GLIB_LIBS) $(LLVM_LIBS) $(LLVM_LDFLAGS)
 if PLATFORM_DARWIN
 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
 else
-libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmonoboehm-$(API_VER).la $(libs)
+libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmonoboehm-$(API_VER).la $(boehm_libs)
 endif
 endif
 
@@ -189,9 +186,9 @@ mono_boehm-main.$(OBJEXT): buildver-boehm.h
 endif
 
 if DISABLE_EXECUTABLES
-buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen.la
+buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la
 else
-buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la
+buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la $(monodir)/mono/sgen/libmonosgen-static.la
 endif
        @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
 mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h
@@ -246,6 +243,10 @@ mono_sgen_LDADD = \
 
 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
 
+if BITCODE
+libmonoldflags += -no-undefined
+endif
+
 # if SUPPORT_SGEN
 # 
 # mono_LDADD = $(mono_sgen_LDADD)
@@ -312,7 +313,9 @@ ppc_sources = \
 
 arm_sources = \
        mini-arm.c              \
+       mini-arm-tls.S          \
        mini-arm.h              \
+       mini-arm-tls.h          \
        exceptions-arm.c        \
        tramp-arm.c
 
@@ -364,7 +367,18 @@ else
 llvm_sources = \
        mini-llvm.c             \
        mini-llvm-loaded.c \
-       mini-llvm-cpp.cpp
+       mini-llvm-cpp.cpp \
+       llvm-jit.cpp
+endif
+endif
+
+if ENABLE_LLVM
+llvm_runtime_sources = \
+       llvm-runtime.cpp
+else
+if ENABLE_LLVM_RUNTIME
+llvm_runtime_sources = \
+       llvm-runtime.cpp
 endif
 endif
 
@@ -388,31 +402,25 @@ common_sources = \
        mini-arch.h             \
        dominators.c            \
        cfold.c                 \
-       regalloc.c              \
        regalloc.h              \
        helpers.c               \
        liveness.c              \
        ssa.c                   \
        abcremoval.c            \
        abcremoval.h            \
-       ssapre.c                \
-       ssapre.h                \
        local-propagation.c     \
        driver.c                \
        debug-mini.c            \
        linear-scan.c           \
+       aot-compiler.h          \
        aot-compiler.c          \
        aot-runtime.c           \
        graph.c                 \
        mini-codegen.c          \
        mini-exceptions.c       \
        mini-trampolines.c      \
-       declsec.c               \
-       declsec.h               \
-       wapihandles.c           \
        branch-opts.c           \
        mini-generic-sharing.c  \
-       regalloc2.c             \
        simd-methods.h          \
        tasklets.c              \
        tasklets.h              \
@@ -429,9 +437,12 @@ common_sources = \
        debugger-agent.h        \
        debugger-agent.c        \
        xdebug.c                        \
+       mini-llvm.h                     \
        mini-llvm-cpp.h \
        alias-analysis.c        \
-       mini-cross-helpers.c
+       mini-cross-helpers.c \
+       arch-stubs.c            \
+       llvm-runtime.h
 
 test_sources =                         \
        basic-calls.cs          \
@@ -444,7 +455,7 @@ test_sources =                      \
        basic.cs                \
        exceptions.cs           \
        devirtualization.cs     \
-       iltests.il.in           \
+       iltests.il              \
        test.cs                 \
        generics.cs             \
        generics-variant-types.il\
@@ -469,7 +480,6 @@ if AMD64
 arch_sources = $(amd64_sources)
 arch_built=cpu-amd64.h
 arch_define=__x86_64__
-ARCH_FULLAOT_EXCLUDE=--exclude DYNCALL --exclude GSHAREDVT
 endif
 
 if POWERPC
@@ -544,12 +554,12 @@ os_sources = $(darwin_sources) $(posix_sources)
 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
 endif
 
-libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
+libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(arch_sources) $(os_sources)
 libmini_la_CFLAGS = $(mono_CFLAGS)
 
 libmonoboehm_2_0_la_SOURCES =
 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
-libmonoboehm_2_0_la_LIBADD = libmini.la $(libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
+libmonoboehm_2_0_la_LIBADD = libmini.la $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
 
 libmonosgen_2_0_la_SOURCES =
@@ -584,10 +594,6 @@ generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
 %.exe: %.cs TestDriver.dll
        $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
 
-iltests.il: iltests.il.in Makefile.am
-       echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
-       cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
-
 %.exe: %.il
        $(ILASM) -output=$@ $<
 
@@ -648,38 +654,42 @@ cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
        $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
 
 testi: mono test.exe
-       $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
+       $(MINI_RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
 
 # ensure the tests are actually correct
 checktests: $(regtests)
-       for i in $(regtests); do $(RUNTIME) $$i; done
+       for i in $(regtests); do $(MINI_RUNTIME) $$i; done
 
 rcheck: mono $(regtests)
 if NACL_CODEGEN
-       for i in $(regtests); do echo "running test $$i"; $(RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
+       for i in $(regtests); do echo "running test $$i"; $(MINI_RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
 else
-       -($(RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | ./emitnunit.pl
+       -($(MINI_RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | $(srcdir)/emitnunit.pl
        exit $$(cat regressionexitcode.out)
 endif
 
 rcheck2: mono $(regtests)
-       $(RUNTIME) --regression $(regtests)
+       $(MINI_RUNTIME) --regression $(regtests)
 
+if ARM
+check-seq-points:
+else
 check-seq-points: mono $(regtests)
-       rm -f TestResults_op_il_seq_point.xml
-       for i in $(regtests); do ./test_op_il_seq_point.sh $$i || (./test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
-       for i in $(regtests); do ./test_op_il_seq_point.sh $$i --aot || (./test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
-       ./test_op_il_seq_point_headerfooter.sh
+       rm -f TestResult-op_il_seq_point.xml
+       for i in $(regtests); do $(srcdir)/test_op_il_seq_point.sh $$i || ($(srcdir)/test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
+       for i in $(regtests); do $(srcdir)/test_op_il_seq_point.sh $$i --aot || ($(srcdir)/test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
+       $(srcdir)/test_op_il_seq_point_headerfooter.sh
+endif
 
 gctest: mono gc-test.exe
-       MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(RUNTIME) --regression gc-test.exe
+       MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(MINI_RUNTIME) --regression gc-test.exe
 
 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
 
 aotcheck: mono $(regtests)
        rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
-       $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
+       $(MINI_RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
        for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
        rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
 
@@ -691,38 +701,69 @@ gsharedvtcheck:
 
 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
 
+FULLAOT_LIBS = \
+       mscorlib.dll \
+       System.Core.dll \
+       System.dll \
+       Mono.Posix.dll \
+       System.Configuration.dll \
+       System.Security.dll \
+       System.Xml.dll \
+       Mono.Security.dll \
+       Mono.Simd.dll
+
 # This currently only works on amd64/arm
 fullaotcheck: mono $(fullaot_regtests)
        rm -rf fullaot-tmp
        mkdir fullaot-tmp
-       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/
-       cp $(fullaot_regtests) fullaot-tmp/
-       MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
+       $(MAKE) fullaot-libs AOT_FLAGS=full GSHAREDVT=$(GSHAREDVT)
+       cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
+       MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot=full fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
        ln -s $$PWD/mono fullaot-tmp/
        for i in $(fullaot_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
 
+# This can run in parallel
+fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
+
+fullaot-tmp/%.dylib: $(CLASS)/%
+       cp $(CLASS)/$* fullaot-tmp/
+       mkdir fullaot-tmp/$*-tmp
+       MONO_PATH=fullaot-tmp/:$(CLASS) $(top_builddir)/runtime/mono-wrapper $(if $(GSHAREDVT),-O=gsharedvt) --aot=$(AOT_FLAGS),temp-path=fullaot-tmp/$*-tmp fullaot-tmp/$*
+       rm -rf fullaot-tmp/$*-tmp
+
 llvmfullaotcheck:
        $(MAKE) fullaotcheck LLVM=1
 
+llvmonly_regtests = $(fullaot_regtests) gshared.exe
+
+llvmonlycheck: mono $(llvmonly_regtests)
+       rm -rf fullaot-tmp
+       mkdir fullaot-tmp
+       $(MAKE) fullaot-libs AOT_FLAGS=llvmonly
+       cp $(llvmonly_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
+       MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper  --aot=llvmonly fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
+       ln -s $$PWD/mono fullaot-tmp/
+       for i in $(llvmonly_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --llvmonly fullaot-tmp/$$i --exclude '!BITCODE' || exit 1; done
+
 gccheck: gc-test.exe
        MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe     
 
 bench: mono test.exe
-       time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
+       time env $(MINI_RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
 
 mbench: test.exe
        time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
 
 stat1: mono bench.exe
-       $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
+       $(MINI_RUNTIME) --verbose --statfile stats.pl --regression bench.exe
        perl viewstat.pl stats.pl
 
 stat2: mono basic.exe
-       $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
+       $(MINI_RUNTIME) --verbose --statfile stats.pl --regression basic.exe
        perl viewstat.pl -e stats.pl
 
 stat3: mono bench.exe
-       $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
+       $(MINI_RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
        perl viewstat.pl stats.pl
 
 docu: mini.sgm
@@ -731,7 +772,7 @@ docu: mini.sgm
 check-local: rcheck check-seq-points
 
 clean-local:
-       rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResults_op_il_seq_point.xml*
+       rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResult-op_il_seq_point.xml*
 
 pkgconfigdir = $(libdir)/pkgconfig
 
@@ -740,6 +781,7 @@ BUILT_SOURCES = version.h $(arch_built)
 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
 EXTRA_DIST = TestDriver.cs \
        genmdesc.pl                             \
+       emitnunit.pl                    \
        $(test_sources)                         \
        $(x86_sources) cpu-x86.md               \
        $(amd64_sources) cpu-amd64.md           \
@@ -761,7 +803,7 @@ version.h: Makefile
        if test -d $(top_srcdir)/.git; then \
                (cd $(top_srcdir); \
                        LANG=C; export LANG; \
-                       branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
+                       branch=`git branch | grep '^\*' | sed 's/(detached from .*/explicit/' | cut -d ' ' -f 2`; \
                        version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
                        echo "#define FULL_VERSION \"$$branch/$$version\""; \
                ); \
@@ -774,6 +816,11 @@ patch-libtool:
        sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
        chmod a+x ../../libtool
 
+# Utility target for patching libtool to get rid of the 'ranlib: file <file> has no symbols" warnings
+patch-osx-libtool:
+       sed -e 's/old_archive_cmds=.*/old_archive_cmds="libtool -no_warning_for_no_symbols -static -o \\$$oldlib \\$$oldobjs"/g' < ../../libtool > 2; mv 2 ../../libtool
+       chmod a+x ../../libtool
+
 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
 patch-automake:
        src="@echo \"  '. \$$name . ' ' x (8 - length (\$$name)) . '\""; dst="@echo \"'. \$$name . ' ' x (7 - length (\$$name)) .'\""; sed -e "s/$$src/$$dst/g" < $$EXE > 2 && cp 2 $$EXE && rm -f 2