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