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