- Fix atomic ops on s390
[mono.git] / mono / mini / Makefile.am
blobf5449fce922976712c20909c27600651c9fe4adc
1 count=100000
2 mtest=for_loop
3 monodir=$(top_builddir)
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
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)
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)
34 RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/default MONO_SHARED_DIR=$(mono_build_root)/runtime ./mono --config $(top_builddir)/data/config
36 MCS = $(RUNTIME) $(mcs_topdir)/class/lib/default/mcs.exe --unsafe -nowarn:0162
37 ILASM = $(RUNTIME) $(mcs_topdir)/ilasm/ilasm.exe
39 INCLUDES = \
40         -I$(top_srcdir)         \
41         $(LIBGC_CFLAGS)         \
42         $(GMODULE_CFLAGS)               \
43         $(GLIB_CFLAGS)
45 if PLATFORM_WIN32
46 export HOST_CC
47 # The mingw math.h has "extern inline" functions that dont appear in libs, so
48 # optimisation is required to actually inline them
49 AM_CFLAGS = -O
50 endif
52 # hack for automake to have the same source file in a library and a bin
53 genmdesc_CFLAGS = $(AM_CFLAGS)
55 if NO_VERSION_SCRIPT
56 monoldflags=
57 else
58 monoldflags=-Wl,-version-script=$(srcdir)/ldscript
59 endif
61 if PLATFORM_WIN32
62 libmono_la_LDFLAGS=-no-undefined -version-info 1:0:0 $(monoldflags)
63 else
64 libmono_la_LDFLAGS=$(monoldflags)
65 endif
67 if JIT_SUPPORTED
68 bin_PROGRAMS = mono
70 noinst_PROGRAMS = genmdesc
72 lib_LTLIBRARIES = libmono.la
73 noinst_LTLIBRARIES = libmono-static.la
74 endif
76 mono_SOURCES = \
77         main.c
79 if STATIC_MONO
80 # Link libmono into mono statically
81 # This leads to higher performance, especially with TLS
82 MONO_LIB=libmono-static.la
83 else 
84 MONO_LIB=libmono.la
85 endif
87 mono_LDADD = \
88         $(MONO_LIB)                     \
89         $(GLIB_LIBS)            \
90         $(GMODULE_LIBS) -lm     \
91         $(ICU_LIBS)
93 mono_LDFLAGS = \
94         $(static_flags) -export-dynamic $(monoldflags)
96 genmdesc_SOURCES = \
97         mini.h          \
98         genmdesc.c      \
99         helpers.c
101 # Don't link this against libmetadata to speed up rebuilds
102 genmdesc_LDADD = \
103         $(monodir)/mono/utils/libmonoutils.la $(monodir)/mono/metadata/opcodes.lo -lm   \
104         $(GLIB_LIBS)            \
105         $(GMODULE_LIBS)
107 x86_sources = \
108     mini-exceptions.c   \
109         mini-x86.c              \
110         mini-x86.h              \
111         exceptions-x86.c        \
112         tramp-x86.c
114 amd64_sources = \
115         mini-exceptions.c       \
116         mini-amd64.c            \
117         mini-amd64.h            \
118         exceptions-amd64.c      \
119         tramp-amd64.c
121 ppc_sources = \
122         mini-exceptions.c       \
123         mini-ppc.c              \
124         mini-ppc.h              \
125         exceptions-ppc.c        \
126         tramp-ppc.c
128 sparc_sources = \
129         mini-sparc.c            \
130         mini-sparc.h            \
131         mini-exceptions.c       \
132         exceptions-sparc.c      \
133         tramp-sparc.c
135 s390_sources = \
136         mini-exceptions.c       \
137         mini-s390.c             \
138         mini-s390.h             \
139         exceptions-s390.c       \
140         tramp-s390.c
142 s390x_sources = \
143         mini-s390x.c            \
144         mini-s390x.h            \
145         exceptions-s390x.c      \
146         tramp-s390x.c
148 common_sources = \
149         mini.c          \
150         mini.h          \
151         trace.c         \
152         trace.h         \
153         mini-ops.h      \
154         mini-arch.h     \
155         dominators.c    \
156         cfold.c         \
157         regalloc.c      \
158         regalloc.h      \
159         helpers.c       \
160         liveness.c      \
161         ssa.c           \
162         abcremoval.c    \
163         abcremoval.h    \
164         ssapre.c        \
165         ssapre.h        \
166         driver.c        \
167         debug-mini.c    \
168         linear-scan.c   \
169         aot.c           \
170         graph.c         \
171         declsec.c       \
172         declsec.h
174 test_sources =          \
175         basic-calls.cs  \
176         basic-long.cs   \
177         bench.cs                \
178         objects.cs              \
179         arrays.cs               \
180         basic-float.cs  \
181         basic-math.cs   \
182         basic.cs                \
183         exceptions.cs   \
184         iltests.il              \
185         test.cs
187 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
189 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-float.brg
191 if X86
192 libmono_la_SOURCES = \
193         $(common_sources) $(x86_sources)
195 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-x86.brg
196 arch_built=cpu-pentium.h
197 endif
199 if AMD64
200 libmono_la_SOURCES = \
201         $(common_sources) $(amd64_sources)
202 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-amd64.brg
203 arch_built=cpu-amd64.h
204 endif
206 if POWERPC
207 libmono_la_SOURCES = \
208         $(common_sources) $(ppc_sources)
210 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-ppc.brg
211 arch_built=cpu-g4.h
212 endif
214 if SPARC
215 libmono_la_SOURCES = \
216         $(common_sources) $(sparc_sources)
218 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-sparc.brg
219 arch_built=cpu-sparc.h
220 endif
222 if SPARC64
223 libmono_la_SOURCES = \
224         $(common_sources) $(sparc_sources)
226 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-sparc.brg
227 arch_built=cpu-sparc.h
228 endif
230 if S390
231 libmono_la_SOURCES = \
232         $(common_sources) $(s390_sources)
234 arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-s390.brg
235 arch_built=cpu-s390.h
236 endif
238 if S390x
239 libmono_la_SOURCES = \
240         $(common_sources) $(s390x_sources)
242 arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-s390x.brg
243 arch_built=cpu-s390x.h
244 endif
246 nodist_libmono_la_SOURCES = inssel.c inssel.h
248 libmono_static_la_SOURCES = $(libmono_la_SOURCES)
249 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
250 libmono_static_la_LDFLAGS = -static
251 libmono_static_la_LIBADD = $(static_libs)
253 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
255 libmonoincludedir = $(includedir)/mono/jit
257 libmonoinclude_HEADERS = jit.h
259 libmono_la_LIBADD = \
260         $(libs)
262 %.exe: %.cs TestDriver.dll
263         $(MCS) /out:$*.exe /unsafe $< /r:TestDriver.dll
265 %.exe: %.il
266         $(ILASM) /output=$*.exe $<
268 TestDriver.dll: $(srcdir)/TestDriver.cs
269         $(MCS) /out:TestDriver.dll /target:library $(srcdir)/TestDriver.cs
271 cpu-pentium.h: cpu-pentium.md genmdesc$(EXEEXT)
272         ./genmdesc $(srcdir)/cpu-pentium.md cpu-pentium.h pentium_desc
274 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
275         ./genmdesc $(srcdir)/cpu-amd64.md cpu-amd64.h amd64_desc
277 cpu-g4.h: cpu-g4.md genmdesc$(EXEEXT)
278         ./genmdesc $(srcdir)/cpu-g4.md cpu-g4.h ppcg4
280 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
281         ./genmdesc $(srcdir)/cpu-sparc.md cpu-sparc.h sparc_desc
283 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
284         ./genmdesc $(srcdir)/cpu-s390.md cpu-s390.h s390
286 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
287         ./genmdesc $(srcdir)/cpu-s390x.md cpu-s390x.h s390x
289 inssel.c inssel.h: $(BURGSRC)
290         $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
292 testi: mono test.exe
293         $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
295 # ensure the tests are actually correct
296 checktests: $(regtests)
297         for i in $(regtests); do $(RUNTIME) $$i; done
299 rcheck: mono $(regtests)
300         $(RUNTIME) --regression $(regtests)
302 aotcheck: mono $(regtests)
303         for i in $(regtests); do $(RUNTIME) --aot $$i; done
304         $(RUNTIME) --verbose --regression $(regtests)
305         rm -f *.exe.so
307 bench: mono test.exe
308         time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
310 mbench: test.exe
311         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
313 stat1: mono bench.exe
314         $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
315         perl viewstat.pl stats.pl
317 stat2: mono basic.exe
318         $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
319         perl viewstat.pl -e stats.pl
321 stat3: mono bench.exe
322         $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
323         perl viewstat.pl stats.pl
325 docu: mini.sgm
326         docbook2txt mini.sgm
328 check-local: rcheck
330 clean-local:
331         rm -f mono a.out gmon.out *.o test.exe
333 pkgconfigdir = $(libdir)/pkgconfig
335 if JIT_SUPPORTED
336 BUILT_SOURCES= inssel.c inssel.h $(arch_built)
337 endif
339 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
340 EXTRA_DIST = $(common_BURGSRC) jit-icalls.c cprop.c TestDriver.cs ldscript $(test_sources) \
341         inssel-long.brg inssel-long32.brg \
342         $(x86_sources) inssel-x86.brg cpu-pentium.md \
343         $(amd64_sources) inssel-amd64.brg cpu-amd64.md \
344         $(ppc_sources) inssel-ppc.brg cpu-g4.md \
345         $(sparc_sources) inssel-sparc.brg cpu-sparc.md \
346         $(s390_sources) inssel-s390.brg cpu-s390.md \
347         $(s390x_sources) inssel-s390x.brg cpu-s390x.md