Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / mini / Makefile.am.in
index c739de5371f868131cae4d2e61cc1540b16e2c03..28fb9ee5b8d2fdbc6a19ed9ea8541ad4814c313b 100755 (executable)
@@ -30,6 +30,18 @@ sgen_libs = \
        $(monodir)/mono/utils/libmonoutils.la \
        $(GLIB_LIBS) $(LIBICONV)
 
+boehm_static_libs=     \
+       $(monodir)/mono/metadata/libmonoruntime-static.la       \
+       $(monodir)/mono/utils/libmonoutils.la \
+       $(GLIB_LIBS) $(LIBICONV) \
+       $(libgc_static_libs)
+
+sgen_static_libs = \
+       $(monodir)/mono/metadata/libmonoruntimesgen-static.la   \
+       $(monodir)/mono/sgen/libmonosgen-static.la      \
+       $(monodir)/mono/utils/libmonoutils.la \
+       $(GLIB_LIBS) $(LIBICONV)
+
 if FULL_AOT_TESTS
 # if the tests are going to run with framework assemblies compiled with
 # -d:MOBILE, tell the runtime to remap framework assemblies using the mobile
@@ -75,7 +87,7 @@ monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
 if HOST_WIN32
 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
 else
-if PLATFORM_ANDROID
+if HOST_ANDROID
 libmonoldflags= -avoid-version $(monoldflags)
 else
 libmonoldflags=$(monoldflags) -version-info 1:0:0
@@ -85,12 +97,12 @@ endif
 if SUPPORT_SGEN
 sgen_binaries = mono-sgen
 sgen_libraries = libmonosgen-2.0.la
-sgen_static_libraries = libmini.la $(sgen_libs)
+sgen_static_libraries = libmini-static.la $(sgen_static_libs)
 endif
 
 if SUPPORT_BOEHM
 boehm_libraries = libmonoboehm-2.0.la
-boehm_static_libraries = libmini.la $(boehm_libs)
+boehm_static_libraries = libmini-static.la $(boehm_static_libs)
 boehm_binaries  = mono-boehm
 endif
 
@@ -149,14 +161,14 @@ endif
 if DISABLE_EXECUTABLES
 noinst_LTLIBRARIES = $(mini_common_lib)
 else
-noinst_LTLIBRARIES = $(mini_common_lib)
+noinst_LTLIBRARIES = $(mini_common_lib) libmini-static.la
 endif
 
 if LOADED_LLVM
 lib_LTLIBRARIES += libmono-llvm.la
 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
+if HOST_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 $(boehm_libs)
@@ -183,12 +195,20 @@ mono_sgen_CFLAGS = $(AM_CFLAGS)
 # We build this after libmono was built so it contains the date when the final
 # link was done
 if SUPPORT_BOEHM
-buildver-boehm.h: libmini.la $(monodir)/mono/metadata/libmonoruntime.la
+if DISABLE_EXECUTABLES
+buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime.la
+else
+buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la
+endif
        @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
 mono_boehm-main.$(OBJEXT): buildver-boehm.h
 endif
 
-buildver-sgen.h: libmini.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la
+if DISABLE_EXECUTABLES
+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 $(monodir)/mono/sgen/libmonosgen-static.la
+endif
        @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
 mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h
 main-sgen.$(OBJEXT): buildver-sgen.h
@@ -292,6 +312,12 @@ genmdesc_LDADD = \
        $(GLIB_LIBS)                                    \
        $(LIBICONV)
 
+wasm_sources = \
+       mini-wasm.c             \
+       mini-wasm.h             \
+       exceptions-wasm.c       \
+       tramp-wasm.c
+
 x86_sources = \
        mini-x86.c              \
        mini-x86.h              \
@@ -436,6 +462,7 @@ common_sources = \
        aot-compiler.h          \
        aot-compiler.c          \
        aot-runtime.c           \
+       aot-runtime-wasm.c      \
        graph.c                 \
        mini-codegen.c          \
        mini-exceptions.c       \
@@ -521,6 +548,12 @@ endif
 
 regtests = $(filter-out $(regtests_DISABLED),$(regtests_UNIVERSAL))
 
+if WASM
+arch_sources = $(wasm_sources)
+arch_built=cpu-wasm.h
+arch_define=__wasm__
+endif
+
 if X86
 arch_sources = $(x86_sources)
 arch_built=cpu-x86.h
@@ -589,21 +622,17 @@ os_sources = $(windows_sources)
 monobin_platform_ldflags=
 endif
 
-if PLATFORM_SIGPOSIX
+if HOST_SIGPOSIX
 os_sources = $(posix_sources)
 monobin_platform_ldflags=
 endif
 
-if PLATFORM_DARWIN
+if HOST_DARWIN
 os_sources = $(darwin_sources) $(posix_sources)
 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
 endif
 
-#
-# This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
-# compile time dependencies on boehm/sgen.
-#
 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(interp_sources) $(arch_sources) $(os_sources)
 libmini_la_CFLAGS = $(mono_CFLAGS)
 
@@ -617,6 +646,15 @@ libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags)
 
+#
+# This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
+# compile time dependencies on boehm/sgen.
+#
+libmini_static_la_SOURCES = $(libmini_la_SOURCES)
+libmini_static_la_CFLAGS = $(AM_CFLAGS)
+libmini_static_la_LDFLAGS = -static
+libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
+
 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
 
 libmonoinclude_HEADERS = jit.h
@@ -662,12 +700,20 @@ GENMDESC_OPTS=
 # 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 $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
-else !CROSS_COMPILING
+else
+if WASM
+GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
+else
 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
+endif
 endif !CROSS_COMPILING
 
+cpu-wasm.h: cpu-wasm.md genmdesc$(EXEEXT)
+       $(GENMDESC_PRG) cpu-wasm.h wasm_desc $(srcdir)/cpu-wasm.md
+
 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
        $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
 
@@ -857,6 +903,7 @@ EXTRA_DIST = TestDriver.cs \
        TestHelpers.cs \
        genmdesc.pl                             \
        $(test_sources)                         \
+       $(wasm_sources) cpu-wasm.md             \
        $(x86_sources) cpu-x86.md               \
        $(amd64_sources) cpu-amd64.md           \
        $(ppc_sources) cpu-ppc.md cpu-ppc64.md  \