Merge pull request #4327 from vkargov/vk-abcremedy
[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 HAVE_VTUNE
18 vtune_libs = libmono-profiler-vtune.la libmono-profiler-vtune-static.la
19 endif
20
21 lib_LTLIBRARIES = \
22         libmono-profiler-aot.la \
23         libmono-profiler-aot-static.la \
24         libmono-profiler-iomap.la \
25         libmono-profiler-iomap-static.la \
26         libmono-profiler-log.la \
27         libmono-profiler-log-static.la \
28         $(vtune_libs)
29
30 suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
31 suppression_DATA = mono-profiler-log.suppression
32
33 if PLATFORM_DARWIN
34 if BITCODE
35 prof_ldflags = -no-undefined
36 else
37 prof_ldflags = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
38 endif
39 endif
40
41 if TARGET_OSX
42 libmono_dep =
43 else
44 libmono_dep = $(monodir)/mono/mini/$(LIBMONO_LA)
45 endif
46
47 if PLATFORM_ANDROID
48 prof_ldflags = -avoid-version
49 endif
50
51 # FIXME fix the profiler tests to work with coop.
52 if !ENABLE_COOP
53 if !NACL_CODEGEN
54 check_targets = testlog
55 endif
56 endif
57
58 endif
59 endif
60 endif
61
62 monodir=$(top_builddir)
63
64 # The log profiler uses eglib functions, so it needs to be linked against
65 # libeglib in shared mode, but not in static mode, since that would
66 # leads to duplicate symbols when it is linked into an app which
67 # also uses eglib (e.g. the runtime). Automake doesn't support this
68 # functionality, so create a separate static version of the library.
69
70 libmono_profiler_aot_la_SOURCES = mono-profiler-aot.c
71 libmono_profiler_aot_la_LIBADD =  $(libmono_dep) $(GLIB_LIBS) $(LIBICONV)
72 libmono_profiler_aot_la_LDFLAGS = $(prof_ldflags)
73 libmono_profiler_aot_static_la_SOURCES = mono-profiler-aot.c
74 libmono_profiler_aot_static_la_LDFLAGS = -static
75
76 libmono_profiler_iomap_la_SOURCES = mono-profiler-iomap.c
77 libmono_profiler_iomap_la_LIBADD = $(libmono_dep) $(GLIB_LIBS) $(LIBICONV)
78 libmono_profiler_iomap_la_LDFLAGS = $(prof_ldflags)
79 libmono_profiler_iomap_static_la_SOURCES = mono-profiler-iomap.c
80 libmono_profiler_iomap_static_la_LDFLAGS = -static
81
82 libmono_profiler_log_la_SOURCES = mono-profiler-log.c
83 libmono_profiler_log_la_LIBADD = $(libmono_dep) $(GLIB_LIBS) $(Z_LIBS)
84 libmono_profiler_log_la_LDFLAGS = $(prof_ldflags)
85 libmono_profiler_log_static_la_SOURCES = mono-profiler-log.c
86 libmono_profiler_log_static_la_LDFLAGS = -static
87
88 if HAVE_VTUNE
89 libmono_profiler_vtune_la_SOURCES = mono-profiler-vtune.c
90 libmono_profiler_vtune_la_CFLAGS = $(VTUNE_CFLAGS)
91 libmono_profiler_vtune_la_LIBADD = $(VTUNE_LIBS) $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
92 libmono_profiler_vtune_la_LDFLAGS = $(prof_ldflags)
93 libmono_profiler_vtune_static_la_SOURCES = mono-profiler-vtune.c
94 libmono_profiler_vtune_static_la_LDFLAGS = -static
95 libmono_profiler_vtune_static_la_CFLAGS = $(VTUNE_CFLAGS)
96 libmono_profiler_vtune_static_la_LIBADD = $(VTUNE_LIBS)
97 endif
98
99 mprof_report_SOURCES = mprof-report.c
100 mprof_report_LDADD = $(Z_LIBS) $(GLIB_LIBS) $(LIBICONV)
101
102 PLOG_TESTS_SRC=test-alloc.cs test-busy.cs test-monitor.cs test-excleave.cs \
103         test-heapshot.cs test-traces.cs
104 PLOG_TESTS=$(PLOG_TESTS_SRC:.cs=.exe)
105
106 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
107
108 TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/mono-wrapper
109 MCS = $(TOOLS_RUNTIME) $(CSC) -lib:$(CLASS) -unsafe -nologo -noconfig -nowarn:0162 -nowarn:0168 -nowarn:0219 -debug:portable
110
111 %.exe: %.cs
112         $(MCS) -out:$@ $<
113
114 testlog: $(PLOG_TESTS)
115         MONO_PATH=$(CLASS) perl $(srcdir)/ptestrunner.pl $(top_builddir)
116
117 check-local: $(check_targets)
118
119 EXTRA_DIST=mono-profiler-log.h \
120         mono-profiler-aot.h \
121         $(PLOG_TESTS_SRC) \
122         ptestrunner.pl \
123         $(suppression_DATA)