Wed Apr 21 16:38:28 CEST 2004 Paolo Molaro <lupus@ximian.com>
[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 mono_LDFLAGS = \
56         -export-dynamic
57
58 genmdesc_SOURCES = \
59         mini.h          \
60         genmdesc.c      \
61         helpers.c
62
63 genmdesc_LDADD = \
64         $(libs) -lm     \
65         $(GLIB_LIBS)            \
66         $(GMODULE_LIBS)
67
68 x86_sources = \
69         mini-x86.c              \
70         mini-x86.h              \
71         exceptions-x86.c        \
72         tramp-x86.c
73
74 ppc_sources = \
75         mini-ppc.c              \
76         mini-ppc.h              \
77         exceptions-ppc.c        \
78         tramp-ppc.c
79
80 sparc_sources = \
81         mini-sparc.c            \
82         mini-sparc.h            \
83         exceptions-sparc.c      \
84         tramp-sparc.c
85
86 s390_sources = \
87         mini-s390.c             \
88         mini-s390.h             \
89         exceptions-s390.c       \
90         tramp-s390.c
91
92 common_sources = \
93         mini.c          \
94         mini.h          \
95         trace.c         \
96         trace.h         \
97         mini-ops.h      \
98         mini-arch.h     \
99         dominators.c    \
100         cfold.c         \
101         regalloc.c      \
102         regalloc.h      \
103         inssel.c        \
104         helpers.c       \
105         liveness.c      \
106         ssa.c           \
107         driver.c        \
108         debug-mini.c    \
109         linear-scan.c   \
110         aot.c           \
111         graph.c 
112
113 test_sources =          \
114         basic-calls.cs  \
115         basic-long.cs   \
116         bench.cs                \
117         objects.cs              \
118         arrays.cs               \
119         basic-float.cs  \
120         basic.cs                \
121         exceptions.cs   \
122         iltests.il              \
123         test.cs
124
125 regtests=basic.exe arrays.exe basic-float.exe basic-long.exe objects.exe basic-calls.exe iltests.exe exceptions.exe bench.exe
126
127 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-long32.brg $(srcdir)/inssel-float.brg
128
129 if X86
130 libmono_la_SOURCES = \
131         $(common_sources) $(x86_sources)
132
133 arch_BURGSRC= $(srcdir)/inssel-x86.brg
134 endif
135
136 if POWERPC
137 libmono_la_SOURCES = \
138         $(common_sources) $(ppc_sources)
139
140 arch_BURGSRC= $(srcdir)/inssel-ppc.brg
141 endif
142
143 if SPARC
144 libmono_la_SOURCES = \
145         $(common_sources) $(sparc_sources)
146
147 arch_BURGSRC= $(srcdir)/inssel-sparc.brg
148 endif
149
150 if S390
151 libmono_la_SOURCES = \
152         $(common_sources) $(s390_sources)
153
154 arch_BURGSRC= $(srcdir)/inssel-s390.brg
155 endif
156
157 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
158
159 libmonoincludedir = $(includedir)/mono/jit
160
161 libmonoinclude_HEADERS = jit.h
162
163 libmono_la_LIBADD = \
164         $(libs)
165
166 %.exe: %.cs TestDriver.dll
167         $(MCS) /unsafe $< /r:TestDriver.dll
168
169 %.exe: %.il
170         ilasm /OUTPUT=$*.exe $<
171
172 TestDriver.dll: TestDriver.cs
173         $(MCS) /out:TestDriver.dll /target:library TestDriver.cs
174
175 cpu-pentium.h: cpu-pentium.md genmdesc$(EXEEXT)
176         ./genmdesc $(srcdir)/cpu-pentium.md cpu-pentium.h pentium_desc
177
178 cpu-g4.h: cpu-g4.md genmdesc$(EXEEXT)
179         ./genmdesc $(srcdir)/cpu-g4.md cpu-g4.h ppcg4
180
181 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
182         ./genmdesc $(srcdir)/cpu-sparc.md cpu-sparc.h sparc_desc
183
184 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
185         ./genmdesc $(srcdir)/cpu-s390.md cpu-s390.h s390
186
187 inssel.c inssel.h: $(BURGSRC)
188         $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
189
190 testi: mono test.exe
191         ./mono -v -v --ncompile 1 --compile Test:$(mtest) test.exe
192
193 # ensure the tests are actually correct
194 checktests: $(regtests)
195         for i in $(regtests); do $(RUNTIME) $$i; done
196
197 rcheck: mono $(regtests)
198         ./mono --verbose --regression $(regtests)
199
200 aotcheck: mono $(regtests)
201         for i in $(regtests); do ./mono --aot $$i; done
202         ./mono --verbose --regression $(regtests)
203         rm -f *.exe.so
204
205 bench: mono test.exe
206         time ./mono --ncompile $(count) --compile Test:$(mtest) test.exe
207
208 mbench: test.exe
209         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
210
211 stat1: mono bench.exe
212         ./mono --verbose --statfile stats.pl --regression bench.exe
213         perl viewstat.pl stats.pl
214
215 stat2: mono basic.exe
216         ./mono --verbose --statfile stats.pl --regression basic.exe
217         perl viewstat.pl -e stats.pl
218
219 stat3: mono bench.exe
220         ./mono --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
221         perl viewstat.pl stats.pl
222
223 docu: mini.sgm
224         docbook2txt mini.sgm
225
226 clean:
227         rm -f mono a.out gmon.out *.o test.exe
228
229 pkgconfigdir = $(libdir)/pkgconfig
230
231 if JIT_SUPPORTED
232 BUILT_SOURCES= inssel.c inssel.h cpu-pentium.h cpu-g4.h cpu-sparc.h cpu-s390.h
233 endif
234
235 CLEANFILES= $(BUILT_SOURCES)
236 EXTRA_DIST = $(common_BURGSRC) inssel-x86.brg inssel-ppc.brg inssel-s390.brg \
237         $(x86_sources) $(ppc_sources) $(sparc_sources) $(test_sources) \
238         jit-icalls.c cprop.c inssel-sparc.brg \
239         cpu-pentium.md cpu-g4.md ldscript cpu-sparc.md cpu-s390.md TestDriver.cs
240
241