2008-09-25 Dick Porter <dick@ximian.com>
[mono.git] / mono / mini / Makefile.am
index f313fcb0c39738d212c73dcdb8aebce430ad1c1b..2fe3e0d3e79bad3ec4c05f16130e4db8166d763f 100644 (file)
@@ -25,18 +25,13 @@ static_libs=        \
        $(GLIB_LIBS)    \
        $(libgc_static_libs)
 
-CLASS1=$(mcs_topdir)/class/lib/default
-CLASS2=$(mcs_topdir)/class/lib/net_2_0
+CLASS=$(mcs_topdir)/class/lib/net_2_0
 
-RUNTIME = MONO_PATH=$(CLASS1) $(top_builddir)/runtime/mono-wrapper
-RUNTIME2 = MONO_PATH=$(CLASS2) $(top_builddir)/runtime/mono-wrapper
-RUNTIME_AOTCHECK = MONO_PATH=$(CLASS1):. $(top_builddir)/runtime/mono-wrapper
-RUNTIME_AOTCHECK2 = MONO_PATH=$(CLASS2):. $(top_builddir)/runtime/mono-wrapper
+RUNTIME = MONO_PATH=$(CLASS) $(top_builddir)/runtime/mono-wrapper
+RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(top_builddir)/runtime/mono-wrapper
 
-MCS = $(RUNTIME) $(CLASS1)/mcs.exe -unsafe -nowarn:0162
-GMCS = $(RUNTIME2) $(CLASS2)/gmcs.exe -unsafe -nowarn:0162
-ILASM = $(RUNTIME) $(CLASS1)/ilasm.exe
-ILASM2 = $(RUNTIME2) $(CLASS2)/ilasm.exe
+MCS = $(RUNTIME) $(CLASS)/gmcs.exe -unsafe -nowarn:0162
+ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
 
 AM_CFLAGS = \
        -I$(top_srcdir)         \
@@ -63,7 +58,7 @@ monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
 endif
 
 if PLATFORM_WIN32
-libmono_la_LDFLAGS=-no-undefined -avoid-version $(monoldflags)
+libmono_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
 else
 libmono_la_LDFLAGS=$(monoldflags)
 endif
@@ -85,6 +80,18 @@ endif
 mono_SOURCES = \
        main.c
 
+if DTRACE_G_REQUIRED
+LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
+if STATIC_MONO
+MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
+else
+MONO_DTRACE_OBJECT = 
+endif
+else
+MONO_DTRACE_OBJECT = 
+LIBMONO_DTRACE_OBJECT = 
+endif
+
 if STATIC_MONO
 # Link libmono into mono statically
 # This leads to higher performance, especially with TLS
@@ -96,11 +103,24 @@ endif
 mono_LDADD = \
        $(MONO_LIB)                     \
        $(GLIB_LIBS)            \
-       -lm
+       -lm     \
+       $(MONO_DTRACE_OBJECT)
 
 mono_LDFLAGS = \
        $(static_flags) -export-dynamic $(monobinldflags)
 
+if DTRACE_G_REQUIRED
+
+mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
+       DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/dtrace-prelink.sh \
+       $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
+
+.libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
+       DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/dtrace-prelink.sh \
+       --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
+
+endif
+
 # Create monow.exe, linked for the 'windows' subsystem
 if PLATFORM_WIN32
 monow_LDADD = $(mono_LDADD)
@@ -122,28 +142,24 @@ x86_sources = \
        mini-x86.c              \
        mini-x86.h              \
        exceptions-x86.c        \
-       tramp-x86.c                     \
-       mini-trampolines.c
+       tramp-x86.c
 
 amd64_sources = \
        mini-amd64.c            \
        mini-amd64.h            \
        exceptions-amd64.c      \
-       tramp-amd64.c           \
-       mini-trampolines.c
+       tramp-amd64.c
 
 ppc_sources = \
        mini-ppc.c              \
        mini-ppc.h              \
        exceptions-ppc.c        \
-       mini-trampolines.c      \
        tramp-ppc.c
 
 arm_sources = \
        mini-arm.c              \
        mini-arm.h              \
        exceptions-arm.c        \
