[bcl] Rename aot_only profile to testing_aot_full
[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 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
52 ILASM = $(MINI_RUNTIME) $(CLASS)/ilasm.exe
53
54 AM_CFLAGS = \
55         -I$(top_srcdir)         \
56         $(GLIB_CFLAGS)          \
57         $(LLVM_CFLAGS)          \
58         $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS)
59
60 AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
61
62 if HOST_WIN32
63 export HOST_CC
64 # The mingw math.h has "extern inline" functions that dont appear in libs, so
65 # optimisation is required to actually inline them
66 PLATFORM_CFLAGS = -O
67 endif
68
69 # hack for automake to have the same source file in a library and a bin
70 genmdesc_CFLAGS = $(AM_CFLAGS)
71
72 monoldflags=$(export_ldflags)
73 monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
74
75 if HOST_WIN32
76 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
77 else
78 if PLATFORM_ANDROID
79 libmonoldflags= -avoid-version $(monoldflags)
80 else
81 libmonoldflags=$(monoldflags) -version-info 1:0:0
82 endif
83 endif
84
85 if SUPPORT_SGEN
86 sgen_binaries = mono-sgen
87 sgen_libraries = libmonosgen-2.0.la
88 sgen_static_libraries = libmini-static.la $(sgen_static_libs)
89 endif
90
91 if SUPPORT_BOEHM
92 boehm_libraries = libmonoboehm-2.0.la
93 boehm_static_libraries = libmini-static.la $(boehm_static_libs)
94 boehm_binaries  = mono-boehm
95 endif
96
97 if SUPPORT_SGEN
98 mono_bin_suffix = sgen
99 libmono_suffix = sgen
100 else
101 mono_bin_suffix = boehm
102 libmono_suffix = boehm
103 endif
104
105 if DISABLE_EXECUTABLES
106 else
107 mono: mono-$(mono_bin_suffix)
108         ln -sf $< $@
109
110 mono.exe: mono-$(mono_bin_suffix).exe
111         ln -sf $< $@
112
113 install-exec-hook:
114         (cd $(DESTDIR)$(bindir) && ln -sf mono-$(mono_bin_suffix) mono)
115         (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)
116 endif
117
118 if DISABLE_EXECUTABLES
119 else
120 if HOST_WIN32
121 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries) monow
122 else
123 bin_PROGRAMS = $(boehm_binaries) $(sgen_binaries)
124 endif
125 endif
126
127 if DISABLE_EXECUTABLES
128 noinst_PROGRAMS = genmdesc
129 else
130 noinst_PROGRAMS = genmdesc mono
131 endif
132
133 if DISABLE_EXECUTABLES
134 shared_libraries = $(boehm_libraries) $(sgen_libraries)
135 else
136 if SHARED_MONO
137 shared_libraries = $(boehm_libraries) $(sgen_libraries)
138 endif
139 endif
140
141 lib_LTLIBRARIES = $(shared_libraries)
142
143 if SHARED_MONO
144 mini_common_lib = libmini.la
145 else
146 mini_common_lib = 
147 endif
148
149 if DISABLE_EXECUTABLES
150 noinst_LTLIBRARIES = $(mini_common_lib)
151 else
152 noinst_LTLIBRARIES = $(mini_common_lib) libmini-static.la
153 endif
154
155 if LOADED_LLVM
156 lib_LTLIBRARIES += libmono-llvm.la
157 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp
158 libmono_llvm_la_LIBADD = $(GLIB_LIBS) $(LLVM_LIBS) $(LLVM_LDFLAGS)
159 if PLATFORM_DARWIN
160 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
161 else
162 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmonoboehm-$(API_VER).la $(boehm_libs)
163 endif
164 endif
165
166 mono_boehm_SOURCES = \
167         main.c
168
169 mono_CFLAGS = $(AM_CFLAGS)
170
171 mono_boehm_CFLAGS = $(AM_CFLAGS)
172
173 AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
174
175 mono_sgen_SOURCES = \
176         main-sgen.c
177
178 mono_SOURCES = \
179         main-sgen.c
180
181 mono_sgen_CFLAGS = $(AM_CFLAGS)
182
183 # We build this after libmono was built so it contains the date when the final
184 # link was done
185 if SUPPORT_BOEHM
186 if DISABLE_EXECUTABLES
187 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime.la
188 else
189 buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la
190 endif
191         @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
192 mono_boehm-main.$(OBJEXT): buildver-boehm.h
193 endif
194
195 if DISABLE_EXECUTABLES
196 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la
197 else
198 buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la $(monodir)/mono/sgen/libmonosgen-static.la
199 endif
200         @echo "const char *build_date = \"`date`\";" > buildver-sgen.h
201 mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h
202 main-sgen.$(OBJEXT): buildver-sgen.h
203
204 if DTRACE_G_REQUIRED
205 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
206 if STATIC_MONO
207 MONO_DTRACE_OBJECT = mono-dtrace.$(OBJEXT)
208 else
209 MONO_DTRACE_OBJECT = 
210 endif
211 else
212 MONO_DTRACE_OBJECT = 
213 LIBMONO_DTRACE_OBJECT = 
214 endif
215
216 if STATIC_MONO
217 # Link libmono into mono statically
218 # This leads to higher performance, especially with TLS
219 MONO_LIB=$(boehm_static_libraries)
220 MONO_SGEN_LIB=$(sgen_static_libraries)
221 else 
222 MONO_LIB=libmonoboehm-2.0.la
223 MONO_SGEN_LIB=libmonosgen-2.0.la
224 endif
225
226 if LOADED_LLVM
227 LLVMMONOF=
228 else
229 LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
230 endif
231
232 mono_boehm_LDADD = \
233         $(MONO_LIB)             \
234         $(GLIB_LIBS)            \
235         $(LLVMMONOF)            \
236         $(LIBICONV)             \
237         -lm                     \
238         $(MONO_DTRACE_OBJECT)
239
240 mono_boehm_LDFLAGS = \
241         $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
242
243 mono_sgen_LDADD = \
244         $(MONO_SGEN_LIB)        \
245         $(GLIB_LIBS)            \
246         $(LLVMMONOF)            \
247         $(LIBICONV)             \
248         -lm                     \
249         $(MONO_DTRACE_OBJECT)
250
251 mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
252
253 if BITCODE
254 libmonoldflags += -no-undefined
255 endif
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 if SUPPORT_BOEHM
280 monow_LDADD = $(mono_boehm_LDADD)
281 monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
282 monow_SOURCES = $(mono_boehm_SOURCES)
283 else
284 monow_LDADD = $(mono_sgen_LDADD)
285 monow_LDFLAGS = $(mono_sgen_LDFLAGS) -mwindows
286 monow_SOURCES = $(mono_sgen_SOURCES)
287 endif
288 endif
289
290 genmdesc_SOURCES = \
291         mini.h          \
292         seq-points.h    \
293         genmdesc.c      \
294         helpers.c       \
295         ../metadata/opcodes.c
296
297 # Don't link this against libmonoruntime to speed up rebuilds
298 genmdesc_LDADD = \
299         $(monodir)/mono/utils/libmonoutils.la -lm       \
300         $(GLIB_LIBS)                                    \
301         $(LIBICONV)
302
303 x86_sources = \
304         mini-x86.c              \
305         mini-x86.h              \
306         exceptions-x86.c        \
307         tramp-x86.c     \
308         mini-x86-gsharedvt.c    \
309         tramp-x86-gsharedvt.c
310
311 amd64_sources = \
312         mini-amd64.c            \
313         mini-amd64.h            \
314         exceptions-amd64.c      \
315         tramp-amd64.c   \
316         mini-amd64-gsharedvt.c  \
317         mini-amd64-gsharedvt.h  \
318         tramp-amd64-gsharedvt.c
319
320 ppc_sources = \
321         mini-ppc.c              \
322         mini-ppc.h              \
323         exceptions-ppc.c        \
324         tramp-ppc.c
325
326 arm_sources = \
327         mini-arm.c              \
328         mini-arm.h              \
329         exceptions-arm.c        \
330         tramp-arm.c     \
331         mini-arm-gsharedvt.c    \
332         tramp-arm-gsharedvt.c
333
334 arm64_sources = \
335         mini-arm64.c            \
336         mini-arm64.h            \
337         exceptions-arm64.c      \
338         tramp-arm64.c   \
339         mini-arm64-gsharedvt.c  \
340         mini-arm64-gsharedvt.h  \
341         tramp-arm64-gsharedvt.c
342
343 mips_sources = \
344         mini-mips.c             \
345         mini-mips.h             \
346         exceptions-mips.c       \
347         tramp-mips.c
348
349 sparc_sources = \
350         mini-sparc.c            \
351         mini-sparc.h            \
352         exceptions-sparc.c      \
353         tramp-sparc.c
354
355 s390x_sources = \
356         mini-s390x.c            \
357         mini-s390x.h            \
358         support-s390x.h         \
359         exceptions-s390x.c      \
360         tramp-s390x.c
361
362 ia64_sources = \
363         mini-ia64.c             \
364         mini-ia64.h             \
365         exceptions-ia64.c       \
366         tramp-ia64.c
367
368 darwin_sources = \
369         mini-darwin.c
370
371 windows_sources = \
372         mini-windows.c \
373         mini-windows.h \
374         mini-windows-dllmain.c
375
376 posix_sources = \
377         mini-posix.c
378
379 if ENABLE_LLVM
380 if LOADED_LLVM
381 llvm_sources = \
382         mini-llvm-loaded.c
383 else
384 llvm_sources = \
385         mini-llvm.c             \
386         mini-llvm-loaded.c \
387         mini-llvm-cpp.cpp \
388         llvm-jit.cpp
389 endif
390 endif
391
392 if ENABLE_LLVM
393 llvm_runtime_sources = \
394         llvm-runtime.cpp
395 else
396 if ENABLE_LLVM_RUNTIME
397 llvm_runtime_sources = \
398         llvm-runtime.cpp
399 endif
400 endif
401
402 common_sources = \
403         mini.c                  \
404         mini-runtime.c  \
405         seq-points.c    \
406         seq-points.h    \
407         ir-emit.h               \
408         method-to-ir.c          \
409         cfgdump.h               \
410         cfgdump.c               \
411         decompose.c             \
412         mini.h                  \
413         version.h               \
414         optflags-def.h          \
415         jit-icalls.h            \
416         jit-icalls.c            \
417         trace.c                 \
418         trace.h                 \
419         patch-info.h            \
420         mini-ops.h              \
421         mini-arch.h             \
422         dominators.c            \
423         cfold.c                 \
424         regalloc.h              \
425         helpers.c               \
426         liveness.c              \
427         ssa.c                   \
428         abcremoval.c            \
429         abcremoval.h            \
430         local-propagation.c     \
431         driver.c                \
432         debug-mini.c            \
433         linear-scan.c           \
434         aot-compiler.h          \
435         aot-compiler.c          \
436         aot-runtime.c           \
437         graph.c                 \
438         mini-codegen.c          \
439         mini-exceptions.c       \
440         mini-trampolines.c      \
441         branch-opts.c           \
442         mini-generic-sharing.c  \
443         simd-methods.h          \
444         tasklets.c              \
445         tasklets.h              \
446         simd-intrinsics.c       \
447         mini-native-types.c \
448         mini-unwind.h           \
449         unwind.c                \
450         image-writer.h          \
451         image-writer.c          \
452         dwarfwriter.h           \
453         dwarfwriter.c           \
454         mini-gc.h               \
455         mini-gc.c               \
456         debugger-agent.h        \
457         debugger-agent.c        \
458         xdebug.c                        \
459         mini-llvm.h                     \
460         mini-llvm-cpp.h \
461         llvm-jit.h              \
462         alias-analysis.c        \
463         mini-cross-helpers.c \
464         arch-stubs.c            \
465         llvm-runtime.h  \
466         type-checking.c
467
468 test_sources =                  \
469         basic-calls.cs          \
470         basic-long.cs           \
471         bench.cs                \
472         objects.cs              \
473         arrays.cs               \
474         basic-float.cs          \
475         basic-math.cs           \
476         basic.cs                \
477         exceptions.cs           \
478         devirtualization.cs     \
479         iltests.il              \
480         test.cs                 \
481         generics.cs             \
482         generics-variant-types.il\
483         basic-simd.cs \
484         basic-vectors.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 basic-vectors.exe
491
492 if INSTALL_TESTING_AOT_FULL
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_TESTING_AOT_FULL_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 basic-vectors.exe: basic-vectors.cs TestDriver.dll
624         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/System.Numerics.dll -r:$(CLASS)/System.Numerics.Vectors.dll
625
626 nacl.exe: nacl.cs TestDriver.dll
627         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
628
629 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
630         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll -r:$(CLASS)/System.Core.dll
631
632 %.exe: %.cs TestDriver.dll
633         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
634
635 %.exe: %.il
636         $(ILASM) -output=$@ $<
637
638 TestDriver.dll: $(srcdir)/TestDriver.cs $(srcdir)/TestHelpers.cs
639         $(MCS) -out:$@ -target:library $^
640
641 generics-variant-types.dll: generics-variant-types.il
642         $(ILASM) -dll -output=$@ $<
643
644 if NACL_CODEGEN
645 GENMDESC_OPTS=--nacl
646 else !NACL_CODEGEN
647 GENMDESC_OPTS=
648 endif !NACL_CODEGEN
649
650 # we don't always use the perl impl because it's an additional
651 # build dependency for the poor windows users
652 # $(arch_define) is the preprocessor symbol that enables all the opcodes
653 # for the specific platform in mini-ops.h
654 if CROSS_COMPILING
655 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
656 else !CROSS_COMPILING
657 if NACL_CODEGEN
658 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
659 else
660 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
661 endif
662 endif !CROSS_COMPILING
663
664 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
665         $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
666
667 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
668         $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
669
670 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
671         $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
672
673 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
674         $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
675
676 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
677         $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
678
679 cpu-arm64.h: cpu-arm64.md genmdesc$(EXEEXT)
680         $(GENMDESC_PRG) cpu-arm64.h arm64_cpu_desc $(srcdir)/cpu-arm64.md
681
682 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
683         $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
684
685 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
686         $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
687
688 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
689         $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
690
691 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
692         $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
693
694 testi: mono test.exe
695         $(MINI_RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
696
697 # ensure the tests are actually correct
698 checktests: $(regtests)
699         for i in $(regtests); do $(MINI_RUNTIME) $$i; done
700
701 rcheck-nunit: mono $(regtests)
702         $(MINI_RUNTIME) --regression $(regtests) > regressiontests.out 2>&1; cat regressiontests.out; \
703         if grep -q "100% pass" regressiontests.out; then successbool=True; failurescount=0; else successbool=False; failurescount=1; fi; \
704         echo "<?xml version='1.0' encoding='utf-8'?>\
705                 <test-results failures='$$failurescount' total='1' not-run='0' name='regression-tests.dummy' date='$$(date +%F)' time='$$(date +%T)'>\
706                         <test-suite name='regression-tests.dummy' success='$$successbool' time='0'>\
707                                 <results><test-case name='MonoTests.regressions.100percentsuccess' executed='True' success='$$successbool' time='0'>" > TestResult-regression.xml; \
708                                         if [ "$$successbool" = "False" ]; then echo "<failure><message><![CDATA[$$(cat regressiontests.out)]]></message><stack-trace></stack-trace></failure>" >> TestResult-regression.xml; fi; \
709                                 echo "</test-case></results>\
710                         </test-suite>\
711                 </test-results>" >> TestResult-regression.xml; exit $$failurescount
712
713 rcheck: mono $(regtests)
714         $(MINI_RUNTIME) --regression $(regtests)
715
716 if ARM
717 check-seq-points:
718 else
719 check-seq-points: mono $(regtests)
720         rm -f TestResult-op_il_seq_point.xml
721         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
722         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
723         $(srcdir)/test_op_il_seq_point_headerfooter.sh
724 endif
725
726 gctest: mono gc-test.exe
727         MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(MINI_RUNTIME) --regression gc-test.exe
728
729 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
730 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
731
732 aotcheck: mono $(regtests)
733         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
734         $(MINI_RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
735         for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
736         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
737
738 llvmaotcheck:
739         $(MAKE) aotcheck LLVM=1
740
741 gsharedvtcheck:
742         $(MAKE) fullaotcheck GSHAREDVT=1
743
744 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
745
746 # Skip aoting the tests that aren't compiled 
747 # on the testing_aot_full profile because they're skipped
748 # on mobile profiles
749 FULLAOT_LIBS_TESTING_AOT_FULL_BLACKLIST = \
750         Mono.Posix.dll \
751         System.Configuration.dll
752
753 FULLAOT_LIBS_UNIVERSAL = \
754         mscorlib.dll \
755         System.Core.dll \
756         System.dll \
757         System.Xml.dll \
758         System.Security.dll \
759         Mono.Simd.dll \
760         Mono.Security.dll
761
762 if INSTALL_TESTING_AOT_FULL
763 FULLAOT_LIBS= \
764         Mono.Dynamic.Interpreter.dll \
765         $(FULLAOT_LIBS_UNIVERSAL)
766 else
767 FULLAOT_LIBS= \
768         $(FULLAOT_LIBS_UNIVERSAL) \
769         $(FULLAOT_LIBS_TESTING_AOT_FULL_BLACKLIST)
770 endif
771
772 FULLAOT_TMP_DIR=$(top_builddir)/mono/mini/fullaot-tmp
773
774 # This currently only works on amd64/arm
775 fullaotcheck: $(mono) $(fullaot_regtests)
776         rm -rf $(FULLAOT_TMP_DIR)
777         mkdir $(FULLAOT_TMP_DIR)
778         $(MAKE) fullaot-libs AOT_FLAGS="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" GSHAREDVT=$(GSHAREDVT)
779         cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll $(FULLAOT_TMP_DIR)/
780         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
781         ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) $(FULLAOT_TMP_DIR)/
782         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
783
784 # This can run in parallel
785 fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
786
787 fullaot-tmp/%.dylib: $(CLASS)/%
788         cp $(CLASS)/$* fullaot-tmp/
789         mkdir fullaot-tmp/$*-tmp
790         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/$*
791         rm -rf fullaot-tmp/$*-tmp
792
793 llvmfullaotcheck:
794         $(MAKE) fullaotcheck LLVM=1
795
796 llvmonly_regtests = $(fullaot_regtests) gshared.exe
797
798 llvmonlycheck: mono $(llvmonly_regtests)
799         rm -rf fullaot-tmp
800         mkdir fullaot-tmp
801         $(MAKE) fullaot-libs AOT_FLAGS="llvmonly,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)"
802         cp $(llvmonly_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
803         MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper  --aot=llvmonly fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
804         ln -s $$PWD/mono fullaot-tmp/
805         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
806
807 gccheck: gc-test.exe
808         MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe     
809
810 bench: mono test.exe
811         time env $(MINI_RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
812
813 mbench: test.exe
814         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
815
816 stat1: mono bench.exe
817         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression bench.exe
818         perl viewstat.pl stats.pl
819
820 stat2: mono basic.exe
821         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression basic.exe
822         perl viewstat.pl -e stats.pl
823
824 stat3: mono bench.exe
825         $(MINI_RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
826         perl viewstat.pl stats.pl
827
828 docu: mini.sgm
829         docbook2txt mini.sgm
830
831 # We need these because automake can't process normal make conditionals
832 check_local_targets = $(if $(EMIT_NUNIT), rcheck-nunit, rcheck)
833
834 check-local: $(check_local_targets)
835
836 clean-local:
837         rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResult-op_il_seq_point.xml*
838
839 pkgconfigdir = $(libdir)/pkgconfig
840
841 BUILT_SOURCES = version.h $(arch_built)
842
843 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
844 EXTRA_DIST = TestDriver.cs \
845         TestHelpers.cs \
846         genmdesc.pl                             \
847         $(test_sources)                         \
848         $(x86_sources) cpu-x86.md               \
849         $(amd64_sources) cpu-amd64.md           \
850         $(ppc_sources) cpu-ppc.md cpu-ppc64.md  \
851         $(arm_sources) cpu-arm.md               \
852         $(arm64_sources) cpu-arm64.md           \
853         $(mips_sources) cpu-mips.md             \
854         $(sparc_sources) cpu-sparc.md           \
855         $(s390x_sources) cpu-s390x.md           \
856         $(ia64_sources) cpu-ia64.md             \
857         $(windows_sources)                      \
858         $(darwin_sources) Info.plist            \
859         $(posix_sources)                                        \
860         test_op_il_seq_point.sh                 \
861         test_op_il_seq_point_headerfooter.sh    \
862         Makefile.am.in
863
864 version.h: Makefile
865         if test -d $(top_srcdir)/.git; then \
866                 (cd $(top_srcdir); \
867                         LANG=C; export LANG; \
868                         if test -z "$$ghprbPullId"; then \
869                                 branch=`git branch | grep '^\*' | sed 's/(detached from .*/explicit/' | cut -d ' ' -f 2`; \
870                         else \
871                                 branch="pull-request-$$ghprbPullId"; \
872                         fi; \
873                         version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
874                         echo "#define FULL_VERSION \"$$branch/$$version\""; \
875                 ); \
876         else \
877                 echo "#define FULL_VERSION \"tarball\""; \
878         fi > version.h
879
880 # Utility target for patching libtool to speed up linking
881 patch-libtool:
882         sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
883         chmod a+x ../../libtool
884
885 # Utility target for patching libtool to get rid of the 'ranlib: file <file> has no symbols" warnings
886 patch-osx-libtool:
887         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
888         chmod a+x ../../libtool
889
890 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
891 patch-automake:
892         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
893
894 tags:
895         etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
896
897 if HAS_EXTENSION_MODULE
898 else
899 Makefile.am: Makefile.am.in
900         cp $< $@
901 endif