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