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