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