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