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