2004-06-09 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mono / mini / Makefile.am
1 count=100000
2 mtest=for_loop
3 monodir=$(top_builddir)
4 libs=   \
5         $(monodir)/mono/metadata/libmonoruntime.la      \
6         $(monodir)/mono/metadata/libmetadata.la \
7         $(monodir)/mono/io-layer/libwapi.la     \
8         $(monodir)/mono/utils/libmonoutils.la \
9         $(LIBGC_LIBS)   \
10         $(ICU_LIBS)
11
12 MCS=mcs
13 RUNTIME=mono
14
15 INCLUDES = \
16         -I$(top_srcdir)         \
17         $(LIBGC_CFLAGS)         \
18         $(GMODULE_CFLAGS)               \
19         $(GLIB_CFLAGS)
20
21 if PLATFORM_WIN32
22 export HOST_CC
23 # The mingw math.h has "extern inline" functions that dont appear in libs, so
24 # optimisation is required to actually inline them
25 AM_CFLAGS = -O
26 endif
27
28 # hack for automake to have the same source file in a library and a bin
29 genmdesc_CFLAGS = $(AM_CFLAGS)
30
31 if NO_VERSION_SCRIPT
32 monoldflags=
33 else
34 monoldflags=-Wl,-version-script=$(srcdir)/ldscript
35 endif
36 libmono_la_LDFLAGS=$(monoldflags)
37
38 if JIT_SUPPORTED
39 bin_PROGRAMS = mono
40
41 noinst_PROGRAMS = genmdesc
42
43 lib_LTLIBRARIES = libmono.la
44 endif
45
46 mono_SOURCES = \
47         main.c
48
49 mono_LDADD = \
50         libmono.la              \
51         $(GLIB_LIBS)            \
52         $(GMODULE_LIBS) -lm     \
53         $(ICU_LIBS)
54
55 if X86
56 static_flags = -static libmono.la
57 else
58 static_flags = 
59 endif
60
61 mono_LDFLAGS = \
62         $(static_flags) -export-dynamic
63
64 genmdesc_SOURCES = \
65         mini.h          \
66         genmdesc.c      \
67         helpers.c
68
69 genmdesc_LDADD = \
70         $(libs) -lm     \
71         $(GLIB_LIBS)            \
72         $(GMODULE_LIBS)
73
74 x86_sources = \
75     mini-exceptions.c   \
76         mini-x86.c              \
77         mini-x86.h              \
78         exceptions-x86.c        \
79         tramp-x86.c
80
81 ppc_sources = \
82         mini-ppc.c              \
83         mini-ppc.h              \
84         exceptions-ppc.c        \
85         tramp-ppc.c
86
87 sparc_sources = \
88         mini-sparc.c            \
89         mini-sparc.h            \
90     mini-exceptions.c   \
91         exceptions-sparc.c      \
92         tramp-sparc.c
93
94 s390_sources = \
95         mini-s390.c             \
96         mini-s390.h             \
97         exceptions-s390.c       \
98         tramp-s390.c
99
100 common_sources = \
101         mini.c          \
102         mini.h          \
103         trace.c         \
104         trace.h         \
105         mini-ops.h      \
106         mini-arch.h     \
107         dominators.c    \
108         cfold.c         \
109         regalloc.c      \
110         regalloc.h      \
111         helpers.c       \
112         liveness.c      \
113         ssa.c           \
114         abcremoval.c    \
115         abcremoval.h    \
116         driver.c        \
117         debug-mini.c    \
118         linear-scan.c   \
119         aot.c           \
120         graph.c 
121
122 test_sources =          \
123         basic-calls.cs  \
124         basic-long.cs   \
125         bench.cs                \
126         objects.cs              \
127         arrays.cs               \
128         basic-float.cs  \
129         basic-math.cs   \
130         basic.cs                \
131         exceptions.cs   \
132         iltests.il              \
133         test.cs
134
135 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
136
137 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-long32.brg $(srcdir)/inssel-float.brg
138
139 if X86
140 libmono_la_SOURCES = \
141         $(common_sources) $(x86_sources)
142
143 arch_BURGSRC= $(srcdir)/inssel-x86.brg
144 arch_built=cpu-pentium.h
145 endif
146
147 if POWERPC
148 libmono_la_SOURCES = \
149         $(common_sources) $(ppc_sources)
150
151 arch_BURGSRC= $(srcdir)/inssel-ppc.brg
152 arch_built=cpu-g4.h
153 endif
154
155 if SPARC
156 libmono_la_SOURCES = \
157         $(common_sources) $(sparc_sources)
158
159 arch_BURGSRC= $(srcdir)/inssel-sparc.brg
160 arch_built=cpu-sparc.h
161 endif
162
163 if S390
164 libmono_la_SOURCES = \
165         $(common_sources) $(s390_sources)
166
167 arch_BURGSRC= $(srcdir)/inssel-s390.brg
168 arch_built=cpu-s390.h
169 endif
170
171 nodist_libmono_la_SOURCES = inssel.c inssel.h
172
173 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
174
175 libmonoincludedir = $(includedir)/mono/jit
176
177 libmonoinclude_HEADERS = jit.h
178
179 libmono_la_LIBADD = \
180         $(libs)
181
182 %.exe: %.cs TestDriver.dll
183         $(MCS) /unsafe $< /r:TestDriver.dll
184
185 %.exe: %.il
186         ilasm /output=$*.exe $<
187
188 TestDriver.dll: TestDriver.cs
189         $(MCS) /out:TestDriver.dll /target:library TestDriver.cs
190
191 cpu-pentium.h: cpu-pentium.md genmdesc$(EXEEXT)
192         ./genmdesc $(srcdir)/cpu-pentium.md cpu-pentium.h pentium_desc
193
194 cpu-g4.h: cpu-g4.md genmdesc$(EXEEXT)
195         ./genmdesc $(srcdir)/cpu-g4.md cpu-g4.h ppcg4
196
197 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
198         ./genmdesc $(srcdir)/cpu-sparc.md cpu-sparc.h sparc_desc
199
200 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
201         ./genmdesc $(srcdir)/cpu-s390.md cpu-s390.h s390
202
203 inssel.c inssel.h: $(BURGSRC)
204         $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
205
206 testi: mono test.exe
207         ./mono -v -v --ncompile 1 --compile Test:$(mtest) test.exe
208
209 # ensure the tests are actually correct
210 checktests: $(regtests)
211         for i in $(regtests); do $(RUNTIME) $$i; done
212
213 rcheck: mono $(regtests)
214         ./mono --regression $(regtests)
215
216 aotcheck: mono $(regtests)
217         for i in $(regtests); do ./mono --aot $$i; done
218         ./mono --verbose --regression $(regtests)
219         rm -f *.exe.so
220
221 bench: mono test.exe
222         time ./mono --ncompile $(count) --compile Test:$(mtest) test.exe
223
224 mbench: test.exe
225         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
226
227 stat1: mono bench.exe
228         ./mono --verbose --statfile stats.pl --regression bench.exe
229         perl viewstat.pl stats.pl
230
231 stat2: mono basic.exe
232         ./mono --verbose --statfile stats.pl --regression basic.exe
233         perl viewstat.pl -e stats.pl
234
235 stat3: mono bench.exe
236         ./mono --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
237         perl viewstat.pl stats.pl
238
239 docu: mini.sgm
240         docbook2txt mini.sgm
241
242 clean:
243         rm -f mono a.out gmon.out *.o test.exe
244
245 pkgconfigdir = $(libdir)/pkgconfig
246
247 if JIT_SUPPORTED
248 BUILT_SOURCES= inssel.c inssel.h $(arch_built)
249 endif
250
251 CLEANFILES= $(BUILT_SOURCES)
252 EXTRA_DIST = $(common_BURGSRC) jit-icalls.c cprop.c TestDriver.cs ldscript $(test_sources) \
253         propagated_relations_table.def build_relations_propagation_table.pl \
254         $(x86_sources) inssel-x86.brg cpu-pentium.md \
255         $(ppc_sources) inssel-ppc.brg cpu-g4.md \
256         $(sparc_sources) inssel-sparc.brg cpu-sparc.md \
257         $(s390_sources) inssel-s390.brg cpu-s390.md
258