-       mini-trampolines.c      \
        tramp-arm.c
 
 mips_sources = \
@@ -156,8 +172,7 @@ sparc_sources = \
        mini-sparc.c            \
        mini-sparc.h            \
        exceptions-sparc.c      \
-       tramp-sparc.c           \
-       mini-trampolines.c
+       tramp-sparc.c
 
 s390_sources = \
        mini-s390.c             \
@@ -175,25 +190,25 @@ ia64_sources = \
        mini-ia64.c                     \
        mini-ia64.h                     \
        exceptions-ia64.c       \
-       tramp-ia64.c            \
-       mini-trampolines.c
+       tramp-ia64.c
 
 alpha_sources = \
        mini-alpha.c    \
        mini-alpha.h    \
        exceptions-alpha.c      \
-       tramp-alpha.c   \
-       mini-trampolines.c
+       tramp-alpha.c
 
 hppa_sources = \
        mini-hppa.c     \
        mini-hppa.h     \
        exceptions-hppa.c       \
-       tramp-hppa.c    \
-       mini-trampolines.c
+       tramp-hppa.c
 
 common_sources = \
        mini.c          \
+       ir-emit.h       \
+       method-to-ir.c  \
+       decompose.c     \
        mini.h          \
        version.h       \
        optflags-def.h          \
@@ -229,11 +244,15 @@ common_sources = \
        graph.c         \
        mini-exceptions.c       \
        mini-codegen.c          \
+       mini-trampolines.c  \
        declsec.c       \
        declsec.h       \
        wapihandles.c   \
        branch-opts.c   \
-       generic-sharing.c
+       generic-sharing.c       \
+       ssa2.c  \
+       abcremoval2.c   \
+       regalloc2.c
 
 test_sources =                 \
        basic-calls.cs  \
@@ -247,17 +266,15 @@ test_sources =            \
        exceptions.cs   \
        devirtualization.cs     \
        iltests.il.in           \
-       test.cs
-
-test_sources2 = generics.2.cs il2tests.2.il generics-variant-types.2.il
+       test.cs                 \
+       generics.cs     \
+       generics-variant-types.il
 
 if MONO_DEBUGGER_SUPPORTED
 if AMD64
 mono_debugger_arch_sources = mdb-debug-info64.s
 else
-if ALPHA
-mono_debugger_arch_sources = mdb-debug-info64.s
-else
+if X86
 mono_debugger_arch_sources = mdb-debug-info32.s
 endif
 endif
@@ -266,8 +283,7 @@ 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 devirtualization.exe
-regtests2=generics.exe il2tests.exe
+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
 
 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-float.brg
 
@@ -288,7 +304,7 @@ endif
 if POWERPC
 arch_sources = $(ppc_sources)
 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-ppc.brg
-arch_built=cpu-g4.h
+arch_built=cpu-ppc.h
 arch_define=__ppc__
 endif
 
@@ -360,12 +376,16 @@ endif
 
 libmono_la_SOURCES = $(common_sources) $(arch_sources)
 
+if DISABLE_JIT
+nodist_libmono_la_SOURCES = inssel.h
+else
 nodist_libmono_la_SOURCES = inssel.c inssel.h
+endif
 
 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) $(MONO_DTRACE_OBJECT)
 
 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
 
@@ -374,17 +394,14 @@ libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
 libmonoinclude_HEADERS = jit.h
 
 libmono_la_LIBADD = \
-       $(libs)
+       $(libs) $(LIBMONO_DTRACE_OBJECT)
 
-%.exe: %.2.cs TestDriver.dll generics-variant-types.dll
-       $(GMCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
+generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
+       $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
 
 %.exe: %.cs TestDriver.dll
        $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
 
-%.exe: %.2.il
-       $(ILASM2) -output=$@ $<
-
 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
@@ -395,15 +412,15 @@ iltests.il: iltests.il.in Makefile.am
 TestDriver.dll: $(srcdir)/TestDriver.cs
        $(MCS) -out:$@ -target:library $<
 
-generics-variant-types.dll: generics-variant-types.2.il
-       $(ILASM2) -dll -output=$@ $<
+generics-variant-types.dll: generics-variant-types.il
+       $(ILASM) -dll -output=$@ $<
 
 # we don't always use the perl impl because it's an additional
 # build dependency for the poor windows users
 # $(arch_define) is the preprocessor symbol that enables all the opcodes
 # for the specific platform in mini-ops.h
 if CROSS_COMPILING
-GENMDESC_PRG=perl genmdesc.pl $(arch_define) $(srcdir)
+GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir)
 else !CROSS_COMPILING
 GENMDESC_PRG=./genmdesc
 endif !CROSS_COMPILING
