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