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