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