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