Thu Jul 31 16:19:07 CEST 2003 Paolo Molaro <lupus@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
11 MCS=mcs
12 RUNTIME=mono
13
14 INCLUDES = \
15         -I$(top_srcdir)         \
16         $(GMODULE_CFLAGS)               \
17         $(GLIB_CFLAGS)
18
19 if PLATFORM_WIN32
20 export HOST_CC
21 # The mingw math.h has "extern inline" functions that dont appear in libs, so
22 # optimisation is required to actually inline them
23 AM_CFLAGS = -O
24 endif
25
26 # hack for automake to have the same source file in a library and a bin
27 genmdesc_CFLAGS = $(AM_CFLAGS)
28
29 regtests=basic.exe arrays.exe basic-float.exe basic-long.exe objects.exe basic-calls.exe iltests.exe exceptions.exe bench.exe
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
49 mono_LDFLAGS = \
50         -export-dynamic
51
52 genmdesc_SOURCES = \
53         mini.h          \
54         genmdesc.c      \
55         helpers.c
56
57 genmdesc_LDADD = \
58         $(libs) -lm     \
59         $(GLIB_LIBS)            \
60         $(GMODULE_LIBS)
61
62 x86_sources = \
63         mini-x86.c              \
64         mini-x86.h              \
65         exceptions-x86.c        \
66         tramp-x86.c
67
68 ppc_sources = \
69         mini-ppc.c              \
70         mini-ppc.h              \
71         exceptions-ppc.c        \
72         tramp-ppc.c
73
74 sparc_sources = \
75         mini-sparc.c            \
76         mini-sparc.h            \
77         exceptions-sparc.c      \
78         tramp-sparc.c
79
80 common_sources = \
81         mini.c          \
82         mini.h          \
83         mini-ops.h      \
84         mini-arch.h     \
85         dominators.c    \
86         cfold.c         \
87         regalloc.c      \
88         regalloc.h      \
89         inssel.c        \
90         helpers.c       \
91         liveness.c      \
92         ssa.c           \
93         driver.c        \
94         debug-mini.c    \
95         linear-scan.c   \
96         aot.c           \
97         graph.c 
98
99 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-long32.brg $(srcdir)/inssel-float.brg
100
101 if X86
102 libmono_la_SOURCES = \
103         $(common_sources) $(x86_sources)
104
105 arch_BURGSRC= $(srcdir)/inssel-x86.brg
106 endif
107
108 if POWERPC
109 libmono_la_SOURCES = \
110         $(common_sources) $(ppc_sources)
111
112 arch_BURGSRC= $(srcdir)/inssel-ppc.brg
113 endif
114
115 if SPARC
116 libmono_la_SOURCES = \
117         $(common_sources) $(sparc_sources)
118
119 arch_BURGSRC= $(srcdir)/inssel-sparc.brg
120 endif
121
122 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
123
124 libmonoincludedir = $(includedir)/mono/jit
125
126 libmonoinclude_HEADERS = jit.h
127
128 libmono_la_LIBADD = \
129         $(libs)
130
131 %.exe: %.cs TestDriver.dll
132         $(MCS) /unsafe $< /r:TestDriver.dll
133
134 %.exe: %.il
135         ilasm /OUTPUT=$*.exe $<
136
137 TestDriver.dll: TestDriver.cs
138         $(MCS) /out:TestDriver.dll /target:library TestDriver.cs
139
140 cpu-pentium.h: cpu-pentium.md genmdesc$(EXEEXT)
141         ./genmdesc $(srcdir)/cpu-pentium.md cpu-pentium.h pentium_desc
142
143 cpu-g4.h: cpu-g4.md genmdesc$(EXEEXT)
144         ./genmdesc $(srcdir)/cpu-g4.md cpu-g4.h ppcg4
145
146 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
147         ./genmdesc $(srcdir)/cpu-sparc.md cpu-sparc.h sparc_desc
148
149 inssel.c inssel.h: $(BURGSRC)
150         $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
151
152 testi: mono test.exe
153         ./mono -v -v --ncompile 1 --compile Test:$(mtest) test.exe
154
155 # ensure the tests are actually correct
156 checktests: $(regtests)
157         for i in $(regtests); do $(RUNTIME) $$i; done
158
159 rcheck: mono $(regtests)
160         ./mono --verbose --regression $(regtests)
161
162 aotcheck: mono $(regtests)
163         for i in $(regtests); do ./mono --aot $$i; done
164         ./mono --verbose --regression $(regtests)
165         rm -f *.exe.so
166
167 bench: mono test.exe
168         time ./mono --ncompile $(count) --compile Test:$(mtest) test.exe
169
170 mbench: test.exe
171         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
172
173 stat1: mono bench.exe
174         ./mono --verbose --statfile stats.pl --regression bench.exe
175         perl viewstat.pl stats.pl
176
177 stat2: mono basic.exe
178         ./mono --verbose --statfile stats.pl --regression basic.exe
179         perl viewstat.pl -e stats.pl
180
181 stat3: mono bench.exe
182         ./mono --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
183         perl viewstat.pl stats.pl
184
185 docu: mini.sgm
186         docbook2txt mini.sgm
187
188 clean:
189         rm -f mono a.out gmon.out *.o test.exe
190
191 pkgconfigdir = $(libdir)/pkgconfig
192
193 documents=mini-doc.txt mini-porting.txt
194
195 BUILT_SOURCES= inssel.c inssel.h cpu-pentium.h cpu-g4.h cpu-sparc.h
196 CLEANFILES= $(BUILT_SOURCES)
197 EXTRA_DIST = $(common_BURGSRC) $(documents) inssel-x86.brg inssel-ppc.brg \
198         jit-icalls.c cprop.c inssel-sparc.brg \
199         cpu-pentium.md cpu-g4.md ldscript cpu-sparc.md
200
201