Mon Jun 9 19:00:56 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
10 MCS=mcs
11 RUNTIME=mono
12 WARN=-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations \
13         -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs \
14         -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings
15
16 INCLUDES = \
17         $(WARN) -fexceptions -DMONO_USE_EXC_TABLES      \
18         -I$(top_srcdir)         \
19         $(GMODULE_CFLAGS)               \
20         $(GLIB_CFLAGS)
21
22 if PLATFORM_WIN32
23 export HOST_CC
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 common_sources = \
75         mini.c          \
76         mini.h          \
77         mini-ops.h      \
78         mini-arch.h     \
79         dominators.c    \
80         cfold.c         \
81         regalloc.c      \
82         regalloc.h      \
83         inssel.c        \
84         helpers.c       \
85         liveness.c      \
86         ssa.c           \
87         driver.c        \
88         debug-mini.c    \
89         linear-scan.c   \
90         aot.c           \
91         graph.c 
92
93 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-long32.brg $(srcdir)/inssel-float.brg
94
95 if X86
96 libmono_la_SOURCES = \
97         $(common_sources) $(x86_sources)
98
99 BURGSRC= $(common_BURGSRC) $(srcdir)/inssel-x86.brg
100 endif
101
102 if POWERPC
103 libmono_la_SOURCES = \
104         $(common_sources) $(ppc_sources)
105
106 BURGSRC= $(common_BURGSRC) $(srcdir)/inssel-ppc.brg
107 endif
108
109 libmonoincludedir = $(includedir)/mono/jit
110
111 libmonoinclude_HEADERS = jit.h
112
113 libmono_la_LIBADD = \
114         $(libs)
115
116 %.exe: %.cs TestDriver.dll
117         $(MCS) /unsafe $< /r:TestDriver.dll
118
119 %.exe: %.il
120         ilasm /OUTPUT=$*.exe $<
121
122 TestDriver.dll: TestDriver.cs
123         $(MCS) /out:TestDriver.dll /target:library TestDriver.cs
124
125 cpu-pentium.h: cpu-pentium.md genmdesc$(EXEEXT)
126         ./genmdesc $(srcdir)/cpu-pentium.md cpu-pentium.h pentium_desc
127
128 cpu-g4.h: cpu-g4.md genmdesc$(EXEEXT)
129         ./genmdesc $(srcdir)/cpu-g4.md cpu-g4.h ppcg4
130
131 inssel.c inssel.h: $(BURGSRC)
132         $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
133
134 testi: mono test.exe
135         ./mono -v -v --ncompile 1 --compile Test:$(mtest) test.exe
136
137 # ensure the tests are actually correct
138 checktests: $(regtests)
139         for i in $(regtests); do $(RUNTIME) $$i; done
140
141 rcheck: mono $(regtests)
142         ./mono --verbose --regression $(regtests)
143
144 aotcheck: mono $(regtests)
145         for i in $(regtests); do ./mono --aot $$i; done
146         ./mono --verbose --regression $(regtests)
147         rm -f *.exe.so
148
149 bench: mono test.exe
150         time ./mono --ncompile $(count) --compile Test:$(mtest) test.exe
151
152 mbench: test.exe
153         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
154
155 stat1: mono bench.exe
156         ./mono --verbose --statfile stats.pl --regression bench.exe
157         perl viewstat.pl stats.pl
158
159 stat2: mono basic.exe
160         ./mono --verbose --statfile stats.pl --regression basic.exe
161         perl viewstat.pl -e stats.pl
162
163 stat3: mono bench.exe
164         ./mono --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
165         perl viewstat.pl stats.pl
166
167 docu: mini.sgm
168         docbook2txt mini.sgm
169
170 clean:
171         rm -f mono a.out gmon.out *.o test.exe
172
173 pkgconfigdir = $(libdir)/pkgconfig
174
175 documents=mini-doc.txt mini-porting.txt
176
177 BUILT_SOURCES= inssel.c inssel.h cpu-pentium.h cpu-g4.h
178 CLEANFILES= $(BUILT_SOURCES)
179 EXTRA_DIST = $(common_BURGSRC) $(documents) inssel-x86.brg inssel-ppc.brg \
180         jit-icalls.c cprop.c \
181         cpu-pentium.md cpu-g4.md ldscript
182
183