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