Merge pull request #2881 from alexrp/gc-sample-managed-alloc
[mono.git] / mono / profiler / Makefile.am
1 if HAVE_ZLIB
2 Z_LIBS= -lz
3 else
4 Z_LIBS=
5 endif
6
7 AM_CPPFLAGS = \
8         -DSUPPRESSION_DIR=\""$(datadir)/mono-$(API_VER)/mono/profiler"\"        \
9         -I$(top_srcdir)         \
10         $(GLIB_CFLAGS)
11
12 if !HOST_WIN32
13 if !DISABLE_LIBRARIES
14 if !DISABLE_PROFILER
15 bin_PROGRAMS = mprof-report
16
17 if !BITCODE
18 prof_shlibs = \
19         libmono-profiler-aot.la \
20         libmono-profiler-iomap.la \
21         libmono-profiler-log.la
22 endif
23
24 if HAVE_VTUNE
25 vtune_stlibs = libmono-profiler-vtune-static.la
26 if !BITCODE
27 vtune_shlibs = libmono-profiler-vtune.la
28 endif
29 endif
30
31 lib_LTLIBRARIES = \
32         $(prof_shlibs) \
33         libmono-profiler-aot-static.la \
34         libmono-profiler-iomap-static.la \
35         libmono-profiler-log-static.la \
36         $(vtune_shlibs) \
37         $(vtune_stlibs)
38
39 if PLATFORM_DARWIN
40 prof_ldflags = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
41 endif
42
43 if PLATFORM_ANDROID
44 prof_ldflags = -avoid-version
45 endif
46
47 endif
48 endif
49 endif
50
51 # The log profiler uses eglib functions, so it needs to be linked against
52 # libeglib in shared mode, but not in static mode, since that would
53 # leads to duplicate symbols when it is linked into an app which
54 # also uses eglib (e.g. the runtime). Automake doesn't support this
55 # functionality, so create a separate static version of the library.
56
57 libmono_profiler_aot_la_SOURCES = mono-profiler-aot.c
58 libmono_profiler_aot_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
59 libmono_profiler_aot_la_LDFLAGS = $(prof_ldflags)
60 libmono_profiler_aot_static_la_SOURCES = mono-profiler-aot.c
61 libmono_profiler_aot_static_la_LDFLAGS = -static
62
63 libmono_profiler_iomap_la_SOURCES = mono-profiler-iomap.c
64 libmono_profiler_iomap_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
65 libmono_profiler_iomap_la_LDFLAGS = $(prof_ldflags)
66 libmono_profiler_iomap_static_la_SOURCES = mono-profiler-iomap.c
67 libmono_profiler_iomap_static_la_LDFLAGS = -static
68
69 libmono_profiler_log_la_SOURCES = proflog.c
70 libmono_profiler_log_la_LIBADD = $(GLIB_LIBS) $(Z_LIBS)
71 libmono_profiler_log_la_LDFLAGS = $(prof_ldflags)
72 libmono_profiler_log_static_la_SOURCES = proflog.c
73 libmono_profiler_log_static_la_LDFLAGS = -static
74
75 if HAVE_VTUNE
76 libmono_profiler_vtune_la_SOURCES = mono-profiler-vtune.c
77 libmono_profiler_vtune_la_CFLAGS = $(VTUNE_CFLAGS)
78 libmono_profiler_vtune_la_LIBADD = $(VTUNE_LIBS) $(GLIB_LIBS) $(LIBICONV)
79 libmono_profiler_vtune_la_LDFLAGS = $(prof_ldflags)
80 libmono_profiler_vtune_static_la_SOURCES = mono-profiler-vtune.c
81 libmono_profiler_vtune_static_la_LDFLAGS = -static
82 endif
83
84 mprof_report_SOURCES = decode.c
85 mprof_report_LDADD = $(Z_LIBS) $(GLIB_LIBS) $(LIBICONV)
86
87 # FIXME fix the profiler tests to work with coop.
88 if ENABLE_COOP
89 DISABLE_PROFILER_TESTS=1
90 endif
91 PLOG_TESTS_SRC=test-alloc.cs test-busy.cs test-monitor.cs test-excleave.cs \
92         test-heapshot.cs test-traces.cs
93 PLOG_TESTS=$(PLOG_TESTS_SRC:.cs=.exe)
94
95 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
96
97 with_mono_path = MONO_PATH=$(CLASS)
98
99 RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper
100 MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219 -debug
101
102 %.exe: %.cs
103         $(MCS) -out:$@ $<
104
105 testlog: $(PLOG_TESTS)
106         if [ "z$(DISABLE_PROFILER_TESTS)" != z1 ]; then \
107                 $(with_mono_path) perl $(srcdir)/ptestrunner.pl $(top_builddir) ; \
108         else \
109                 echo "Profiler tests disabled with cooperative GC" ; \
110         fi
111
112
113 if NACL_CODEGEN
114 check-local:
115 else
116 check-local: testlog
117 endif
118
119 suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
120 suppression_DATA = mono-profiler-log.suppression
121
122 EXTRA_DIST=utils.c utils.h proflog.h \
123         $(PLOG_TESTS_SRC) ptestrunner.pl \
124         $(suppression_DATA)