Various parts of mono use g_convert() which rely on iconv
[mono.git] / mono / mini / Makefile.am
1 count=100000
2 mtest=for_loop
3 monodir=$(top_builddir)
4
5 # This is needed for automake dependency generation
6 if INCLUDED_LIBGC
7 libgc_libs=$(monodir)/libgc/libmonogc.la
8 libgc_static_libs=$(monodir)/libgc/libmonogc-static.la
9 else
10 libgc_libs=$(LIBGC_LIBS)
11 libgc_static_libs=$(LIBGC_STATIC_LIBS)
12 endif
13
14 libs=   \
15         $(monodir)/mono/metadata/libmonoruntime.la      \
16         $(monodir)/mono/io-layer/libwapi.la     \
17         $(monodir)/mono/utils/libmonoutils.la \
18         $(GLIB_LIBS)    \
19         $(libgc_libs)
20
21 sgen_libs = \
22         $(monodir)/mono/metadata/libmonoruntimesgen.la  \
23         $(monodir)/mono/io-layer/libwapi.la     \
24         $(monodir)/mono/utils/libmonoutils.la \
25         $(GLIB_LIBS)
26
27 if MOONLIGHT
28 moon_libs = \
29         $(monodir)/mono/metadata/libmonoruntimemoon.la  \
30         $(monodir)/mono/io-layer/libwapi.la     \
31         $(monodir)/mono/utils/libmonoutils.la \
32         $(GLIB_LIBS)
33 endif
34
35 static_libs=    \
36         $(monodir)/mono/metadata/libmonoruntime-static.la       \
37         $(monodir)/mono/io-layer/libwapi.la     \
38         $(monodir)/mono/utils/libmonoutils.la \
39         $(GLIB_LIBS)    \
40         $(libgc_static_libs)
41
42 sgenstatic_libs = \
43         $(monodir)/mono/metadata/libmonoruntimesgen-static.la   \
44         $(monodir)/mono/io-layer/libwapi.la     \
45         $(monodir)/mono/utils/libmonoutils.la \
46         $(GLIB_LIBS)
47
48 CLASS=$(mcs_topdir)/class/lib/net_4_0
49
50 RUNTIME_EXECUTABLE = $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/runtime/mono-wrapper)
51
52 RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
53 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(RUNTIME_EXECUTABLE)
54
55 MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162
56 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
57
58 AM_CFLAGS = \
59         -I$(top_srcdir)         \
60         $(GLIB_CFLAGS)          \
61         $(LLVM_CFLAGS)          \
62         $(PLATFORM_CFLAGS) $(ARCH_CFLAGS)
63
64 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
65
66 if HOST_WIN32
67 export HOST_CC
68 # The mingw math.h has "extern inline" functions that dont appear in libs, so
69 # optimisation is required to actually inline them
70 PLATFORM_CFLAGS = -O
71 endif
72
73 # hack for automake to have the same source file in a library and a bin
74 genmdesc_CFLAGS = $(AM_CFLAGS)
75
76 if NO_VERSION_SCRIPT
77 monoldflags=$(export_ldflags)
78 monobinldflags=$(export_ldflags)
79 else
80 monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
81 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
82 endif
83
84 if HOST_WIN32
85 libmono_2_0_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
86 else
87 libmono_2_0_la_LDFLAGS=$(monoldflags) -version-info 1:0:0
88 endif
89
90 if JIT_SUPPORTED
91
92 if SUPPORT_SGEN
93 sgen_binaries = mono-sgen
94 sgen_libraries = libmonosgen-2.0.la
95 sgen_static_libraries = libmonosgen-static.la
96 endif
97
98 if HOST_WIN32
99 bin_PROGRAMS = mono monow
100 else
101 bin_PROGRAMS = mono $(sgen_binaries)
102 endif
103
104 noinst_PROGRAMS = genmdesc
105
106 if SHARED_MONO
107 shared_libraries = libmono-2.0.la $(sgen_libraries)
108 endif
109
110 lib_LTLIBRARIES = $(shared_libraries)
111 noinst_LTLIBRARIES = libmono-static.la $(sgen_static_libraries)
112
113 if MOONLIGHT
114 noinst_LTLIBRARIES += libmono-moon.la
115 moon-do-build: $(BUILT_SOURCES) mono libmono-moon.la
116 moon-do-clean: maintainer-clean-generic
117         -test -z "mono$(EXEEXT)" || rm -f mono$(EXEEXT)
118         -test -z "libmono-moon.la" || rm -f libmono-moon.la
119 endif
120
121 if LOADED_LLVM
122 lib_LTLIBRARIES += libmono-llvm.la
123 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
124 libmono_llvm_la_LIBADD = $(LLVM_LIBS) $(LLVM_LDFLAGS)
125 if PLATFORM_DARWIN
126 libmono_llvm_la_LDFLAGS=-undefined suppress
127 else
128 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmono-$(API_VER).la $(libs)
129 endif
130 endif
131
132 endif
133
134 mono_SOURCES = \
135         main.c
136
137 mono_CFLAGS = $(AM_CFLAGS) $(BOEHM_DEFINES) $(LIBGC_CFLAGS)
138
139 mono_sgen_SOURCES = $(mono_SOURCES)
140 mono_sgen_CFLAGS = $(SGEN_DEFINES) $(AM_CFLAGS)
141
142 # We build this after libmono was built so it contains the date when the final
143 # link was done
144 buildver.h: libmono-static.la
145         @echo "const char *build_date = \"`date`\";" > buildver.h
146
147 mono-main.$(OBJEXT): buildver.h
148 mono_sgen-main.$(OBJEXT): buildver.h
149
150 if DTRACE_G_REQUIRED
151 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
152 if STATIC_MONO
153 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
154 else
155 MONO_DTRACE_OBJECT = 
156 endif
157 else
158 MONO_DTRACE_OBJECT = 
159 LIBMONO_DTRACE_OBJECT = 
160 endif
161
162 if STATIC_MONO
163 # Link libmono into mono statically
164 # This leads to higher performance, especially with TLS
165 MONO_LIB=libmono-static.la
166 MONO_SGEN_LIB=libmonosgen-static.la
167 else 
168 MONO_LIB=libmono-2.0.la
169 MONO_SGEN_LIB=libmonosgen-2.0.la
170 endif
171
172 if LOADED_LLVM
173 LLVMMONOF=
174 else
175 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
176 endif
177
178 mono_LDADD = \
179         $(MONO_LIB)             \
180         $(GLIB_LIBS)            \
181         $(LLVMMONOF)            \
182         $(LIBICONV)             \
183         -lm                     \
184         $(MONO_DTRACE_OBJECT)
185
186 mono_LDFLAGS = \
187         $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
188
189 mono_sgen_LDADD = \
190         $(MONO_SGEN_LIB)        \
191         $(GLIB_LIBS)            \
192         $(LLVMMONOF)            \
193         $(LIBICONV)             \
194         -lm                     \
195         $(MONO_DTRACE_OBJECT)
196
197 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
198
199 if DTRACE_G_REQUIRED
200
201 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
202         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
203         $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
204
205 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
206         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
207         --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
208
209 endif
210
211 # Create monow.exe, linked for the 'windows' subsystem
212 if HOST_WIN32
213 monow_LDADD = $(mono_LDADD)
214 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
215 monow_SOURCES = $(mono_SOURCES)
216 endif
217
218 genmdesc_SOURCES = \
219         mini.h          \
220         genmdesc.c      \
221         helpers.c       \
222         ../metadata/opcodes.c
223
224 # Don't link this against libmonoruntime to speed up rebuilds
225 genmdesc_LDADD = \
226         $(monodir)/mono/utils/libmonoutils.la -lm       \
227         $(GLIB_LIBS)                                    \
228         $(LIBICONV)
229
230 x86_sources = \
231         mini-x86.c              \
232         mini-x86.h              \
233         exceptions-x86.c        \
234         tramp-x86.c
235
236 amd64_sources = \
237         mini-amd64.c            \
238         mini-amd64.h            \
239         exceptions-amd64.c      \
240         tramp-amd64.c
241
242 ppc_sources = \
243         mini-ppc.c              \
244         mini-ppc.h              \
245         exceptions-ppc.c        \
246         tramp-ppc.c
247
248 arm_sources = \
249         mini-arm.c              \
250         mini-arm.h              \
251         exceptions-arm.c        \
252         tramp-arm.c
253
254 mips_sources = \
255         mini-mips.c             \
256         mini-mips.h             \
257         exceptions-mips.c       \
258         tramp-mips.c
259
260 sparc_sources = \
261         mini-sparc.c            \
262         mini-sparc.h            \
263         exceptions-sparc.c      \
264         tramp-sparc.c
265
266 s390_sources = \
267         mini-s390.c             \
268         mini-s390.h             \
269         exceptions-s390.c       \
270         tramp-s390.c
271
272 s390x_sources = \
273         mini-s390x.c            \
274         mini-s390x.h            \
275         exceptions-s390x.c      \
276         tramp-s390x.c
277
278 ia64_sources = \
279         mini-ia64.c             \
280         mini-ia64.h             \
281         exceptions-ia64.c       \
282         tramp-ia64.c
283
284 alpha_sources = \
285         mini-alpha.c            \
286         mini-alpha.h            \
287         exceptions-alpha.c      \
288         tramp-alpha.c
289
290 hppa_sources = \
291         mini-hppa.c             \
292         mini-hppa.h             \
293         exceptions-hppa.c       \
294         tramp-hppa.c
295
296 darwin_sources = \
297         mini-darwin.c
298
299 windows_sources = \
300         mini-windows.c
301
302 posix_sources = \
303         mini-posix.c
304
305 if ENABLE_LLVM
306 if LOADED_LLVM
307 llvm_sources =
308 else
309 llvm_sources = \
310         mini-llvm.c             \
311         mini-llvm-cpp.cpp
312 endif
313 endif
314
315 common_sources = \
316         mini.c                  \
317         ir-emit.h               \
318         method-to-ir.c          \
319         decompose.c             \
320         mini.h                  \
321         version.h               \
322         optflags-def.h          \
323         jit-icalls.h            \
324         jit-icalls.c            \
325         trace.c                 \
326         trace.h                 \
327         patch-info.h            \
328         mini-ops.h              \
329         mini-arch.h             \
330         dominators.c            \
331         cfold.c                 \
332         regalloc.c              \
333         regalloc.h              \
334         helpers.c               \
335         liveness.c              \
336         ssa.c                   \
337         abcremoval.c            \
338         abcremoval.h            \
339         ssapre.c                \
340         ssapre.h                \
341         local-propagation.c     \
342         driver.c                \
343         debug-mini.c            \
344         debug-mini.h            \
345         linear-scan.c           \
346         aot-compiler.c          \
347         aot-runtime.c           \
348         graph.c                 \
349         mini-codegen.c          \
350         mini-exceptions.c       \
351         mini-trampolines.c      \
352         declsec.c               \
353         declsec.h               \
354         wapihandles.c           \
355         branch-opts.c           \
356         mini-generic-sharing.c  \
357         regalloc2.c             \
358         simd-methods.h          \
359         tasklets.c              \
360         tasklets.h              \
361         simd-intrinsics.c       \
362         mini-unwind.h           \
363         unwind.c                \
364         image-writer.h          \
365         image-writer.c          \
366         dwarfwriter.h           \
367         dwarfwriter.c           \
368         mini-gc.h               \
369         mini-gc.c               \
370         debugger-agent.h        \
371         debugger-agent.c        \
372         debug-debugger.c        \
373         debug-debugger.h        \
374         xdebug.c                        \
375         mini-llvm.h                     \
376         mini-llvm-cpp.h
377
378 test_sources =                  \
379         basic-calls.cs          \
380         basic-long.cs           \
381         bench.cs                \
382         objects.cs              \
383         arrays.cs               \
384         basic-float.cs          \
385         basic-math.cs           \
386         basic.cs                \
387         exceptions.cs           \
388         devirtualization.cs     \
389         iltests.il.in           \
390         test.cs                 \
391         generics.cs             \
392         generics-variant-types.il\
393         basic-simd.cs
394
395 regtests=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe
396
397 if X86
398 if MONO_DEBUGGER_SUPPORTED
399 if PLATFORM_DARWIN
400 mdb_x86 = mdb-debug-info32-darwin.s
401 else
402 mdb_x86 = mdb-debug-info32.s
403 endif
404 else
405 mdb_x86 = 
406 endif
407 arch_sources = $(x86_sources) $(mdb_x86)
408 arch_built=cpu-x86.h
409 arch_define=__i386__
410 endif
411
412 if AMD64
413 if MONO_DEBUGGER_SUPPORTED
414 arch_sources = $(amd64_sources) mdb-debug-info64.s
415 else
416 arch_sources = $(amd64_sources)
417 endif
418 arch_built=cpu-amd64.h
419 arch_define=__x86_64__
420 endif
421
422 if POWERPC
423 arch_sources = $(ppc_sources)
424 arch_built=cpu-ppc.h
425 arch_define=__ppc__
426 endif
427
428 if POWERPC64
429 arch_sources = $(ppc_sources)
430 arch_built=cpu-ppc64.h
431 arch_define=__ppc64__
432 endif
433
434 if MIPS
435 arch_sources = $(mips_sources)
436 arch_built=cpu-mips.h
437 arch_define=__mips__
438 endif
439
440 if ARM
441 # pick up arm_dpimacros.h and arm_fpamacros.h
442 ARCH_CFLAGS = -I../arch/arm
443 arch_sources = $(arm_sources)
444 arch_built=cpu-arm.h
445 arch_define=__arm__
446 endif
447
448 if SPARC
449 arch_sources = $(sparc_sources)
450 arch_built=cpu-sparc.h
451 arch_define=__sparc__
452 endif
453
454 if SPARC64
455 arch_sources = $(sparc_sources)
456 arch_built=cpu-sparc.h
457 arch_define=__sparc__
458 endif
459
460 if S390
461 arch_sources = $(s390_sources)
462 arch_built=cpu-s390.h
463 arch_define=__s390__
464 endif
465
466 if S390x
467 arch_sources = $(s390x_sources)
468 arch_built=cpu-s390x.h
469 arch_define=__s390__
470 endif
471
472 if IA64
473 arch_sources = $(ia64_sources)
474 arch_built = cpu-ia64.h
475 arch_define=__ia64__
476 endif
477
478 if ALPHA
479 arch_sources = $(alpha_sources) $(mono_debugger_sources)
480 arch_built = cpu-alpha.h
481 arch_define=__alpha__
482 endif
483
484 if HPPA
485 # Only support 32-bit targets for now
486 arch_sources = $(hppa_sources)
487 arch_built = cpu-hppa.h
488 arch_define=__hppa__
489 endif
490
491 if HOST_WIN32
492 os_sources = $(windows_sources)
493 monobin_platform_ldflags=
494 endif
495
496 if PLATFORM_SIGPOSIX
497 os_sources = $(posix_sources)
498 monobin_platform_ldflags=
499 endif
500
501 if PLATFORM_DARWIN
502 os_sources = $(darwin_sources) $(posix_sources)
503 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation
504 monobin_platform_ldflags=-framework CoreFoundation
505 endif
506
507 libmono_2_0_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
508 libmono_2_0_la_CFLAGS = $(mono_CFLAGS)
509 libmono_2_0_la_LIBADD = $(libs) $(LIBMONO_DTRACE_OBJECT)
510
511 libmonosgen_2_0_la_SOURCES = $(libmono_2_0_la_SOURCES)
512 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
513 libmonosgen_2_0_la_LIBADD = $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
514
515 if MOONLIGHT
516 libmono_moon_la_SOURCES = $(libmono_2_0_la_SOURCES)
517 if MOONLIGHT_BOEHM
518 libmono_moon_la_CFLAGS = $(mono_CFLAGS) $(MOONLIGHT_DEFINES)
519 libmono_moon_la_LIBADD = $(moon_libs) $(libgc_libs) $(LIBMONO_DTRACE_OBJECT)
520 else
521 libmono_moon_la_CFLAGS = $(mono_sgen_CFLAGS) $(MOONLIGHT_DEFINES)
522 libmono_moon_la_LIBADD = $(moon_libs) $(LIBMONO_DTRACE_OBJECT)
523 endif
524 endif
525
526 libmono_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
527 libmono_static_la_CFLAGS = $(mono_CFLAGS)
528 libmono_static_la_LDFLAGS = -static
529 libmono_static_la_LIBADD = $(static_libs) $(MONO_DTRACE_OBJECT)
530
531 libmonosgen_static_la_SOURCES = $(libmono_2_0_la_SOURCES)
532 libmonosgen_static_la_CFLAGS = $(mono_sgen_CFLAGS)
533 libmonosgen_static_la_LDFLAGS = -static
534 libmonosgen_static_la_LIBADD = $(sgenstatic_libs) $(MONO_DTRACE_OBJECT)
535
536 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
537 nodist_libmono_static_la_CFLAGS = $(mono_CFLAGS)
538
539 BURGSRC= $(common_BURGSRC) $(arch_BURGSRC)
540
541 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
542
543 libmonoinclude_HEADERS = jit.h
544
545 basic-simd.exe: basic-simd.cs
546         $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
547
548 nacl.exe: nacl.cs
549         $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
550
551 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
552         $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
553
554 %.exe: %.cs TestDriver.dll
555         $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
556
557 iltests.il: iltests.il.in Makefile.am
558         echo '// DO NOT EDIT: This file has been generated from iltests.il.in' > iltests.il
559         cpp -Darch=$(arch_define) < $(srcdir)/iltests.il.in | sed 's/^#.*//' >> iltests.il
560
561 %.exe: %.il
562         $(ILASM) -output=$@ $<
563
564 TestDriver.dll: $(srcdir)/TestDriver.cs
565         $(MCS) -out:$@ -target:library $<
566
567 generics-variant-types.dll: generics-variant-types.il
568         $(ILASM) -dll -output=$@ $<
569
570 if NACL_CODEGEN
571 GENMDESC_OPTS=--nacl
572 else !NACL_CODEGEN
573 GENMDESC_OPTS=
574 endif !NACL_CODEGEN
575
576 # we don't always use the perl impl because it's an additional
577 # build dependency for the poor windows users
578 # $(arch_define) is the preprocessor symbol that enables all the opcodes
579 # for the specific platform in mini-ops.h
580 if CROSS_COMPILING
581 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
582 else !CROSS_COMPILING
583 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
584 endif !CROSS_COMPILING
585
586 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
587         $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
588
589 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
590         $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
591
592 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
593         $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
594
595 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
596         $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
597
598 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
599         $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
600
601 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
602         $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
603
604 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
605         $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
606
607 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
608         $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
609
610 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
611         $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
612
613 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
614         $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
615
616 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
617         $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
618
619 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
620         $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
621
622 testi: mono test.exe
623         $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
624
625 # ensure the tests are actually correct
626 checktests: $(regtests)
627         for i in $(regtests); do $(RUNTIME) $$i; done
628
629 rcheck: mono $(regtests)
630         $(RUNTIME) --regression $(regtests)
631
632 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
633
634 aotcheck: mono $(regtests)
635         rm -f *.exe.so
636         $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
637         for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
638         rm -f *.exe.so
639
640 llvmaotcheck:
641         $(MAKE) aotcheck LLVM=1
642
643 # This currently only works on amd64/arm
644 fullaotcheck: mono $(regtests)
645         rm -rf fullaot-tmp
646         mkdir fullaot-tmp
647         cp $(CLASS)/mscorlib.dll $(CLASS)/System.Core.dll $(CLASS)/System.dll $(CLASS)/Mono.Posix.dll $(CLASS)/System.Configuration.dll $(CLASS)/System.Security.dll $(CLASS)/System.Xml.dll $(CLASS)/Mono.Security.dll $(CLASS)/Mono.Simd.dll $(regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
648         cp $(regtests) fullaot-tmp/
649         MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) --aot=full fullaot-tmp/* || exit 1
650         for i in $(regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' || exit 1; done
651
652 llvmfullaotcheck:
653         $(MAKE) fullaotcheck LLVM=1
654
655 bench: mono test.exe
656         time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
657
658 mbench: test.exe
659         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
660
661 stat1: mono bench.exe
662         $(RUNTIME) --verbose --statfile stats.pl --regression bench.exe
663         perl viewstat.pl stats.pl
664
665 stat2: mono basic.exe
666         $(RUNTIME) --verbose --statfile stats.pl --regression basic.exe
667         perl viewstat.pl -e stats.pl
668
669 stat3: mono bench.exe
670         $(RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
671         perl viewstat.pl stats.pl
672
673 docu: mini.sgm
674         docbook2txt mini.sgm
675
676 check-local: rcheck
677
678 clean-local:
679         rm -f mono a.out gmon.out *.o buildver.h test.exe
680
681 pkgconfigdir = $(libdir)/pkgconfig
682
683 if JIT_SUPPORTED
684 BUILT_SOURCES = version.h $(arch_built)
685 else
686 BUILT_SOURCES = version.h
687 endif
688
689 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
690 EXTRA_DIST = $(common_BURGSRC) TestDriver.cs ldscript ldscript.mono \
691         genmdesc.pl                             \
692         $(test_sources)                         \
693         $(x86_sources) cpu-x86.md               \
694         $(amd64_sources) cpu-amd64.md           \
695         $(ppc_sources) cpu-ppc.md cpu-ppc64.md  \
696         $(arm_sources) cpu-arm.md               \
697         $(mips_sources) cpu-mips.md             \
698         $(sparc_sources) cpu-sparc.md           \
699         $(s390_sources) cpu-s390.md             \
700         $(s390x_sources) cpu-s390x.md           \
701         $(ia64_sources) cpu-ia64.md             \
702         $(alpha_sources) cpu-alpha.md           \
703         $(hppa_sources) cpu-hppa.md             \
704         $(windows_sources)                      \
705         $(darwin_sources) Info.plist            \
706         $(posix_sources)
707
708 version.h: Makefile
709         if test -d $(top_srcdir)/.git; then \
710                 (cd $(top_srcdir); \
711                         LANG=C; export LANG; \
712                         branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
713                         version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
714                         echo "#define FULL_VERSION \"$$branch/$$version\""; \
715                 ); \
716         else \
717                 echo "#define FULL_VERSION \"tarball\""; \
718         fi > version.h
719
720 # Utility target for patching libtool to speed up linking
721 patch-libtool:
722         sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
723         chmod a+x ../../libtool
724
725 tags:
726         etags -o TAGS `find .. -name "*.h" -o -name "*.c"`