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