1 include $(top_srcdir)/mk/common.mk
4 -DSUPPRESSION_DIR=\""$(datadir)/mono-$(API_VER)/mono/profiler"\" \
8 glib_libs = $(top_builddir)/mono/eglib/libeglib.la
14 bin_PROGRAMS = mprof-report
18 libmono-profiler-vtune.la \
19 libmono-profiler-vtune-static.la
23 libmono-profiler-aot.la \
24 libmono-profiler-aot-static.la \
25 libmono-profiler-log.la \
26 libmono-profiler-log-static.la \
27 libmono-profiler-coverage.la \
28 libmono-profiler-coverage-static.la \
31 suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
32 suppression_DATA = mono-profiler-coverage.suppression
34 # FIXME: The profiler tests currently don't work with coop because the
35 # sampling infrastructure depends on signals being available.
37 # See: https://bugzilla.xamarin.com/show_bug.cgi?id=57011
38 if !ENABLE_COOP_SUSPEND
39 check_targets = run-test
46 # On Apple hosts, we want to allow undefined symbols when building the
47 # profiler modules as, just like on Linux, we don't link them to libmono,
48 # but rather let the dynamic linker sort things out.
50 # Bitcode, specifically, doesn't allow undefined symbols at all, even for
51 # shared libraries, so we want errors if the profiler modules contain any.
54 prof_ldflags = -no-undefined
56 prof_ldflags = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
60 # Versioned libraries are problematic on Android. In particular, we're not
61 # allowed to place versioned libraries inside APKs, so if libmono and the
62 # profiler modules contain versioned sonames, things will fail to resolve
65 prof_ldflags = -avoid-version
68 # Linking to libmono on desktop can cause problems when loading a profiler
69 # module into a statically-linked mono executable, e.g. running library
70 # constructors multiple times, which can easily break LLVM libraries. So,
71 # we don't want to link to libmono on desktop. On Android, libmono is
72 # always loaded dynamically, so we do need to link to libmono there or the
73 # dynamic linker will have trouble resolving everything. On iOS, the story
74 # is similar to Android when running in the simulator.
76 libmono_dep = $(top_builddir)/mono/mini/$(LIBMONO_LA)
79 # Note that BITCODE implies HOST_IOS, so this case ensures that we link to
80 # libmono when building a bitcode runtime.
81 libmono_dep = $(top_builddir)/mono/mini/$(LIBMONO_LA)
84 libmono_dep = $(top_builddir)/mono/mini/$(LIBMONO_LA)
86 # BITCODE => -no-undefined
89 libmono_dep = $(top_builddir)/mono/mini/$(LIBMONO_LA)
101 # The log profiler uses zlib for output compression when available.
107 # We build a separate, static version of each profiler for use on targets
108 # which do not support dynamic linking (e.g. iOS). We still want to build
109 # the shared version on those targets since it's useful for e.g. simulator
112 libmono_profiler_aot_la_SOURCES = aot.c
113 libmono_profiler_aot_la_LIBADD = $(libmono_dep) $(glib_libs)
114 libmono_profiler_aot_la_LDFLAGS = $(prof_ldflags)
115 libmono_profiler_aot_static_la_SOURCES = aot.c
116 libmono_profiler_aot_static_la_LDFLAGS = -static
118 libmono_profiler_log_la_SOURCES = log.c log-args.c
119 libmono_profiler_log_la_LIBADD = $(libmono_dep) $(glib_libs) $(zlib_dep)
120 libmono_profiler_log_la_LDFLAGS = $(prof_ldflags)
121 libmono_profiler_log_static_la_SOURCES = log.c log-args.c
122 libmono_profiler_log_static_la_LDFLAGS = -static
124 libmono_profiler_coverage_la_SOURCES = coverage.c
125 libmono_profiler_coverage_la_LIBADD = $(libmono_dep) $(glib_libs)
126 libmono_profiler_coverage_la_LDFLAGS = $(prof_ldflags)
127 libmono_profiler_coverage_static_la_SOURCES = coverage.c
128 libmono_profiler_coverage_static_la_LDFLAGS = -static
131 libmono_profiler_vtune_la_SOURCES = vtune.c
132 libmono_profiler_vtune_la_CFLAGS = $(VTUNE_CFLAGS)
133 libmono_profiler_vtune_la_LIBADD = $(VTUNE_LIBS) $(libmono_dep) $(glib_libs)
134 libmono_profiler_vtune_la_LDFLAGS = $(prof_ldflags)
135 libmono_profiler_vtune_static_la_SOURCES = vtune.c
136 libmono_profiler_vtune_static_la_LDFLAGS = -static
137 libmono_profiler_vtune_static_la_CFLAGS = $(VTUNE_CFLAGS)
138 libmono_profiler_vtune_static_la_LIBADD = $(VTUNE_LIBS)
141 mprof_report_SOURCES = mprof-report.c
142 mprof_report_LDADD = $(glib_libs) $(zlib_dep)
143 mprof_report_LDFLAGS = -no-undefined
153 PLOG_TESTS = $(PLOG_TESTS_SRC:.cs=.exe)
155 CLASS = $(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
156 TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/mono-wrapper
157 MCS = $(TOOLS_RUNTIME) $(CSC) -lib:$(CLASS) -unsafe -nologo -noconfig -nowarn:0162 -nowarn:0168 -nowarn:0219 -debug:portable
162 test-local: $(PLOG_TESTS)
165 mkdir -p $(TEST_BUNDLE_PATH)/tests/profiler/
166 cp -L .libs/libmono-profiler-log$(libsuffix) $(TEST_BUNDLE_PATH)/
167 cp -L $(PLOG_TESTS) $(TEST_BUNDLE_PATH)/tests/profiler/
168 cp -L ptestrunner.pl $(TEST_BUNDLE_PATH)/tests/profiler/
169 cp -L mprof-report $(TEST_BUNDLE_PATH)/
170 chmod +x $(TEST_BUNDLE_PATH)/mprof-report
173 MONO_PATH=$(CLASS) perl $(srcdir)/ptestrunner.pl $(top_builddir) nunit TestResult-profiler.xml
175 check-local: $(check_targets)