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