[profiler] Link profiler libraries against libmono (revert of 92341a).
[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 suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
40 suppression_DATA = mono-profiler-log.suppression
41
42 if PLATFORM_DARWIN
43 prof_ldflags = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
44 endif
45
46 if PLATFORM_ANDROID
47 prof_ldflags = -avoid-version
48 endif
49
50 # FIXME fix the profiler tests to work with coop.
51 if !ENABLE_COOP
52 if !NACL_CODEGEN
53 check_targets = testlog
54 endif
55 endif
56
57 endif
58 endif
59 endif
60
61 # The log profiler uses eglib functions, so it needs to be linked against
62 # libeglib in shared mode, but not in static mode, since that would
63 # leads to duplicate symbols when it is linked into an app which
64 # also uses eglib (e.g. the runtime). Automake doesn't support this
65 # functionality, so create a separate static version of the library.
66
67 libmono_profiler_aot_la_SOURCES = mono-profiler-aot.c
68 libmono_profiler_aot_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
69 libmono_profiler_aot_la_LDFLAGS = $(prof_ldflags)
70 libmono_profiler_aot_static_la_SOURCES = mono-profiler-aot.c
71 libmono_profiler_aot_static_la_LDFLAGS = -static
72
73 libmono_profiler_iomap_la_SOURCES = mono-profiler-iomap.c
74 libmono_profiler_iomap_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
75 libmono_profiler_iomap_la_LDFLAGS = $(prof_ldflags)
76 libmono_profiler_iomap_static_la_SOURCES = mono-profiler-iomap.c
77 libmono_profiler_iomap_static_la_LDFLAGS = -static
78
79 libmono_profiler_log_la_SOURCES = proflog.c
80 libmono_profiler_log_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(Z_LIBS)
81 libmono_profiler_log_la_LDFLAGS = $(prof_ldflags)
82 libmono_profiler_log_static_la_SOURCES = proflog.c
83 libmono_profiler_log_static_la_LDFLAGS = -static
84
85 if HAVE_VTUNE
86 libmono_profiler_vtune_la_SOURCES = mono-profiler-vtune.c
87 libmono_profiler_vtune_la_CFLAGS = $(VTUNE_CFLAGS)
88 libmono_profiler_vtune_la_LIBADD = $(VTUNE_LIBS) $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
89 libmono_profiler_vtune_la_LDFLAGS = $(prof_ldflags)
90 libmono_profiler_vtune_static_la_SOURCES = mono-profiler-vtune.c
91 libmono_profiler_vtune_static_la_LDFLAGS = -static
92 endif
93
94 mprof_report_SOURCES = decode.c
95 mprof_report_LDADD = $(Z_LIBS) $(GLIB_LIBS) $(LIBICONV)
96
97 PLOG_TESTS_SRC=test-alloc.cs test-busy.cs test-monitor.cs test-excleave.cs \
98         test-heapshot.cs test-traces.cs
99 PLOG_TESTS=$(PLOG_TESTS_SRC:.cs=.exe)
100
101 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
102
103 with_mono_path = MONO_PATH=$(CLASS)
104
105 RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper
106 MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219 -debug
107
108 %.exe: %.cs
109         $(MCS) -out:$@ $<
110
111 testlog: $(PLOG_TESTS)
112         $(with_mono_path) perl $(srcdir)/ptestrunner.pl $(top_builddir)
113
114 check-local: $(check_targets)
115
116 EXTRA_DIST=utils.c utils.h proflog.h \
117         $(PLOG_TESTS_SRC) ptestrunner.pl \
118         $(suppression_DATA)