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