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