[hybrid] Fix more tests run
[mono.git] / mono / mini / Makefile.am.in
1 count=100000
2 mtest=for_loop
3 monodir=$(top_builddir)
4 mono=$(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),mono)
5
6 if HOST_WIN32
7 PLATFORM_PATH_SEPARATOR=;
8 else
9 PLATFORM_PATH_SEPARATOR=:
10 endif
11
12 # This is needed for automake dependency generation
13 libgc_libs=$(monodir)/libgc/libmonogc.la
14 libgc_static_libs=$(monodir)/libgc/libmonogc-static.la
15
16 boehm_libs=     \
17         $(monodir)/mono/metadata/libmonoruntime.la      \
18         $(monodir)/mono/utils/libmonoutils.la \
19         $(GLIB_LIBS) $(LIBICONV) \
20         $(libgc_libs)
21
22 sgen_libs = \
23         $(monodir)/mono/metadata/libmonoruntimesgen.la  \
24         $(monodir)/mono/sgen/libmonosgen.la     \
25         $(monodir)/mono/utils/libmonoutils.la \
26         $(GLIB_LIBS) $(LIBICONV)
27
28 boehm_static_libs=      \
29         $(monodir)/mono/metadata/libmonoruntime-static.la       \
30         $(monodir)/mono/utils/libmonoutils.la \
31         $(GLIB_LIBS) $(LIBICONV) \
32         $(libgc_static_libs)
33
34 sgen_static_libs = \
35         $(monodir)/mono/metadata/libmonoruntimesgen-static.la   \
36         $(monodir)/mono/sgen/libmonosgen-static.la      \
37         $(monodir)/mono/utils/libmonoutils.la \
38         $(GLIB_LIBS) $(LIBICONV)
39
40 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
41
42 RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_builddir)/runtime/mono-wrapper)
43
44 MINI_RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
45 TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/mono-wrapper
46 INTERPRETER_RUNTIME = $(MINI_RUNTIME) --interpreter
47 RUNTIME_AOTCHECK = MONO_PATH="$(CLASS)$(PLATFORM_PATH_SEPARATOR)." $(RUNTIME_EXECUTABLE)
48
49 MCS = CSC_SDK_PATH_DISABLED= $(TOOLS_RUNTIME) $(CSC) -unsafe -nowarn:0162 -nologo -noconfig -r:$(CLASS)/mscorlib.dll -r:$(CLASS)/System.dll -r:$(CLASS)/System.Core.dll
50 ILASM = $(TOOLS_RUNTIME) $(mcs_topdir)/class/lib/build/ilasm.exe
51
52 AM_CFLAGS = \
53         -I$(top_srcdir)         \
54         $(GLIB_CFLAGS)          \
55         $(LLVM_CFLAGS)          \
56         $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS)
57
58 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
59
60 if HOST_WIN32
61 export HOST_CC
62 # The mingw math.h has "extern inline" functions that dont appear in libs, so
63 # optimisation is required to actually inline them
64 PLATFORM_CFLAGS = -O
65 endif
66
67 # hack for automake to have the same source file in a library and a bin
68 genmdesc_CFLAGS = $(AM_CFLAGS)
69
70 monoldflags=$(export_ldflags)
71 monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
72
73 if HOST_WIN32
74 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
75 else
76 if PLATFORM_ANDROID
77 libmonoldflags= -avoid-version $(monoldflags)
78 else
79 libmonoldflags=$(monoldflags) -version-info 1:0:0
80 endif
81 endif
82
83 if SUPPORT_SGEN
84 sgen_binaries = mono-sgen
85 sgen_libraries = libmonosgen-2.0.la
86 sgen_static_libraries = libmini-static.la $(sgen_static_libs)
87 endif
88
89 if SUPPORT_BOEHM
90 boehm_libraries = libmonoboehm-2.0.la
91 boehm_static_libraries = libmini-static.la $(boehm_static_libs)
92 boehm_binaries  = mono-boehm
93 endif
94
95 if SUPPORT_SGEN
96 mono_bin_suffix = sgen
97 libmono_suffix = sgen
98 else
99 mono_bin_suffix = boehm
100 libmono_suffix = boehm
101 endif
102
103 if DISABLE_EXECUTABLES
104 else
105 mono: mono-$(mono_bin_suffix)
106         ln -sf $< $@
107
108 mono.exe: mono-$(mono_bin_suffix).exe
109         ln -sf $< $@
110
111 install-exec-hook:
112         (cd $(DESTDIR)$(bindir) && ln -sf mono-$(mono_bin_suffix) mono)
113         (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)
114 endif
115
116 if DISABLE_EXECUTABLES
117 else
118 if HOST_WIN32
119 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
120 else
121 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
122 endif
123 endif
124
125 if DISABLE_EXECUTABLES
126 noinst_PROGRAMS = genmdesc
127 else
128 noinst_PROGRAMS = genmdesc mono
129 endif
130
131 if DISABLE_EXECUTABLES
132 shared_libraries = $(boehm_libraries) $(sgen_libraries)
133 else
134 if SHARED_MONO
135 shared_libraries = $(boehm_libraries) $(sgen_libraries)
136 endif
137 endif
138
139 lib_LTLIBRARIES = $(shared_libraries)
140
141 if SHARED_MONO
142 mini_common_lib = libmini.la
143 else
144 mini_common_lib = 
145 endif
146
147 if DISABLE_EXECUTABLES
148 noinst_LTLIBRARIES = $(mini_common_lib)
149 else
150 noinst_LTLIBRARIES = $(mini_common_lib) libmini-static.la
151 endif
152
153 if LOADED_LLVM
154 lib_LTLIBRARIES += libmono-llvm.la
155 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp
156 libmono_llvm_la_LIBADD = $(GLIB_LIBS) $(LLVM_LIBS) $(LLVM_LDFLAGS)
157 if PLATFORM_DARWIN
158 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
159 else
160 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmonoboehm-$(API_VER).la $(boehm_libs)
161 endif
162 endif
163
164 mono_boehm_SOURCES = \
165         main.c
166
167 mono_CFLAGS = $(AM_CFLAGS)
168
169 mono_boehm_CFLAGS = $(AM_CFLAGS)
170
171 AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
172
173 mono_sgen_SOURCES = \
174         main-sgen.c
175
176 mono_SOURCES = \
177         main-sgen.c
178
179 mono_sgen_CFLAGS = $(AM_CFLAGS)
180
181 # We build this after libmono was built so it contains the date when the final
182 # link was done
183 if SUPPORT_BOEHM
184 if DISABLE_EXECUTABLES
185 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime.la
186 else
187 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la
188 endif
189         @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
190 mono_boehm-main.$(OBJEXT): buildver-boehm.h
191 endif
192
193 if DISABLE_EXECUTABLES
194 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la
195 else
196 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la $(monodir)/mono/sgen/libmonosgen-static.la
197 endif
198         @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
199 mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h
200 main-sgen.$(OBJEXT): buildver-sgen.h
201
202 if DTRACE_G_REQUIRED
203 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
204 if STATIC_MONO
205 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
206 else
207 MONO_DTRACE_OBJECT = 
208 endif
209 else
210 MONO_DTRACE_OBJECT = 
211 LIBMONO_DTRACE_OBJECT = 
212 endif
213
214 if STATIC_MONO
215 # Link libmono into mono statically
216 # This leads to higher performance, especially with TLS
217 MONO_LIB=$(boehm_static_libraries)
218 MONO_SGEN_LIB=$(sgen_static_libraries)
219 else 
220 MONO_LIB=libmonoboehm-2.0.la
221 MONO_SGEN_LIB=libmonosgen-2.0.la
222 endif
223
224 if LOADED_LLVM
225 LLVMMONOF=
226 else
227 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
228 endif
229
230 mono_boehm_LDADD = \
231         $(MONO_LIB)             \
232         $(GLIB_LIBS)            \
233         $(LLVMMONOF)            \
234         $(LIBICONV)             \
235         -lm                     \
236         $(MONO_DTRACE_OBJECT)
237
238 mono_boehm_LDFLAGS = \
239         $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
240
241 mono_sgen_LDADD = \
242         $(MONO_SGEN_LIB)        \
243         $(GLIB_LIBS)            \
244         $(LLVMMONOF)            \
245         $(LIBICONV)             \
246         -lm                     \
247         $(MONO_DTRACE_OBJECT)
248
249 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
250
251 if BITCODE
252 libmonoldflags += -no-undefined
253 endif
254
255 # if SUPPORT_SGEN
256
257 # mono_LDADD = $(mono_sgen_LDADD)
258 # mono_LDFLAGS = $(mono_sgen_LDFLAGS)
259
260 # endif
261
262
263 if DTRACE_G_REQUIRED
264
265 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
266         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
267         $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
268
269 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
270         DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
271         --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
272
273 endif
274
275 # Create monow.exe, linked for the 'windows' subsystem
276 if HOST_WIN32
277 if SUPPORT_BOEHM
278 monow_LDADD = $(mono_boehm_LDADD)
279 monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
280 monow_SOURCES = $(mono_boehm_SOURCES)
281 else
282 monow_LDADD = $(mono_sgen_LDADD)
283 monow_LDFLAGS = $(mono_sgen_LDFLAGS) -mwindows
284 monow_SOURCES = $(mono_sgen_SOURCES)
285 endif
286 endif
287
288 genmdesc_SOURCES = \
289         mini.h          \
290         seq-points.h    \
291         genmdesc.c      \
292         helpers.c       \
293         ../metadata/opcodes.c
294
295 # Don't link this against libmonoruntime to speed up rebuilds
296 genmdesc_LDADD = \
297         $(monodir)/mono/utils/libmonoutils.la -lm       \
298         $(GLIB_LIBS)                                    \
299         $(LIBICONV)
300
301 x86_sources = \
302         mini-x86.c              \
303         mini-x86.h              \
304         exceptions-x86.c        \
305         tramp-x86.c     \
306         mini-x86-gsharedvt.c    \
307         tramp-x86-gsharedvt.c
308
309 amd64_sources = \
310         mini-amd64.c            \
311         mini-amd64.h            \
312         exceptions-amd64.c      \
313         tramp-amd64.c   \
314         mini-amd64-gsharedvt.c  \
315         mini-amd64-gsharedvt.h  \
316         tramp-amd64-gsharedvt.c
317
318 ppc_sources = \
319         mini-ppc.c              \
320         mini-ppc.h              \
321         exceptions-ppc.c        \
322         tramp-ppc.c
323
324 arm_sources = \
325         mini-arm.c              \
326         mini-arm.h              \
327         exceptions-arm.c        \
328         tramp-arm.c     \
329         mini-arm-gsharedvt.c    \
330         tramp-arm-gsharedvt.c
331
332 arm64_sources = \
333         mini-arm64.c            \
334         mini-arm64.h            \
335         exceptions-arm64.c      \
336         tramp-arm64.c   \
337         mini-arm64-gsharedvt.c  \
338         mini-arm64-gsharedvt.h  \
339         tramp-arm64-gsharedvt.c
340
341 mips_sources = \
342         mini-mips.c             \
343         mini-mips.h             \
344         exceptions-mips.c       \
345         tramp-mips.c
346
347 sparc_sources = \
348         mini-sparc.c            \
349         mini-sparc.h            \
350         exceptions-sparc.c      \
351         tramp-sparc.c
352
353 s390x_sources = \
354         mini-s390x.c            \
355         mini-s390x.h            \
356         support-s390x.h         \
357         exceptions-s390x.c      \
358         tramp-s390x.c
359
360 ia64_sources = \
361         mini-ia64.c             \
362         mini-ia64.h             \
363         exceptions-ia64.c       \
364         tramp-ia64.c
365
366 darwin_sources = \
367         mini-darwin.c
368
369 windows_sources = \
370         mini-windows.c \
371         mini-windows.h \
372         mini-windows-dllmain.c
373
374 posix_sources = \
375         mini-posix.c
376
377 if ENABLE_LLVM
378 if LOADED_LLVM
379 llvm_sources = \
380         mini-llvm-loaded.c
381 else
382 llvm_sources = \
383         mini-llvm.c             \
384         mini-llvm-loaded.c \
385         mini-llvm-cpp.cpp \
386         llvm-jit.cpp
387 endif
388 endif
389
390 if ENABLE_INTERPRETER
391 interpreter_sources =   \
392         interpreter/hacks.h             \
393         interpreter/interp.h    \
394         interpreter/interp-internals.h  \
395         interpreter/interp.c    \
396         interpreter/mintops.h   \
397         interpreter/mintops.def \
398         interpreter/mintops.c   \
399         interpreter/transform.c
400 endif
401
402 if ENABLE_LLVM
403 llvm_runtime_sources = \
404         llvm-runtime.cpp
405 else
406 if ENABLE_LLVM_RUNTIME
407 llvm_runtime_sources = \
408         llvm-runtime.cpp
409 endif
410 endif
411
412 common_sources = \
413         mini.c                  \
414         mini-runtime.c  \
415         seq-points.c    \
416         seq-points.h    \
417         ir-emit.h               \
418         method-to-ir.c          \
419         cfgdump.h               \
420         cfgdump.c               \
421         decompose.c             \
422         mini.h                  \
423         version.h               \
424         optflags-def.h          \
425         jit-icalls.h            \
426         jit-icalls.c            \
427         trace.c                 \
428         trace.h                 \
429         patch-info.h            \
430         mini-ops.h              \
431         mini-arch.h             \
432         dominators.c            \
433         cfold.c                 \
434         regalloc.h              \
435         helpers.c               \
436         liveness.c              \
437         ssa.c                   \
438         abcremoval.c            \
439         abcremoval.h            \
440         local-propagation.c     \
441         driver.c                \
442         debug-mini.c            \
443         linear-scan.c           \
444         aot-compiler.h          \
445         aot-compiler.c          \
446         aot-runtime.c           \
447         graph.c                 \
448         mini-codegen.c          \
449         mini-exceptions.c       \
450         mini-trampolines.c      \
451         branch-opts.c           \
452         mini-generic-sharing.c  \
453         simd-methods.h          \
454         tasklets.c              \
455         tasklets.h              \
456         simd-intrinsics.c       \
457         mini-native-types.c \
458         mini-unwind.h           \
459         unwind.c                \
460         image-writer.h          \
461         image-writer.c          \
462         dwarfwriter.h           \
463         dwarfwriter.c           \
464         mini-gc.h               \
465         mini-gc.c               \
466         debugger-agent.h        \
467         debugger-agent.c        \
468         xdebug.c                        \
469         mini-llvm.h                     \
470         mini-llvm-cpp.h \
471         llvm-jit.h              \
472         alias-analysis.c        \
473         mini-cross-helpers.c \
474         arch-stubs.c            \
475         llvm-runtime.h  \
476         type-checking.c \
477         lldb.h                  \
478         lldb.c
479
480 test_sources =                  \
481         basic-calls.cs          \
482         basic-long.cs           \
483         bench.cs                \
484         objects.cs              \
485         arrays.cs               \
486         basic-float.cs          \
487         basic-math.cs           \
488         basic.cs                \
489         exceptions.cs           \
490         devirtualization.cs     \
491         iltests.il              \
492         test.cs                 \
493         generics.cs             \
494         generics-variant-types.il\
495         basic-simd.cs \
496         basic-vectors.cs \
497         aot-tests.cs \
498         gc-test.cs \
499         gshared.cs
500
501 if NACL_CODEGEN
502 test_sources += nacl.cs
503 endif
504
505 regtests_UNIVERSAL = \
506         basic.exe \
507         basic-float.exe \
508         basic-long.exe \
509         basic-calls.exe \
510         objects.exe \
511         arrays.exe \
512         basic-math.exe \
513         exceptions.exe \
514         iltests.exe \
515         devirtualization.exe \
516         generics.exe \
517         basic-simd.exe \
518         basic-vectors.exe
519
520 if NACL_CODEGEN
521 regtests_UNIVERSAL += nacl.exe
522 endif
523
524 regtests_DISABLED = 
525
526 if FULL_AOT_TESTS
527 regtests_DISABLED += 
528 endif
529
530 regtests = $(filter-out $(regtests_DISABLED),$(regtests_UNIVERSAL))
531
532 iregtests = \
533         basic.exe \
534         basic-float.exe \
535         basic-long.exe \
536         basic-calls.exe \
537         generics.exe \
538         objects.exe
539
540 if X86
541 arch_sources = $(x86_sources)
542 arch_built=cpu-x86.h
543 arch_define=__i386__
544 endif
545
546 if AMD64
547 arch_sources = $(amd64_sources)
548 arch_built=cpu-amd64.h
549 arch_define=__x86_64__
550 ARCH_FULLAOT_EXCLUDE=
551 endif
552
553 if POWERPC
554 arch_sources = $(ppc_sources)
555 arch_built=cpu-ppc.h
556 arch_define=__ppc__
557 endif
558
559 if POWERPC64
560 arch_sources = $(ppc_sources)
561 arch_built=cpu-ppc64.h
562 arch_define=__ppc64__
563 endif
564
565 if MIPS
566 arch_sources = $(mips_sources)
567 arch_built=cpu-mips.h
568 arch_define=__mips__
569 endif
570
571 if ARM
572 # pick up arm_dpimacros.h
573 ARCH_CFLAGS = -I../arch/arm
574 arch_sources = $(arm_sources)
575 arch_built=cpu-arm.h
576 arch_define=__arm__
577 endif
578
579 if ARM64
580 arch_sources = $(arm64_sources)
581 arch_built=cpu-arm64.h
582 arch_define=__aarch64__
583 endif
584
585 if SPARC
586 arch_sources = $(sparc_sources)
587 arch_built=cpu-sparc.h
588 arch_define=__sparc__
589 endif
590
591 if SPARC64
592 arch_sources = $(sparc_sources)
593 arch_built=cpu-sparc.h
594 arch_define=__sparc__
595 endif
596
597 if S390X
598 arch_sources = $(s390x_sources)
599 arch_built=cpu-s390x.h
600 arch_define=__s390__
601 endif
602
603 if IA64
604 arch_sources = $(ia64_sources)
605 arch_built = cpu-ia64.h
606 arch_define=__ia64__
607 endif
608
609 if HOST_WIN32
610 os_sources = $(windows_sources)
611 monobin_platform_ldflags=
612 endif
613
614 if PLATFORM_SIGPOSIX
615 os_sources = $(posix_sources)
616 monobin_platform_ldflags=
617 endif
618
619 if PLATFORM_DARWIN
620 os_sources = $(darwin_sources) $(posix_sources)
621 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
622 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
623 endif
624
625 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(interpreter_sources) $(arch_sources) $(os_sources)
626 libmini_la_CFLAGS = $(mono_CFLAGS)
627
628 libmonoboehm_2_0_la_SOURCES =
629 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
630 libmonoboehm_2_0_la_LIBADD = libmini.la $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
631 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags)
632
633 libmonosgen_2_0_la_SOURCES =
634 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
635 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
636 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags)
637
638 #
639 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
640 # compile time dependencies on boehm/sgen.
641 #
642 libmini_static_la_SOURCES = $(libmini_la_SOURCES)
643 libmini_static_la_CFLAGS = $(AM_CFLAGS)
644 libmini_static_la_LDFLAGS = -static
645 libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
646
647 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
648
649 libmonoinclude_HEADERS = jit.h
650
651 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
652
653 basic-simd.exe: basic-simd.cs TestDriver.dll
654         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
655
656 basic-vectors.exe: basic-vectors.cs TestDriver.dll
657         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/System.Numerics.dll -r:$(CLASS)/System.Numerics.Vectors.dll
658
659 nacl.exe: nacl.cs TestDriver.dll
660         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
661
662 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
663         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll -r:$(CLASS)/System.Core.dll
664
665 %.exe: %.cs TestDriver.dll
666         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
667
668 %.exe: %.il
669         $(ILASM) -output=$@ $<
670
671 TestDriver.dll: $(srcdir)/TestDriver.cs $(srcdir)/TestHelpers.cs
672         $(MCS) -out:$@ -target:library $^
673
674 generics-variant-types.dll: generics-variant-types.il
675         $(ILASM) -dll -output=$@ $<
676
677 if NACL_CODEGEN
678 GENMDESC_OPTS=--nacl
679 else !NACL_CODEGEN
680 GENMDESC_OPTS=
681 endif !NACL_CODEGEN
682
683 # we don't always use the perl impl because it's an additional
684 # build dependency for the poor windows users
685 # $(arch_define) is the preprocessor symbol that enables all the opcodes
686 # for the specific platform in mini-ops.h
687 if CROSS_COMPILING
688 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
689 else !CROSS_COMPILING
690 if NACL_CODEGEN
691 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
692 else
693 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
694 endif
695 endif !CROSS_COMPILING
696
697 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
698         $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
699
700 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
701         $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
702
703 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
704         $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
705
706 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
707         $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
708
709 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
710         $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
711
712 cpu-arm64.h: cpu-arm64.md genmdesc$(EXEEXT)
713         $(GENMDESC_PRG) cpu-arm64.h arm64_cpu_desc $(srcdir)/cpu-arm64.md
714
715 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
716         $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
717
718 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
719         $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
720
721 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
722         $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
723
724 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
725         $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
726
727 testi: mono test.exe
728         $(MINI_RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
729
730 # ensure the tests are actually correct
731 checktests: $(regtests)
732         for i in $(regtests); do $(MINI_RUNTIME) $$i; done
733
734 rcheck-nunit: mono $(regtests)
735         $(MINI_RUNTIME) --regression $(regtests) > regressiontests.out 2>&1; cat regressiontests.out; \
736         if grep -q "100% pass" regressiontests.out; then successbool=True; failurescount=0; else successbool=False; failurescount=1; fi; \
737         echo "<?xml version='1.0' encoding='utf-8'?>\
738                 <test-results failures='$$failurescount' total='1' not-run='0' name='regression-tests.dummy' date='$$(date +%F)' time='$$(date +%T)'>\
739                         <test-suite name='regression-tests.dummy' success='$$successbool' time='0'>\
740                                 <results><test-case name='MonoTests.regressions.100percentsuccess' executed='True' success='$$successbool' time='0'>" > TestResult-regression.xml; \
741                                         if [ "$$successbool" = "False" ]; then echo "<failure><message><![CDATA[$$(cat regressiontests.out)]]></message><stack-trace></stack-trace></failure>" >> TestResult-regression.xml; fi; \
742                                 echo "</test-case></results>\
743                         </test-suite>\
744                 </test-results>" >> TestResult-regression.xml; exit $$failurescount
745
746 rcheck: mono $(regtests)
747         $(MINI_RUNTIME) --regression $(regtests)
748
749 richeck: mono $(iregtests)
750         $(INTERPRETER_RUNTIME) --regression $(iregtests)
751
752 if ARM
753 check-seq-points:
754 else
755 check-seq-points: mono $(regtests)
756         rm -f TestResult-op_il_seq_point.xml
757         for i in $(regtests); do $(srcdir)/test_op_il_seq_point.sh $$i || ($(srcdir)/test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
758         for i in $(regtests); do $(srcdir)/test_op_il_seq_point.sh $$i --aot || ($(srcdir)/test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
759         $(srcdir)/test_op_il_seq_point_headerfooter.sh
760 endif
761
762 gctest: mono gc-test.exe
763         MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(MINI_RUNTIME) --regression gc-test.exe
764
765 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
766 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
767
768 aotcheck: mono $(regtests)
769         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
770         $(MINI_RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
771         for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
772         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
773
774 llvmaotcheck:
775         $(MAKE) aotcheck LLVM=1
776
777 gsharedvtcheck:
778         $(MAKE) fullaotcheck GSHAREDVT=1
779
780 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
781
782 FULLAOT_LIBS_UNIVERSAL = \
783         mscorlib.dll \
784         System.Core.dll \
785         System.dll \
786         System.Xml.dll \
787         System.Security.dll \
788         Mono.Simd.dll \
789         Mono.Security.dll \
790         System.Numerics.dll \
791         System.Numerics.Vectors.dll \
792         Mono.Posix.dll \
793         System.Configuration.dll
794
795 FULLAOT_LIBS_DISABLED =
796
797 if FULL_AOT_TESTS
798 # Skip aoting the tests that aren't compiled 
799 # on the full aot profiles because they're skipped
800 # on mobile profiles
801 FULLAOT_LIBS_DISABLED += \
802         Mono.Posix.dll \
803         System.Configuration.dll
804 endif
805
806 FULLAOT_LIBS = $(filter-out $(FULLAOT_LIBS_DISABLED),$(FULLAOT_LIBS_UNIVERSAL))
807
808 FULLAOT_TMP_DIR=$(top_builddir)/mono/mini/fullaot-tmp
809
810 # This currently only works on amd64/arm
811 fullaotcheck: $(mono) $(fullaot_regtests)
812         rm -rf $(FULLAOT_TMP_DIR)
813         mkdir $(FULLAOT_TMP_DIR)
814         $(MAKE) fullaot-libs AOT_FLAGS="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" GSHAREDVT=$(GSHAREDVT)
815         cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll $(FULLAOT_TMP_DIR)/
816         MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" $(FULLAOT_TMP_DIR)/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
817         ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) $(FULLAOT_TMP_DIR)/
818         for i in $(fullaot_regtests); do echo $$i; MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper --full-aot $(FULLAOT_TMP_DIR)/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
819
820 # This can run in parallel
821 fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
822
823 fullaot-tmp/%.dylib: $(CLASS)/%
824         cp $(CLASS)/$* fullaot-tmp/
825         mkdir fullaot-tmp/$*-tmp
826         MONO_PATH="fullaot-tmp/$(PLATFORM_PATH_SEPARATOR)$(CLASS)" $(top_builddir)/runtime/mono-wrapper $(if $(GSHAREDVT),-O=gsharedvt) --aot=$(AOT_FLAGS),temp-path=fullaot-tmp/$*-tmp fullaot-tmp/$*
827         rm -rf fullaot-tmp/$*-tmp
828
829 llvmfullaotcheck:
830         $(MAKE) fullaotcheck LLVM=1
831
832 llvmonly_regtests = $(fullaot_regtests) gshared.exe
833
834 llvmonlycheck: mono $(llvmonly_regtests)
835         rm -rf fullaot-tmp
836         mkdir fullaot-tmp
837         $(MAKE) fullaot-libs AOT_FLAGS="llvmonly,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)"
838         cp $(llvmonly_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
839         MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper  --aot=llvmonly fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
840         ln -s $$PWD/mono fullaot-tmp/
841         for i in $(llvmonly_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --llvmonly fullaot-tmp/$$i --exclude '!BITCODE' || exit 1; done
842
843 gccheck: gc-test.exe
844         MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe     
845
846 bench: mono test.exe
847         time env $(MINI_RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
848
849 mbench: test.exe
850         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
851
852 stat1: mono bench.exe
853         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression bench.exe
854         perl viewstat.pl stats.pl
855
856 stat2: mono basic.exe
857         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression basic.exe
858         perl viewstat.pl -e stats.pl
859
860 stat3: mono bench.exe
861         $(MINI_RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
862         perl viewstat.pl stats.pl
863
864 docu: mini.sgm
865         docbook2txt mini.sgm
866
867 # We need these because automake can't process normal make conditionals
868 check_local_targets = $(if $(EMIT_NUNIT), rcheck-nunit, rcheck)
869
870 check-local: $(check_local_targets)
871
872 clean-local:
873         rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResult-op_il_seq_point.xml*
874
875 pkgconfigdir = $(libdir)/pkgconfig
876
877 BUILT_SOURCES = version.h $(arch_built)
878
879 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
880 EXTRA_DIST = TestDriver.cs \
881         TestHelpers.cs \
882         genmdesc.pl                             \
883         $(test_sources)                         \
884         $(x86_sources) cpu-x86.md               \
885         $(amd64_sources) cpu-amd64.md           \
886         $(ppc_sources) cpu-ppc.md cpu-ppc64.md  \
887         $(arm_sources) cpu-arm.md               \
888         $(arm64_sources) cpu-arm64.md           \
889         $(mips_sources) cpu-mips.md             \
890         $(sparc_sources) cpu-sparc.md           \
891         $(s390x_sources) cpu-s390x.md           \
892         $(ia64_sources) cpu-ia64.md             \
893         $(windows_sources)                      \
894         $(darwin_sources) Info.plist            \
895         $(posix_sources)                                        \
896         test_op_il_seq_point.sh                 \
897         test_op_il_seq_point_headerfooter.sh    \
898         Makefile.am.in
899
900 version.h: Makefile
901         if test -d $(top_srcdir)/.git; then \
902                 (cd $(top_srcdir); \
903                         LANG=C; export LANG; \
904                         if test -z "$$ghprbPullId"; then \
905                                 branch=`git branch | grep '^\*' | sed 's/(detached from .*/explicit/' | cut -d ' ' -f 2`; \
906                         else \
907                                 branch="pull-request-$$ghprbPullId"; \
908                         fi; \
909                         version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
910                         echo "#define FULL_VERSION \"$$branch/$$version\""; \
911                 ); \
912         else \
913                 echo "#define FULL_VERSION \"tarball\""; \
914         fi > version.h
915
916 # Utility target for patching libtool to speed up linking
917 patch-libtool:
918         sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
919         chmod a+x ../../libtool
920
921 # Utility target for patching libtool to get rid of the 'ranlib: file <file> has no symbols" warnings
922 patch-osx-libtool:
923         sed -e 's/old_archive_cmds=.*/old_archive_cmds="libtool -no_warning_for_no_symbols -static -o \\$$oldlib \\$$oldobjs"/g' < ../../libtool > 2; mv 2 ../../libtool
924         chmod a+x ../../libtool
925
926 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
927 patch-automake:
928         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
929
930 tags:
931         etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
932
933 if HAS_EXTENSION_MODULE
934 else
935 Makefile.am: Makefile.am.in
936         cp $< $@
937 endif