* mini-s390x.c, mini-s390x.h: Check for presence of long displacement
[mono.git] / mono / mini / Makefile.am
index ba0e95856e264a4ca7014b7f1e5189f6a02e6663..1a18d4ba01925d65ff819c2b1d83934eb5b40716 100644 (file)
@@ -13,7 +13,6 @@ endif
 
 libs=  \
        $(monodir)/mono/metadata/libmonoruntime.la      \
-       $(monodir)/mono/metadata/libmetadata.la \
        $(monodir)/mono/io-layer/libwapi.la     \
        $(monodir)/mono/utils/libmonoutils.la \
        $(GMODULE_LIBS) \
@@ -23,7 +22,6 @@ libs= \
 
 static_libs=   \
        $(monodir)/mono/metadata/libmonoruntime-static.la       \
-       $(monodir)/mono/metadata/libmetadata-static.la  \
        $(monodir)/mono/io-layer/libwapi.la     \
        $(monodir)/mono/utils/libmonoutils.la \
        $(GMODULE_LIBS) \
@@ -31,31 +29,42 @@ static_libs=        \
        $(libgc_static_libs) \
        $(ICU_LIBS)
 
-RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/default ./mono --config $(top_builddir)/data/config
+CLASS1=$(mcs_topdir)/class/lib/default
+CLASS2=$(mcs_topdir)/class/lib/net_2_0
 
-MCS = $(RUNTIME) $(mcs_topdir)/class/lib/default/mcs.exe --unsafe -nowarn:0162
-ILASM = $(RUNTIME) $(mcs_topdir)/ilasm/ilasm.exe
+RUNTIME = MONO_PATH=$(CLASS1) $(top_builddir)/runtime/mono-wrapper
+RUNTIME2 = MONO_PATH=$(CLASS2) $(top_builddir)/runtime/mono-wrapper
 
-INCLUDES = \
+MCS = $(RUNTIME) $(CLASS1)/mcs.exe -unsafe -nowarn:0162
+GMCS = $(RUNTIME2) $(CLASS2)/gmcs.exe -unsafe -nowarn:0162
+ILASM = $(RUNTIME) $(CLASS1)/ilasm.exe
+
+
+AM_CFLAGS = \
        -I$(top_srcdir)         \
        $(LIBGC_CFLAGS)         \
        $(GMODULE_CFLAGS)               \
        $(GLIB_CFLAGS)
+       $(PLATFORM_CFLAGS) $(ARCH_CFLAGS)
 
 if PLATFORM_WIN32
 export HOST_CC
 # The mingw math.h has "extern inline" functions that dont appear in libs, so
 # optimisation is required to actually inline them
-AM_CFLAGS = -O
+PLATFORM_CFLAGS = -O
 endif
 
+PLATFORM_LIB = ../os/libmonoos.la
+
 # hack for automake to have the same source file in a library and a bin
 genmdesc_CFLAGS = $(AM_CFLAGS)
 
 if NO_VERSION_SCRIPT
 monoldflags=
+monobinldflags=
 else
 monoldflags=-Wl,-version-script=$(srcdir)/ldscript
+monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono
 endif
 
 if PLATFORM_WIN32
@@ -86,37 +95,41 @@ endif
 
 mono_LDADD = \
        $(MONO_LIB)                     \
+       $(PLATFORM_LIB)         \
        $(GLIB_LIBS)            \
        $(GMODULE_LIBS) -lm     \
        $(ICU_LIBS)
 
 mono_LDFLAGS = \
-       $(static_flags) -export-dynamic $(monoldflags)
+       $(static_flags) -export-dynamic $(monobinldflags)
 
 genmdesc_SOURCES = \
        mini.h          \
        genmdesc.c      \
        helpers.c
 
-# Don't link this against libmetadata to speed up rebuilds
+# Don't link this against libmonoruntime to speed up rebuilds
 genmdesc_LDADD = \
        $(monodir)/mono/utils/libmonoutils.la $(monodir)/mono/metadata/opcodes.lo -lm   \
+       $(PLATFORM_LIB)         \
        $(GLIB_LIBS)            \
        $(GMODULE_LIBS)
 
 x86_sources = \
-    mini-exceptions.c  \
        mini-x86.c              \
        mini-x86.h              \
        exceptions-x86.c        \
-       tramp-x86.c
+       tramp-x86.c                     \
+       mini-codegen.c          \
+       mini-trampolines.c
 
 amd64_sources = \
-       mini-exceptions.c       \
        mini-amd64.c            \
        mini-amd64.h            \
        exceptions-amd64.c      \
-       tramp-amd64.c
+       tramp-amd64.c           \
+       mini-codegen.c          \
+       mini-trampolines.c
 
 ppc_sources = \
        mini-ppc.c              \
