[ci] Add targets to bundle tests and add a script to run them in Helix
[mono-project.git] / mono / profiler / Makefile.am
blob16b3dae1a1c6cf128fcae3141053d5e03f5e4e22
1 include $(top_srcdir)/mk/common.mk
3 AM_CPPFLAGS = \
4         -DSUPPRESSION_DIR=\""$(datadir)/mono-$(API_VER)/mono/profiler"\" \
5         -I$(top_srcdir) \
6         $(GLIB_CFLAGS)
8 glib_libs = $(top_builddir)/mono/eglib/libeglib.la
10 if !HOST_WIN32
11 if !DISABLE_LIBRARIES
12 if !DISABLE_PROFILER
14 bin_PROGRAMS = mprof-report
16 if HAVE_VTUNE
17 vtune_libs = \
18         libmono-profiler-vtune.la \
19         libmono-profiler-vtune-static.la
20 endif
22 lib_LTLIBRARIES = \
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 \
29         $(vtune_libs)
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
40 endif
42 endif
43 endif
44 endif
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.
52 if HOST_DARWIN
53 if BITCODE
54 prof_ldflags = -no-undefined
55 else
56 prof_ldflags = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
57 endif
58 endif
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
63 # at runtime.
64 if HOST_ANDROID
65 prof_ldflags = -avoid-version
66 endif
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.
75 if HOST_ANDROID
76 libmono_dep = $(top_builddir)/mono/mini/$(LIBMONO_LA)
77 else
78 if HOST_IOS
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)
82 else
83 if HOST_TIZEN
84 libmono_dep = $(top_builddir)/mono/mini/$(LIBMONO_LA)
85 else
86 # BITCODE => -no-undefined
87 if HOST_DARWIN
88 if BITCODE
89 libmono_dep = $(top_builddir)/mono/mini/$(LIBMONO_LA)
90 else
91 libmono_dep =
92 endif
93 else
94 libmono_dep =
95 endif
96 endif
97 endif
98 endif
100 if HAVE_ZLIB
101 # The log profiler uses zlib for output compression when available.
102 zlib_dep = -lz
103 else
104 zlib_dep =
105 endif
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
110 # builds.
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
130 if HAVE_VTUNE
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)
139 endif
141 mprof_report_SOURCES = mprof-report.c
142 mprof_report_LDADD = $(glib_libs) $(zlib_dep)
143 mprof_report_LDFLAGS = -no-undefined
145 PLOG_TESTS_SRC = \
146         test-alloc.cs \
147         test-busy.cs \
148         test-monitor.cs \
149         test-excleave.cs \
150         test-heapshot.cs \
151         test-traces.cs
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
159 %.exe: %.cs
160         $(MCS) -out:$@ $<
162 test-local: $(PLOG_TESTS)
164 test-bundle-local:
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
172 run-test: test
173         MONO_PATH=$(CLASS) perl $(srcdir)/ptestrunner.pl $(top_builddir) nunit TestResult-profiler.xml
175 check-local: $(check_targets)
177 EXTRA_DIST = \
178         log.h \
179         aot.h \
180         $(PLOG_TESTS_SRC) \
181         ptestrunner.pl \
182         $(suppression_DATA)