@@ -414,8 +431,8 @@ cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
        $(GENMDESC_PRG) $(srcdir)/cpu-amd64.md cpu-amd64.h amd64_desc
 
-cpu-g4.h: cpu-g4.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-g4.md cpu-g4.h ppcg4
+cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
+       $(GENMDESC_PRG) $(srcdir)/cpu-ppc.md cpu-ppc.h ppcg4
 
 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
        $(GENMDESC_PRG) $(srcdir)/cpu-arm.md cpu-arm.h arm_cpu_desc
@@ -451,18 +468,13 @@ testi: mono test.exe
 checktests: $(regtests)
        for i in $(regtests); do $(RUNTIME) $$i; done
 
-checktests2: $(regtests2)
-       for i in $(regtests); do $(RUNTIME2) $$i; done
-
-rcheck: mono $(regtests) $(regtests2)
+rcheck: mono $(regtests)
        $(RUNTIME) --regression $(regtests)
-       $(RUNTIME2) --regression $(regtests2)
 
 aotcheck: mono $(regtests)
-       for i in $(regtests); do $(RUNTIME) --aot $$i || exit 1; done
-       for i in $(regtests2); do $(RUNTIME2) --aot $$i || exit 1; done
+       rm -f *.exe.so
+       $(RUNTIME) --aot $(regtests) || exit 1
        for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
-       for i in $(regtests2); do $(RUNTIME_AOTCHECK2) --regression $$i || exit 1; done
        rm -f *.exe.so
 
 bench: mono test.exe
@@ -502,12 +514,12 @@ endif
 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
 EXTRA_DIST = $(common_BURGSRC) cprop.c TestDriver.cs ldscript ldscript.mono \
        genmdesc.pl     \
-       $(test_sources) $(test_sources2) \
+       $(test_sources) \
        inssel-long.brg inssel-long32.brg \
        inssel-softfloat.brg    \
        $(x86_sources) inssel-x86.brg cpu-x86.md \
        $(amd64_sources) inssel-amd64.brg cpu-amd64.md \
-       $(ppc_sources) inssel-ppc.brg cpu-g4.md \
+       $(ppc_sources) inssel-ppc.brg cpu-ppc.md \
        $(arm_sources) inssel-arm.brg cpu-arm.md \
        $(mips_sources) inssel-mips.brg inssel-long32-mips.brg cpu-mips.md \
        $(sparc_sources) inssel-sparc.brg cpu-sparc.md \
@@ -518,11 +530,13 @@ EXTRA_DIST = $(common_BURGSRC) cprop.c TestDriver.cs ldscript ldscript.mono \
        $(hppa_sources) inssel-hppa.brg cpu-hppa.md
 
 version.h: Makefile
-       if test -d $(srcdir)/.svn; then \
-               (cd $(srcdir);  \
-                       export LANG=C;  \
-                       branch=`svn info | grep URL | sed -e 's/.*source//' -e 's,mono/mono/mini,,'`; \
-                       version=`svn info | grep Revision | sed 's/.*: //'`; \
+       if test -d $(top_srcdir)/.git/svn; then svn_info='git svn info'; fi; \
+       if test -d $(srcdir)/.svn; then svn_info='svn info'; fi; \
+       if test -n "$$svn_info"; then \
+               (cd $(top_srcdir); \
+                       LANG=C; export LANG; \
+                       branch=`$$svn_info | grep URL | sed -e 's/.*source//' -e 's,mono/?$$,,'`; \
+                       version=`$$svn_info | grep Revision | sed 's/.*: //'`; \
                        echo "#define FULL_VERSION \"$$branch r$$version\""; \
                ); \
        else \