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