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