[sgen] Scan pinned objects in nursery as part of concurrent mark
[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 = $(MINI_RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162
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
309 amd64_sources = \
310         mini-amd64.c            \
311         mini-amd64.h            \
312         exceptions-amd64.c      \
313         tramp-amd64.c
314
315 ppc_sources = \
316         mini-ppc.c              \
317         mini-ppc.h              \
318         exceptions-ppc.c        \
319         tramp-ppc.c
320
321 arm_sources = \
322         mini-arm.c              \
323         mini-arm-tls.S          \
324         mini-arm.h              \
325         mini-arm-tls.h          \
326         exceptions-arm.c        \
327         tramp-arm.c
328
329 arm64_sources = \
330         mini-arm64.c            \
331         mini-arm64.h            \
332         exceptions-arm64.c      \
333         tramp-arm64.c
334
335 mips_sources = \
336         mini-mips.c             \
337         mini-mips.h             \
338         exceptions-mips.c       \
339         tramp-mips.c
340
341 sparc_sources = \
342         mini-sparc.c            \
343         mini-sparc.h            \
344         exceptions-sparc.c      \
345         tramp-sparc.c
346
347 s390x_sources = \
348         mini-s390x.c            \
349         mini-s390x.h            \
350         support-s390x.h         \
351         exceptions-s390x.c      \
352         tramp-s390x.c
353
354 ia64_sources = \
355         mini-ia64.c             \
356         mini-ia64.h             \
357         exceptions-ia64.c       \
358         tramp-ia64.c
359
360 darwin_sources = \
361         mini-darwin.c
362
363 windows_sources = \
364         mini-windows.c
365
366 posix_sources = \
367         mini-posix.c
368
369 if ENABLE_LLVM
370 if LOADED_LLVM
371 llvm_sources = \
372         mini-llvm-loaded.c
373 else
374 llvm_sources = \
375         mini-llvm.c             \
376         mini-llvm-loaded.c \
377         mini-llvm-cpp.cpp \
378         llvm-jit.cpp
379 endif
380 endif
381
382 if ENABLE_LLVM
383 llvm_runtime_sources = \
384         llvm-runtime.cpp
385 else
386 if ENABLE_LLVM_RUNTIME
387 llvm_runtime_sources = \
388         llvm-runtime.cpp
389 endif
390 endif
391
392 common_sources = \
393         mini.c                  \
394         mini-runtime.c  \
395         seq-points.c    \
396         seq-points.h    \
397         ir-emit.h               \
398         method-to-ir.c          \
399         decompose.c             \
400         mini.h                  \
401         version.h               \
402         optflags-def.h          \
403         jit-icalls.h            \
404         jit-icalls.c            \
405         trace.c                 \
406         trace.h                 \
407         patch-info.h            \
408         mini-ops.h              \
409         mini-arch.h             \
410         dominators.c            \
411         cfold.c                 \
412         regalloc.h              \
413         helpers.c               \
414         liveness.c              \
415         ssa.c                   \
416         abcremoval.c            \
417         abcremoval.h            \
418         local-propagation.c     \
419         driver.c                \
420         debug-mini.c            \
421         linear-scan.c           \
422         aot-compiler.h          \
423         aot-compiler.c          \
424         aot-runtime.c           \
425         graph.c                 \
426         mini-codegen.c          \
427         mini-exceptions.c       \
428         mini-trampolines.c      \
429         branch-opts.c           \
430         mini-generic-sharing.c  \
431         simd-methods.h          \
432         tasklets.c              \
433         tasklets.h              \
434         simd-intrinsics.c       \
435         mini-native-types.c \
436         mini-unwind.h           \
437         unwind.c                \
438         image-writer.h          \
439         image-writer.c          \
440         dwarfwriter.h           \
441         dwarfwriter.c           \
442         mini-gc.h               \
443         mini-gc.c               \
444         debugger-agent.h        \
445         debugger-agent.c        \
446         xdebug.c                        \
447         mini-llvm.h                     \
448         mini-llvm-cpp.h \
449         llvm-jit.h              \
450         alias-analysis.c        \
451         mini-cross-helpers.c \
452         arch-stubs.c            \
453         llvm-runtime.h
454
455 test_sources =                  \
456         basic-calls.cs          \
457         basic-long.cs           \
458         bench.cs                \
459         objects.cs              \
460         arrays.cs               \
461         basic-float.cs          \
462         basic-math.cs           \
463         basic.cs                \
464         exceptions.cs           \
465         devirtualization.cs     \
466         iltests.il              \
467         test.cs                 \
468         generics.cs             \
469         generics-variant-types.il\
470         basic-simd.cs \
471         aot-tests.cs \
472         gc-test.cs \
473         gshared.cs
474
475 regtests=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe
476 if NACL_CODEGEN
477 test_sources += nacl.cs
478 regtests += nacl.exe
479 endif
480
481 if X86
482 arch_sources = $(x86_sources)
483 arch_built=cpu-x86.h
484 arch_define=__i386__
485 endif
486
487 if AMD64
488 arch_sources = $(amd64_sources)
489 arch_built=cpu-amd64.h
490 arch_define=__x86_64__
491 ARCH_FULLAOT_EXCLUDE=--exclude DYNCALL
492 endif
493
494 if POWERPC
495 arch_sources = $(ppc_sources)
496 arch_built=cpu-ppc.h
497 arch_define=__ppc__
498 endif
499
500 if POWERPC64
501 arch_sources = $(ppc_sources)
502 arch_built=cpu-ppc64.h
503 arch_define=__ppc64__
504 endif
505
506 if MIPS
507 arch_sources = $(mips_sources)
508 arch_built=cpu-mips.h
509 arch_define=__mips__
510 endif
511
512 if ARM
513 # pick up arm_dpimacros.h
514 ARCH_CFLAGS = -I../arch/arm
515 arch_sources = $(arm_sources)
516 arch_built=cpu-arm.h
517 arch_define=__arm__
518 endif
519
520 if ARM64
521 arch_sources = $(arm64_sources)
522 arch_built=cpu-arm64.h
523 arch_define=__aarch64__
524 endif
525
526 if SPARC
527 arch_sources = $(sparc_sources)
528 arch_built=cpu-sparc.h
529 arch_define=__sparc__
530 endif
531
532 if SPARC64
533 arch_sources = $(sparc_sources)
534 arch_built=cpu-sparc.h
535 arch_define=__sparc__
536 endif
537
538 if S390X
539 arch_sources = $(s390x_sources)
540 arch_built=cpu-s390x.h
541 arch_define=__s390__
542 endif
543
544 if IA64
545 arch_sources = $(ia64_sources)
546 arch_built = cpu-ia64.h
547 arch_define=__ia64__
548 endif
549
550 if HOST_WIN32
551 os_sources = $(windows_sources)
552 monobin_platform_ldflags=
553 endif
554
555 if PLATFORM_SIGPOSIX
556 os_sources = $(posix_sources)
557 monobin_platform_ldflags=
558 endif
559
560 if PLATFORM_DARWIN
561 os_sources = $(darwin_sources) $(posix_sources)
562 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
563 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
564 endif
565
566 libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(arch_sources) $(os_sources)
567 libmini_la_CFLAGS = $(mono_CFLAGS)
568
569 libmonoboehm_2_0_la_SOURCES =
570 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
571 libmonoboehm_2_0_la_LIBADD = libmini.la $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
572 libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
573
574 libmonosgen_2_0_la_SOURCES =
575 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
576 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
577 libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
578
579 #
580 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
581 # compile time dependencies on boehm/sgen.
582 #
583 libmini_static_la_SOURCES = $(libmini_la_SOURCES)
584 libmini_static_la_CFLAGS = $(AM_CFLAGS)
585 libmini_static_la_LDFLAGS = -static
586 libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT)
587
588 libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit
589
590 libmonoinclude_HEADERS = jit.h
591
592 CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
593
594 basic-simd.exe: basic-simd.cs TestDriver.dll
595         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
596
597 nacl.exe: nacl.cs TestDriver.dll
598         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
599
600 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
601         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll
602
603 %.exe: %.cs TestDriver.dll
604         $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll
605
606 %.exe: %.il
607         $(ILASM) -output=$@ $<
608
609 TestDriver.dll: $(srcdir)/TestDriver.cs
610         $(MCS) -out:$@ -target:library $<
611
612 generics-variant-types.dll: generics-variant-types.il
613         $(ILASM) -dll -output=$@ $<
614
615 if NACL_CODEGEN
616 GENMDESC_OPTS=--nacl
617 else !NACL_CODEGEN
618 GENMDESC_OPTS=
619 endif !NACL_CODEGEN
620
621 # we don't always use the perl impl because it's an additional
622 # build dependency for the poor windows users
623 # $(arch_define) is the preprocessor symbol that enables all the opcodes
624 # for the specific platform in mini-ops.h
625 if CROSS_COMPILING
626 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
627 else !CROSS_COMPILING
628 if NACL_CODEGEN
629 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
630 else
631 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
632 endif
633 endif !CROSS_COMPILING
634
635 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
636         $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
637
638 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
639         $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
640
641 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
642         $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
643
644 cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
645         $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
646
647 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
648         $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
649
650 cpu-arm64.h: cpu-arm64.md genmdesc$(EXEEXT)
651         $(GENMDESC_PRG) cpu-arm64.h arm64_cpu_desc $(srcdir)/cpu-arm64.md
652
653 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
654         $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
655
656 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
657         $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
658
659 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
660         $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
661
662 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
663         $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
664
665 testi: mono test.exe
666         $(MINI_RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
667
668 # ensure the tests are actually correct
669 checktests: $(regtests)
670         for i in $(regtests); do $(MINI_RUNTIME) $$i; done
671
672 rcheck: mono $(regtests)
673 if NACL_CODEGEN
674         for i in $(regtests); do echo "running test $$i"; $(MINI_RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
675 else
676         -($(MINI_RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | $(srcdir)/emitnunit.pl
677         exit $$(cat regressionexitcode.out)
678 endif
679
680 rcheck2: mono $(regtests)
681         $(MINI_RUNTIME) --regression $(regtests)
682
683 if ARM
684 check-seq-points:
685 else
686 check-seq-points: mono $(regtests)
687         rm -f TestResult-op_il_seq_point.xml
688         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
689         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
690         $(srcdir)/test_op_il_seq_point_headerfooter.sh
691 endif
692
693 gctest: mono gc-test.exe
694         MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(MINI_RUNTIME) --regression gc-test.exe
695
696 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
697 GSHAREDVT_RUNTIME_OPTS=$(if $(GSHAREDVT),-O=gsharedvt,)
698
699 aotcheck: mono $(regtests)
700         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
701         $(MINI_RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
702         for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
703         rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
704
705 llvmaotcheck:
706         $(MAKE) aotcheck LLVM=1
707
708 gsharedvtcheck:
709         $(MAKE) fullaotcheck GSHAREDVT=1
710
711 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
712
713 FULLAOT_LIBS = \
714         mscorlib.dll \
715         System.Core.dll \
716         System.dll \
717         Mono.Posix.dll \
718         System.Configuration.dll \
719         System.Security.dll \
720         System.Xml.dll \
721         Mono.Security.dll \
722         Mono.Simd.dll
723
724 # This currently only works on amd64/arm
725 fullaotcheck: $(mono) $(fullaot_regtests)
726         rm -rf fullaot-tmp
727         mkdir fullaot-tmp
728         $(MAKE) fullaot-libs AOT_FLAGS="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)" GSHAREDVT=$(GSHAREDVT)
729         cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
730         MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)" fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
731         ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) fullaot-tmp/
732         for i in $(fullaot_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
733
734 # This can run in parallel
735 fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
736
737 fullaot-tmp/%.dylib: $(CLASS)/%
738         cp $(CLASS)/$* fullaot-tmp/
739         mkdir fullaot-tmp/$*-tmp
740         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/$*
741         rm -rf fullaot-tmp/$*-tmp
742
743 llvmfullaotcheck:
744         $(MAKE) fullaotcheck LLVM=1
745
746 llvmonly_regtests = $(fullaot_regtests) gshared.exe
747
748 llvmonlycheck: mono $(llvmonly_regtests)
749         rm -rf fullaot-tmp
750         mkdir fullaot-tmp
751         $(MAKE) fullaot-libs AOT_FLAGS="llvmonly,$(MONO_FULLAOT_ADDITIONAL_ARGS)"
752         cp $(llvmonly_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
753         MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper  --aot=llvmonly fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
754         ln -s $$PWD/mono fullaot-tmp/
755         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
756
757 gccheck: gc-test.exe
758         MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe     
759
760 bench: mono test.exe
761         time env $(MINI_RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
762
763 mbench: test.exe
764         time $(monodir)/mono/jit/mono --ncompile $(count) --compile Test:$(mtest) test.exe
765
766 stat1: mono bench.exe
767         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression bench.exe
768         perl viewstat.pl stats.pl
769
770 stat2: mono basic.exe
771         $(MINI_RUNTIME) --verbose --statfile stats.pl --regression basic.exe
772         perl viewstat.pl -e stats.pl
773
774 stat3: mono bench.exe
775         $(MINI_RUNTIME) --statfile stats.pl --ncompile 1000 --compile Tests:test_0_many_nested_loops bench.exe 
776         perl viewstat.pl stats.pl
777
778 docu: mini.sgm
779         docbook2txt mini.sgm
780
781 check-local: rcheck check-seq-points
782
783 clean-local:
784         rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResult-op_il_seq_point.xml*
785
786 pkgconfigdir = $(libdir)/pkgconfig
787
788 BUILT_SOURCES = version.h $(arch_built)
789
790 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
791 EXTRA_DIST = TestDriver.cs \
792         genmdesc.pl                             \
793         emitnunit.pl                    \
794         $(test_sources)                         \
795         $(x86_sources) cpu-x86.md               \
796         $(amd64_sources) cpu-amd64.md           \
797         $(ppc_sources) cpu-ppc.md cpu-ppc64.md  \
798         $(arm_sources) cpu-arm.md               \
799         $(arm64_sources) cpu-arm64.md           \
800         $(mips_sources) cpu-mips.md             \
801         $(sparc_sources) cpu-sparc.md           \
802         $(s390x_sources) cpu-s390x.md           \
803         $(ia64_sources) cpu-ia64.md             \
804         $(windows_sources)                      \
805         $(darwin_sources) Info.plist            \
806         $(posix_sources)                                        \
807         test_op_il_seq_point.sh                 \
808         test_op_il_seq_point_headerfooter.sh    \
809         Makefile.am.in
810
811 version.h: Makefile
812         if test -d $(top_srcdir)/.git; then \
813                 (cd $(top_srcdir); \
814                         LANG=C; export LANG; \
815                         branch=`git branch | grep '^\*' | sed 's/(detached from .*/explicit/' | cut -d ' ' -f 2`; \
816                         version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
817                         echo "#define FULL_VERSION \"$$branch/$$version\""; \
818                 ); \
819         else \
820                 echo "#define FULL_VERSION \"tarball\""; \
821         fi > version.h
822
823 # Utility target for patching libtool to speed up linking
824 patch-libtool:
825         sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
826         chmod a+x ../../libtool
827
828 # Utility target for patching libtool to get rid of the 'ranlib: file <file> has no symbols" warnings
829 patch-osx-libtool:
830         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
831         chmod a+x ../../libtool
832
833 # Utility target to patch automake to generate the same format silent output as the old mono silent build did
834 patch-automake:
835         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
836
837 tags:
838         etags -o TAGS `find .. -name "*.h" -o -name "*.c"`
839
840 if HAS_EXTENSION_MODULE
841 else
842 Makefile.am: Makefile.am.in
843         cp $< $@
844 endif