@@ -124,25 +137,43 @@ ppc_sources = \
        exceptions-ppc.c        \
        tramp-ppc.c
 
+arm_sources = \
+       mini-arm.c              \
+       mini-arm.h              \
+       exceptions-arm.c        \
+       tramp-arm.c             \
+       mini-codegen.c
+
 sparc_sources = \
        mini-sparc.c            \
        mini-sparc.h            \
-    mini-exceptions.c  \
        exceptions-sparc.c      \
-       tramp-sparc.c
+       tramp-sparc.c           \
+       mini-codegen.c          \
+       mini-trampolines.c
 
 s390_sources = \
        mini-s390.c             \
        mini-s390.h             \
        exceptions-s390.c       \
+       mini-codegen.c          \
        tramp-s390.c
 
 s390x_sources = \
        mini-s390x.c            \
        mini-s390x.h            \
        exceptions-s390x.c      \
+       mini-codegen.c          \
        tramp-s390x.c
 
+ia64_sources = \
+       mini-ia64.c                     \
+       mini-ia64.h                     \
+       exceptions-ia64.c       \
+       tramp-ia64.c            \
+       mini-codegen.c          \
+       mini-trampolines.c
+
 common_sources = \
        mini.c          \
        mini.h          \
@@ -161,13 +192,19 @@ common_sources = \
        abcremoval.h    \
        ssapre.c        \
        ssapre.h        \
+       aliasing.c      \
+       aliasing.h      \
+       ssapre-cee-ops.h \
+       ssapre-mini-ops.h \
        driver.c        \
        debug-mini.c    \
        linear-scan.c   \
        aot.c           \
        graph.c         \
+       mini-exceptions.c       \
        declsec.c       \
-       declsec.h
+       declsec.h       \
+       branch-opts.c
 
 test_sources =                 \
        basic-calls.cs  \
@@ -182,13 +219,21 @@ test_sources =            \
        iltests.il              \
        test.cs
 
-regtests=basic.exe arrays.exe basic-float.exe basic-math.exe basic-long.exe objects.exe basic-calls.exe iltests.exe exceptions.exe bench.exe
+test_sources2 = generics.2.cs
 
+if MONO_DEBUGGER_SUPPORTED
+mono_debugger_sources = debug-debugger.c debug-debugger.h
+else
+mono_debugger_sources =
+endif
+
+regtests=basic.exe arrays.exe basic-float.exe basic-math.exe basic-long.exe objects.exe basic-calls.exe iltests.exe exceptions.exe bench.exe
+regtests2=generics.exe
 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-float.brg
 
 if X86
 libmono_la_SOURCES = \
-       $(common_sources) $(x86_sources)
+       $(common_sources) $(x86_sources) $(mono_debugger_sources)
 
 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-x86.brg
 arch_built=cpu-pentium.h
@@ -196,7 +241,7 @@ endif
 
 if AMD64
 libmono_la_SOURCES = \
-       $(common_sources) $(amd64_sources)
+       $(common_sources) $(amd64_sources) $(mono_debugger_sources)
 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-amd64.brg
 arch_built=cpu-amd64.h
 endif
@@ -209,6 +254,18 @@ arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-ppc.brg
 arch_built=cpu-g4.h
 endif
 
+if ARM
+
+# pick up arm_dpimacros.h and arm_fpamacros.h
+ARCH_CFLAGS = -I../arch/arm
+
+libmono_la_SOURCES = \
+       $(common_sources) $(arm_sources)
+
+arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-arm.brg
+arch_built=cpu-arm.h
+endif
+
 if SPARC
 libmono_la_SOURCES = \
        $(common_sources) $(sparc_sources)
@@ -241,12 +298,20 @@ arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-s390x.brg
 arch_built=cpu-s390x.h
 endif
 
+if IA64
+libmono_la_SOURCES = \
+    $(common_sources) $(ia64_sources)
+
+arch_BURGSRC = $(srcdir)/inssel-long.brg $(srcdir)/inssel-ia64.brg
+arch_built = cpu-ia64.h
+endif
+
 nodist_libmono_la_SOURCES = inssel.c inssel.h
 
 libmono_static_la_SOURCES = $(libmono_la_SOURCES)
 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
 libmono_static_la_LDFLAGS = -static
-libmono_static_la_LIBADD = $(static_libs)
+libmono_static_la_LIBADD = $(static_libs) $(PLATFORM_LIB)
 
 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
 
@@ -255,16 +320,38 @@ libmonoincludedir = $(includedir)/mono/jit
 libmonoinclude_HEADERS = jit.h
 
 libmono_la_LIBADD = \
