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