Merge pull request #4219 from marek-safar/corert-bump
[mono.git] / mcs / class / aot-compiler / Makefile
1 #
2 # This directory is used to AOT the C# compiler to speed up the rest of the class libs build
3 # It should be run after the assemblies the compiler depends on have been compiled, since
4 # the AOT image has a dependency on the exact assembly versions used to produce it.
5 #
6
7 thisdir = class/aot-compiler
8
9 include ../../build/rules.make
10
11 the_libdir = $(topdir)/class/lib/$(PROFILE)/
12 CSC_DIR = $(dir $(CSC_LOCATION))
13 # The directory where the AOT images are stored
14 images_dir = $(the_libdir)
15
16 # mcs.exe is only in the build profile, but the aot image should be compiled against the current
17 # profile
18 mcs_exe = $(the_libdir)/mcs.exe
19 mcs_aot_image = $(the_libdir)/mcs.exe$(PLATFORM_AOT_SUFFIX)
20 csc_exe = $(CSC_LOCATION)
21 csc_aot_image = $(images_dir)/csc.exe$(PLATFORM_AOT_SUFFIX)
22 csc_MCS_dll = $(CSC_DIR)/Microsoft.CodeAnalysis.CSharp.dll
23 csc_MCS_image = $(images_dir)/Microsoft.CodeAnalysis.CSharp.dll$(PLATFORM_AOT_SUFFIX)
24 csc_MC_dll = $(CSC_DIR)/Microsoft.CodeAnalysis.dll
25 csc_MC_image = $(images_dir)/Microsoft.CodeAnalysis.dll$(PLATFORM_AOT_SUFFIX)
26 csc_SRM_dll = $(CSC_DIR)/System.Reflection.Metadata.dll
27 csc_SRM_image = $(images_dir)/System.Reflection.Metadata.dll$(PLATFORM_AOT_SUFFIX)
28 csc_SCI_dll = $(CSC_DIR)/System.Collections.Immutable.dll
29 csc_SCI_image = $(images_dir)/System.Collections.Immutable.dll$(PLATFORM_AOT_SUFFIX)
30
31 mscorlib_dll = $(the_libdir)/mscorlib.dll
32 mscorlib_aot_image = $(mscorlib_dll)$(PLATFORM_AOT_SUFFIX)
33
34 # The $(dir $(RUNTIME)) is necessary to get path to the mono binary in case when we cross-compile
35 # or just compile from a different directory than the top source dir
36 runtime_dep = $(dir $(RUNTIME))/../mono/mini/mono
37
38 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
39 LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
40
41 ifndef SKIP_AOT
42
43 profile_file=$(wildcard $(topdir)/class/lib/build/csc.aotprofile)
44 ifneq ($(profile_file),)
45 profile_arg=,profile=$(profile_file)
46 endif
47
48 ifdef PLATFORM_AOT_SUFFIX
49 $(mcs_aot_image): $(mcs_exe) $(mscorlib_dll) $(runtime_dep)
50         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version$(profile_arg),outfile=$(mcs_aot_image) --debug $(mcs_exe) || cat $(PROFILE)_aot.log || (cat $(PROFILE)_aot.log; exit 1)
51
52 $(csc_aot_image): $(csc_exe) $(mscorlib_dll) $(runtime_dep)
53         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version$(profile_arg),outfile=$(csc_aot_image) --debug $(csc_exe) || cat $(PROFILE)_aot.log || (cat $(PROFILE)_aot.log; exit 1)
54
55 $(mscorlib_aot_image): $(mscorlib_dll) $(runtime_dep)
56         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version$(profile_arg) --debug $(mscorlib_dll) || (cat $(PROFILE)_aot.log; exit 1)
57
58 # Disabled as it hits AOT too big limit
59 $(csc_MC_image): $(csc_MC_dll) $(runtime_dep)
60         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version$(profile_arg),outfile=$(csc_MC_image) --debug $(csc_MC_dll) || (cat $(PROFILE)_aot.log; exit 1)
61
62 # Disabled as it hits AOT too big limit
63 $(csc_MCS_image): $(csc_MCS_dll) $(runtime_dep)
64         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version$(profile_arg),outfile=$(csc_MCS_image) --debug $(csc_MCS_dll) || (cat $(PROFILE)_aot.log; exit 1)
65
66 $(csc_SRM_image): $(csc_SRM_dll) $(runtime_dep)
67         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version$(profile_arg),outfile=$(csc_SRM_image) --debug $(csc_SRM_dll) || (cat $(PROFILE)_aot.log; exit 1)
68
69 $(csc_SCI_image): $(csc_SCI_dll) $(runtime_dep)
70         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version$(profile_arg),outfile=$(csc_SCI_image) --debug $(csc_SCI_dll) || (cat $(PROFILE)_aot.log; exit 1)
71
72 ifdef ENABLE_AOT
73
74 CSC_IMAGES = $(csc_aot_image) $(csc_SRM_image) $(csc_SCI_image)
75
76 clean-local:
77         -rm -f $(mscorlib_aot_image) $(mcs_aot_image) $(CSC_IMAGES) $(PROFILE)_aot.log
78
79 # AOT build profile to speed up build
80 ifeq ($(PROFILE),build)
81
82 # $(mscorlib_aot_image) is disabled due to runtime bug #50434
83 IMAGES =
84
85 ifdef MCS_MODE
86 IMAGES += $(mcs_aot_image)
87
88 install-local:
89
90 else
91 IMAGES += $(CSC_IMAGES)
92
93 install-local:
94         $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
95         $(INSTALL_LIB) $(CSC_IMAGES) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
96
97 endif
98
99 all-local: $(IMAGES)
100
101 endif
102
103 ifeq ($(PROFILE), $(DEFAULT_PROFILE))
104
105 IMAGES = $(mscorlib_aot_image) $(mcs_aot_image)
106
107 ifdef MCS_MODE
108 IMAGES += $(CSC_IMAGES)
109 endif
110
111 all-local: $(IMAGES)
112 install-local:
113         $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
114         $(INSTALL_LIB) $(mscorlib_aot_image) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
115         $(INSTALL_LIB) $(mcs_aot_image) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
116 endif
117
118 endif
119
120 endif
121
122 endif
123
124 dist-local: dist-default