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