2003-06-10 Martin Baulig <martin@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 WARN=-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations \
14         -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs \
15         -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings
16
17 INCLUDES = \
18         $(WARN) -fexceptions -DMONO_USE_EXC_TABLES      \
19         -I$(top_srcdir)         \
20         $(GMODULE_CFLAGS)               \
21         $(GLIB_CFLAGS)
22
23 if PLATFORM_WIN32
24 export HOST_CC
25 endif
26
27 # hack for automake to have the same source file in a library and a bin
28 genmdesc_CFLAGS = $(AM_CFLAGS)
29
30 regtests=basic.exe arrays.exe basic-float.exe basic-long.exe objects.exe basic-calls.exe iltests.exe exceptions.exe bench.exe
31
32 libmono_la_LDFLAGS=-Wl,-version-script=$(srcdir)/ldscript
33
34 if JIT_SUPPORTED
35 bin_PROGRAMS = mono
36
37 noinst_PROGRAMS = genmdesc
38
39 lib_LTLIBRARIES = libmono.la
40 endif
41
42 mono_SOURCES = \
43         main.c
44
45 mono_LDADD = \
46         libmono.la              \
47         $(GLIB_LIBS)            \
48         $(GMODULE_LIBS) -lm
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 common_sources = \
76         mini.c          \
77         mini.h          \
78         mini-ops.h      \
79         mini-arch.h     \
80         dominators.c    \
81         cfold.c         \
82         regalloc.c      \
83         regalloc.h      \
84         inssel.c        \
85         helpers.c       \
86         liveness.c      \
87         ssa.c           \
88         driver.c        \
89         debug-mini.c    \
90         linear-scan.c   \
91         aot.c           \
92         graph.c 
93
94 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-long32.brg $(srcdir)/inssel-float.brg
95
96 if X86
97 libmono_la_SOURCES = \
98         $(common_sources) $(x86_sources)
99
100 BURGSRC= $(common_BURGSRC) $(srcdir)/inssel-x86.brg
101 endif
102
103 if POWERPC
104 libmono_la_SOURCES = \
105         $(common_sources) $(ppc_sources)
106
107 BURGSRC= $(common_BURGSRC) $(srcdir)/inssel-ppc.brg
108 endif
109
110 libmonoincludedir = $(includedir)/mono/jit
111
112 libmonoinclude_HEADERS = jit.h
113
114 libmono_la_LIBADD = \
115         $(libs)
116
117 %.exe: %.cs TestDriver.dll
118         $(MCS) /unsafe $< /r:TestDriver.dll
119
120 %.exe: %.il
121         ilasm /OUTPUT=$*.exe $<
122
123 TestDriver.dll: TestDriver.cs
124         $(MCS) /out:TestDriver.dll /target:library TestDriver.cs
125
126 cpu-pentium.h: cpu-pentium.md genmdesc$(EXEEXT)
127         ./genmdesc $(srcdir)/cpu-pentium.md cpu-pentium.h pentium_desc
128
129 cpu-g4.h: cpu-g4.md genmdesc$(EXEEXT)
130         ./genmdesc $(srcdir)/cpu-g4.md cpu-g4.h ppcg4
131
132 inssel.c inssel.h: $(BURGSRC)
133         $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
134
135 testi: mono test.exe
136         ./mono -v -v --ncompile 1 --compile Test:$(mtest) test.exe
137
138 # ensure the tests are actually correct
139 checktests: $(regtests)
140         for i in $(regtests); do $(RUNTIME) $$i; done
141
142 rcheck: mono $(regtests)
143         ./mono --verbose --regression $(regtests)
144
145 aotcheck: mono $(regtests)
146         for i in $(regtests); do ./mono --aot $$i; done
147         ./mono --verbose --regression $(regtests)
148         rm -f *.exe.so
149
150 bench: mono test.exe
151         time ./mono --ncompile $(count) --compile Test:$(mtest) test.exe
152
153 mbench: test.exe
154         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
155
156 stat1: mono bench.exe
157         ./mono --verbose --statfile stats.pl --regression bench.exe
158         perl viewstat.pl stats.pl
159
160 stat2: mono basic.exe
161         ./mono --verbose --statfile stats.pl --regression basic.exe
162         perl viewstat.pl -e stats.pl
163
164 stat3: mono bench.exe
165         ./mono --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
166         perl viewstat.pl stats.pl
167
168 docu: mini.sgm
169         docbook2txt mini.sgm
170
171 clean:
172         rm -f mono a.out gmon.out *.o test.exe
173
174 pkgconfigdir = $(libdir)/pkgconfig
175
176 documents=mini-doc.txt mini-porting.txt
177
178 BUILT_SOURCES= inssel.c inssel.h cpu-pentium.h cpu-g4.h
179 CLEANFILES= $(BUILT_SOURCES)
180 EXTRA_DIST = $(common_BURGSRC) $(documents) inssel-x86.brg inssel-ppc.brg \
181         jit-icalls.c cprop.c \
182         cpu-pentium.md cpu-g4.md ldscript
183
184