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