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