[profiler] Avoid a crash at shutdown by installing the assembly unload hook for the...
[mono.git] / mono / profiler / Makefile.am
index 4577fc9a9f8d5cafadc123328851bd3d69fa5125..e467bb16676bca8bae89fc9a573f0a40300c6640 100644 (file)
@@ -4,18 +4,30 @@ else
 Z_LIBS=
 endif
 
-INCLUDES = \
+AM_CPPFLAGS = \
        -fexceptions -DMONO_USE_EXC_TABLES      \
+       -DSUPPRESSION_DIR=\""$(datadir)/mono-$(API_VER)/mono/profiler"\"        \
        -I$(top_srcdir)         \
        $(GLIB_CFLAGS)
 
+if !HOST_WIN32
+if !DISABLE_LIBRARIES
 if !DISABLE_PROFILER
-if JIT_SUPPORTED
 bin_PROGRAMS = mprof-report
-lib_LTLIBRARIES = libmono-profiler-cov.la libmono-profiler-aot.la libmono-profiler-iomap.la libmono-profiler-log.la
+
+if HAVE_VTUNE
+vtune_lib = libmono-profiler-vtune.la
+endif
+
+lib_LTLIBRARIES = libmono-profiler-aot.la libmono-profiler-iomap.la libmono-profiler-log.la libmono-profiler-log-static.la $(vtune_lib)
+
 if PLATFORM_DARWIN
 libmono_profiler_log_la_LDFLAGS = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
 endif
+if PLATFORM_ANDROID
+libmono_profiler_log_la_LDFLAGS = -avoid-version
+endif
+endif
 endif
 endif
 
@@ -24,30 +36,56 @@ if HAVE_OPROFILE
 endif
 
 if SUPPORT_BOEHM
-LIBMONO=$(top_builddir)/mono/mini/libmono-$(API_VER).la
+if DISABLE_EXECUTABLES
+LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA)
+else
+if !SHARED_MONO
+static_libs=   \
+       $(top_builddir)/mono/metadata/libmonoruntime-static.la  \
+       $(top_builddir)/mono/io-layer/libwapi.la        \
+       $(top_builddir)/mono/utils/libmonoutils.la \
+       $(GLIB_LIBS) $(LIBICONV) \
+       $(LIBGC_STATIC_LIBS)
+
+LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA) $(static_libs)
+else
+LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA)
+endif
+endif
 else
 LIBMONO=$(top_builddir)/mono/mini/libmonosgen-$(API_VER).la
 endif
 
-libmono_profiler_cov_la_SOURCES = mono-cov.c
-libmono_profiler_cov_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
 libmono_profiler_aot_la_SOURCES = mono-profiler-aot.c
 libmono_profiler_aot_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
-#libmono_profiler_logging_la_SOURCES = mono-profiler-logging.c
-#libmono_profiler_logging_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
 libmono_profiler_iomap_la_SOURCES = mono-profiler-iomap.c
 libmono_profiler_iomap_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
 libmono_profiler_log_la_SOURCES = proflog.c
-libmono_profiler_log_la_LIBADD = $(LIBMONO) $(Z_LIBS)
+libmono_profiler_log_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(Z_LIBS)
+if HAVE_VTUNE
+libmono_profiler_vtune_la_SOURCES = mono-profiler-vtune.c
+libmono_profiler_vtune_la_CFLAGS = $(VTUNE_CFLAGS)
+libmono_profiler_vtune_la_LIBADD = $(VTUNE_LIBS) $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
+endif
+
+# The log profile uses eglib functions, so it needs to be linked against
+# libeglib in shared mode, but not in static mode, since that would
+# leads to duplicate symbols when it is linked into an app which
+# also uses eglib (e.g. the runtime). Automake doesn't support this
+# functionality, so create a separate static version of the library.
+libmono_profiler_log_static_la_SOURCES = proflog.c
+libmono_profiler_log_static_la_LDFLAGS = -static
 
 mprof_report_SOURCES = decode.c
-mprof_report_LDADD = $(Z_LIBS)
+mprof_report_LDADD = $(Z_LIBS) $(GLIB_LIBS) $(LIBICONV)
 
 PLOG_TESTS_SRC=test-alloc.cs test-busy.cs test-monitor.cs test-excleave.cs \
        test-heapshot.cs test-traces.cs
 PLOG_TESTS=$(PLOG_TESTS_SRC:.cs=.exe)
 
-with_mono_path = MONO_PATH=$(mcs_topdir)/class/lib/net_4_0
+CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
+
+with_mono_path = MONO_PATH=$(CLASS)
 
 RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper
 MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219 -debug
@@ -58,7 +96,15 @@ MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162 -now
 testlog: $(PLOG_TESTS)
        $(with_mono_path) perl $(srcdir)/ptestrunner.pl $(top_builddir)
 
+if NACL_CODEGEN
+check-local:
+else
 check-local: testlog
+endif
+
+suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
+suppression_DATA = mono-profiler-log.suppression
 
-EXTRA_DIST=utils.c utils.h proflog.h log-profiler.txt perf_event.h \
-       $(PLOG_TESTS_SRC) ptestrunner.pl
+EXTRA_DIST=utils.c utils.h proflog.h perf_event.h \
+       $(PLOG_TESTS_SRC) ptestrunner.pl \
+       $(suppression_DATA)