-       $(libs)
+       $(libs) \
+       $(PLATFORM_LIB)
+
+%.exe: %.2.cs TestDriver.dll
+       $(GMCS) -out:$@ $< -r:TestDriver.dll 
 
 %.exe: %.cs TestDriver.dll
-       $(MCS) /out:$*.exe /unsafe $< /r:TestDriver.dll
+       $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
 
 %.exe: %.il
-       $(ILASM) /output=$*.exe $<
+       $(ILASM) -output=$@ $<
 
 TestDriver.dll: $(srcdir)/TestDriver.cs
-       $(MCS) /out:TestDriver.dll /target:library $(srcdir)/TestDriver.cs
+       $(MCS) -out:$@ -target:library $<
+
+if CROSS_COMPILING
+
+cpu-pentium.h: cpu-pentium.md
+cpu-amd64.h: cpu-amd64.md
+cpu-g4.h: cpu-g4.md
+cpu-arm.h: cpu-arm.md
+cpu-sparc.h: cpu-sparc.md
+cpu-s390.h: cpu-s390.md
+cpu-s390x.h: cpu-s390x.md
+cpu-ia64.h: cpu-ia64.md
+
+## Gross hack.  Making 'genmdesc' a host binary takes more effort
+$(arch_built):
+       echo "*** please build $(arch_built) on a native build tree and copy it here"
+       exit 1
+
+else !CROSS_COMPILING
 
 cpu-pentium.h: cpu-pentium.md genmdesc$(EXEEXT)
        ./genmdesc $(srcdir)/cpu-pentium.md cpu-pentium.h pentium_desc
@@ -275,14 +362,22 @@ cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
 cpu-g4.h: cpu-g4.md genmdesc$(EXEEXT)
        ./genmdesc $(srcdir)/cpu-g4.md cpu-g4.h ppcg4
 
+cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
+       ./genmdesc $(srcdir)/cpu-arm.md cpu-arm.h arm_cpu_desc
+
 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
        ./genmdesc $(srcdir)/cpu-sparc.md cpu-sparc.h sparc_desc
 
 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
-       ./genmdesc $(srcdir)/cpu-s390.md cpu-s390.h s390
+       ./genmdesc $(srcdir)/cpu-s390.md cpu-s390.h s390_cpu_desc
 
 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
-       ./genmdesc $(srcdir)/cpu-s390x.md cpu-s390x.h s390x
+       ./genmdesc $(srcdir)/cpu-s390x.md cpu-s390x.h s390x_cpu_desc
+
+cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
+       ./genmdesc $(srcdir)/cpu-ia64.md cpu-ia64.h ia64_desc
+
+endif !CROSS_COMPILING
 
 inssel.c inssel.h: $(BURGSRC)
        $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
@@ -294,12 +389,18 @@ testi: mono test.exe
 checktests: $(regtests)
        for i in $(regtests); do $(RUNTIME) $$i; done
 
-rcheck: mono $(regtests)
+checktests2: $(regtests2)
+       for i in $(regtests); do $(RUNTIME2) $$i; done
+
+rcheck: mono $(regtests) $(regtests2)
        $(RUNTIME) --regression $(regtests)
+       $(RUNTIME2) --regression $(regtests2)
 
 aotcheck: mono $(regtests)
        for i in $(regtests); do $(RUNTIME) --aot $$i; done
+       for i in $(regtests2); do $(RUNTIME2) --aot $$i; done
        $(RUNTIME) --verbose --regression $(regtests)
+       $(RUNTIME2) --verbose --regression $(regtests2)
        rm -f *.exe.so
 
 bench: mono test.exe
@@ -335,11 +436,14 @@ BUILT_SOURCES= inssel.c inssel.h $(arch_built)
 endif
 
 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
-EXTRA_DIST = $(common_BURGSRC) jit-icalls.c cprop.c TestDriver.cs ldscript $(test_sources) \
+EXTRA_DIST = $(common_BURGSRC) jit-icalls.c cprop.c TestDriver.cs ldscript ldscript.mono \
+       $(test_sources) $(test_sources2) \
        inssel-long.brg inssel-long32.brg \
        $(x86_sources) inssel-x86.brg cpu-pentium.md \
        $(amd64_sources) inssel-amd64.brg cpu-amd64.md \
        $(ppc_sources) inssel-ppc.brg cpu-g4.md \
+       $(arm_sources) inssel-arm.brg cpu-arm.md \
        $(sparc_sources) inssel-sparc.brg cpu-sparc.md \
        $(s390_sources) inssel-s390.brg cpu-s390.md \
-       $(s390x_sources) inssel-s390x.brg cpu-s390x.md
+       $(s390x_sources) inssel-s390x.brg cpu-s390x.md \
+       $(ia64_sources) inssel-ia64.brg cpu-ia64.md