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