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