renamed
[mono.git] / mono / mini / Makefile.am
1 count=100000
2 mtest=for_loop
3 monodir=$(top_builddir)
4
5 # This is needed for automake dependency generation
6 if INCLUDED_LIBGC
7 libgc_libs=$(monodir)/libgc/libmonogc.la
8 libgc_static_libs=$(monodir)/libgc/libmonogc-static.la
9 else
10 libgc_libs=$(LIBGC_LIBS)
11 libgc_static_libs=$(LIBGC_STATIC_LIBS)
12 endif
13
14 libs=   \
15         $(monodir)/mono/metadata/libmonoruntime.la      \
16         $(monodir)/mono/metadata/libmetadata.la \
17         $(monodir)/mono/io-layer/libwapi.la     \
18         $(monodir)/mono/utils/libmonoutils.la \
19         $(GMODULE_LIBS) \
20         $(GLIB_LIBS)    \
21         $(libgc_libs)   \
22         $(ICU_LIBS)
23
24 static_libs=    \
25         $(monodir)/mono/metadata/libmonoruntime-static.la       \
26         $(monodir)/mono/metadata/libmetadata-static.la  \
27         $(monodir)/mono/io-layer/libwapi.la     \
28         $(monodir)/mono/utils/libmonoutils.la \
29         $(GMODULE_LIBS) \
30         $(GLIB_LIBS)    \
31         $(libgc_static_libs) \
32         $(ICU_LIBS)
33
34 RUNTIME = $(LIBTOOL) --mode=execute ./mono
35 MCS = MONO_PATH=$(top_srcdir)/runtime/net_1_1 $(RUNTIME) --config $(top_builddir)/data/config $(top_srcdir)/runtime/mcs.exe --unsafe -nowarn:0162
36 ILASM = MONO_PATH=$(top_srcdir)/runtime/net_1_1 $(RUNTIME) --config ../../data/config $(top_srcdir)/runtime/ilasm.exe
37
38 INCLUDES = \
39         -I$(top_srcdir)         \
40         $(LIBGC_CFLAGS)         \
41         $(GMODULE_CFLAGS)               \
42         $(GLIB_CFLAGS)
43
44 if PLATFORM_WIN32
45 export HOST_CC
46 # The mingw math.h has "extern inline" functions that dont appear in libs, so
47 # optimisation is required to actually inline them
48 AM_CFLAGS = -O
49 endif
50
51 # hack for automake to have the same source file in a library and a bin
52 genmdesc_CFLAGS = $(AM_CFLAGS)
53
54 if NO_VERSION_SCRIPT
55 monoldflags=
56 else
57 monoldflags=-Wl,-version-script=$(srcdir)/ldscript
58 endif
59
60 if PLATFORM_WIN32
61 libmono_la_LDFLAGS=-no-undefined -version-info 1:0:0 $(monoldflags)
62 else
63 libmono_la_LDFLAGS=$(monoldflags)
64 endif
65
66 if JIT_SUPPORTED
67 bin_PROGRAMS = mono
68
69 noinst_PROGRAMS = genmdesc
70
71 lib_LTLIBRARIES = libmono.la
72 noinst_LTLIBRARIES = libmono-static.la
73 endif
74
75 mono_SOURCES = \
76         main.c
77
78 if STATIC_MONO
79 # Link libmono into mono statically
80 # This leads to higher performance, especially with TLS
81 MONO_LIB=libmono-static.la
82 else 
83 MONO_LIB=libmono.la
84 endif
85
86 mono_LDADD = \
87         $(MONO_LIB)                     \
88         $(GLIB_LIBS)            \
89         $(GMODULE_LIBS) -lm     \
90         $(ICU_LIBS)
91
92 mono_LDFLAGS = \
93         $(static_flags) -export-dynamic $(monoldflags)
94
95 genmdesc_SOURCES = \
96         mini.h          \
97         genmdesc.c      \
98         helpers.c
99
100 # Don't link this against libmetadata to speed up rebuilds
101 genmdesc_LDADD = \
102         $(monodir)/mono/utils/libmonoutils.la $(monodir)/mono/metadata/opcodes.lo -lm   \
103         $(GLIB_LIBS)            \
104         $(GMODULE_LIBS)
105
106 x86_sources = \
107     mini-exceptions.c   \
108         mini-x86.c              \
109         mini-x86.h              \
110         exceptions-x86.c        \
111         tramp-x86.c
112
113 amd64_sources = \
114         mini-exceptions.c       \
115         mini-amd64.c            \
116         mini-amd64.h            \
117         exceptions-amd64.c      \
118         tramp-amd64.c
119
120 ppc_sources = \
121         mini-ppc.c              \
122         mini-ppc.h              \
123         exceptions-ppc.c        \
124         tramp-ppc.c
125
126 sparc_sources = \
127         mini-sparc.c            \
128         mini-sparc.h            \
129     mini-exceptions.c   \
130         exceptions-sparc.c      \
131         tramp-sparc.c
132
133 s390_sources = \
134         mini-s390.c             \
135         mini-s390.h             \
136         exceptions-s390.c       \
137         tramp-s390.c
138
139 s390x_sources = \
140         mini-s390x.c            \
141         mini-s390x.h            \
142         exceptions-s390x.c      \
143         tramp-s390x.c
144
145 common_sources = \
146         mini.c          \
147         mini.h          \
148         trace.c         \
149         trace.h         \
150         mini-ops.h      \
151         mini-arch.h     \
152         dominators.c    \
153         cfold.c         \
154         regalloc.c      \
155         regalloc.h      \
156         helpers.c       \
157         liveness.c      \
158         ssa.c           \
159         abcremoval.c    \
160         abcremoval.h    \
161         driver.c        \
162         debug-mini.c    \
163         linear-scan.c   \
164         aot.c           \
165         graph.c         \
166         declsec.c       \
167         declsec.h
168
169 test_sources =          \
170         basic-calls.cs  \
171         basic-long.cs   \
172         bench.cs                \
173         objects.cs              \
174         arrays.cs               \
175         basic-float.cs  \
176         basic-math.cs   \
177         basic.cs                \
178         exceptions.cs   \
179         iltests.il              \
180         test.cs
181
182 regtests=basic.exe arrays.exe basic-float.exe basic-math.exe basic-long.exe objects.exe basic-calls.exe iltests.exe exceptions.exe bench.exe
183
184 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-float.brg
185
186 if X86
187 libmono_la_SOURCES = \
188         $(common_sources) $(x86_sources)
189
190 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-x86.brg
191 arch_built=cpu-pentium.h
192 endif
193
194 if AMD64
195 libmono_la_SOURCES = \
196         $(common_sources) $(amd64_sources)
197 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-amd64.brg
198 arch_built=cpu-amd64.h
199 endif
200
201 if POWERPC
202 libmono_la_SOURCES = \
203         $(common_sources) $(ppc_sources)
204
205 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-ppc.brg
206 arch_built=cpu-g4.h
207 endif
208
209 if SPARC
210 libmono_la_SOURCES = \
211         $(common_sources) $(sparc_sources)
212
213 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-sparc.brg
214 arch_built=cpu-sparc.h
215 endif
216
217 if SPARC64
218 libmono_la_SOURCES = \
219         $(common_sources) $(sparc_sources)
220
221 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-sparc.brg
222 arch_built=cpu-sparc.h
223 endif
224
225 if S390
226 libmono_la_SOURCES = \
227         $(common_sources) $(s390_sources)
228
229 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-s390.brg
230 arch_built=cpu-s390.h
231 endif
232
233 if S390x
234 libmono_la_SOURCES = \
235         $(common_sources) $(s390x_sources)
236
237 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-s390x.brg
238 arch_built=cpu-s390x.h
239 endif
240
241 nodist_libmono_la_SOURCES = inssel.c inssel.h
242
243 libmono_static_la_SOURCES = $(libmono_la_SOURCES)
244 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
245 libmono_static_la_LDFLAGS = -static
246 libmono_static_la_LIBADD = $(static_libs)
247
248 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
249
250 libmonoincludedir = $(includedir)/mono/jit
251
252 libmonoinclude_HEADERS = jit.h
253
254 libmono_la_LIBADD = \
255         $(libs)
256
257 %.exe: %.cs TestDriver.dll
258         $(MCS) /out:$*.exe /unsafe $< /r:TestDriver.dll
259
260 %.exe: %.il
261         $(ILASM) /output=$*.exe $<
262
263 TestDriver.dll: $(srcdir)/TestDriver.cs
264         $(MCS) /out:TestDriver.dll /target:library $(srcdir)/TestDriver.cs
265
266 cpu-pentium.h: cpu-pentium.md genmdesc$(EXEEXT)
267         ./genmdesc $(srcdir)/cpu-pentium.md cpu-pentium.h pentium_desc
268
269 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
270         ./genmdesc $(srcdir)/cpu-amd64.md cpu-amd64.h amd64_desc
271
272 cpu-g4.h: cpu-g4.md genmdesc$(EXEEXT)
273         ./genmdesc $(srcdir)/cpu-g4.md cpu-g4.h ppcg4
274
275 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
276         ./genmdesc $(srcdir)/cpu-sparc.md cpu-sparc.h sparc_desc
277
278 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
279         ./genmdesc $(srcdir)/cpu-s390.md cpu-s390.h s390
280
281 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
282         ./genmdesc $(srcdir)/cpu-s390x.md cpu-s390x.h s390x
283
284 inssel.c inssel.h: $(BURGSRC)
285         $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
286
287 testi: mono test.exe
288         ./mono -v -v --ncompile 1 --compile Test:$(mtest) test.exe
289
290 # ensure the tests are actually correct
291 checktests: $(regtests)
292         for i in $(regtests); do $(RUNTIME) $$i; done
293
294 rcheck: mono $(regtests)
295         ./mono --regression $(regtests)
296
297 aotcheck: mono $(regtests)
298         for i in $(regtests); do ./mono --aot $$i; done
299         ./mono --verbose --regression $(regtests)
300         rm -f *.exe.so
301
302 bench: mono test.exe
303         time ./mono --ncompile $(count) --compile Test:$(mtest) test.exe
304
305 mbench: test.exe
306         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
307
308 stat1: mono bench.exe
309         ./mono --verbose --statfile stats.pl --regression bench.exe
310         perl viewstat.pl stats.pl
311
312 stat2: mono basic.exe
313         ./mono --verbose --statfile stats.pl --regression basic.exe
314         perl viewstat.pl -e stats.pl
315
316 stat3: mono bench.exe
317         ./mono --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
318         perl viewstat.pl stats.pl
319
320 docu: mini.sgm
321         docbook2txt mini.sgm
322
323 check-local: rcheck
324
325 clean-local:
326         rm -f mono a.out gmon.out *.o test.exe
327
328 pkgconfigdir = $(libdir)/pkgconfig
329
330 if JIT_SUPPORTED
331 BUILT_SOURCES= inssel.c inssel.h $(arch_built)
332 endif
333
334 CLEANFILES= $(BUILT_SOURCES)
335 EXTRA_DIST = $(common_BURGSRC) jit-icalls.c cprop.c TestDriver.cs ldscript $(test_sources) \
336         inssel-long.brg inssel-long32.brg \
337         $(x86_sources) inssel-x86.brg cpu-pentium.md \
338         $(amd64_sources) inssel-amd64.brg cpu-amd64.md \
339         $(ppc_sources) inssel-ppc.brg cpu-g4.md \
340         $(sparc_sources) inssel-sparc.brg cpu-sparc.md \
341         $(s390_sources) inssel-s390.brg cpu-s390.md \
342         $(s390x_sources) inssel-s390x.brg cpu-s390x.md
343