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