[build] Roslyn switch
[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
14 # mcs.exe is only in the build profile, but the aot image should be compiled against the current
15 # profile
16 mcs_exe = $(the_libdir)/mcs.exe
17 mcs_aot_image = $(the_libdir)/mcs.exe$(PLATFORM_AOT_SUFFIX)
18 csc_exe = $(CSC_LOCATION)
19 csc_aot_image = $(csc_exe)$(PLATFORM_AOT_SUFFIX)
20 csc_MCS_dll = $(CSC_DIR)/Microsoft.CodeAnalysis.CSharp.dll
21 csc_MCS_image = $(csc_MCS_dll)$(PLATFORM_AOT_SUFFIX)
22 csc_MC_dll = $(CSC_DIR)/Microsoft.CodeAnalysis.dll
23 csc_MC_image = $(csc_MC_dll)$(PLATFORM_AOT_SUFFIX)
24 csc_SRM_dll = $(CSC_DIR)/System.Reflection.Metadata.dll
25 csc_SRM_image = $(csc_SRM_dll)$(PLATFORM_AOT_SUFFIX)
26 csc_SCI_dll = $(CSC_DIR)/System.Collections.Immutable.dll
27 csc_SCI_image = $(csc_SCI_dll)$(PLATFORM_AOT_SUFFIX)
28
29 mscorlib_dll = $(the_libdir)/mscorlib.dll
30 mscorlib_aot_image = $(mscorlib_dll)$(PLATFORM_AOT_SUFFIX)
31
32 # The $(dir $(RUNTIME)) is necessary to get path to the mono binary in case when we cross-compile
33 # or just compile from a different directory than the top source dir
34 runtime_dep = $(dir $(RUNTIME))/../mono/mini/mono
35
36 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
37 LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
38
39 ifndef SKIP_AOT
40
41 ifdef PLATFORM_AOT_SUFFIX
42 $(mcs_aot_image): $(mcs_exe) $(mscorlib_dll) $(runtime_dep)
43         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version,outfile=$(mcs_aot_image) --debug $(mcs_exe) || cat $(PROFILE)_aot.log || (cat $(PROFILE)_aot.log; exit 1)
44
45 $(csc_aot_image): $(csc_exe) $(mscorlib_dll) $(runtime_dep)
46         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version,outfile=$(csc_aot_image) --debug $(csc_exe) || cat $(PROFILE)_aot.log || (cat $(PROFILE)_aot.log; exit 1)
47
48 $(mscorlib_aot_image): $(mscorlib_dll) $(runtime_dep)
49         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version --debug $(mscorlib_dll) || (cat $(PROFILE)_aot.log; exit 1)
50
51 # Disabled as it hits AOT too big limit
52 $(csc_MC_image): $(csc_MC_dll) $(runtime_dep)
53         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version,outfile=$(csc_MC_image) --debug $(csc_MC_dll) || (cat $(PROFILE)_aot.log; exit 1)
54
55 # Disabled as it hits AOT too big limit
56 $(csc_MCS_image): $(csc_MCS_dll) $(runtime_dep)
57         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version,outfile=$(csc_MCS_image) --debug $(csc_MCS_dll) || (cat $(PROFILE)_aot.log; exit 1)
58
59 $(csc_SRM_image): $(csc_SRM_dll) $(runtime_dep)
60         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version,outfile=$(csc_SRM_image) --debug $(csc_SRM_dll) || (cat $(PROFILE)_aot.log; exit 1)
61
62 $(csc_SCI_image): $(csc_SCI_dll) $(runtime_dep)
63         $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version,outfile=$(csc_SCI_image) --debug $(csc_SCI_dll) || (cat $(PROFILE)_aot.log; exit 1)
64
65 ifdef ENABLE_AOT
66
67 clean-local:
68         -rm -f $(mscorlib_aot_image) $(mcs_aot_image) $(csc_aot_image) $(csc_SRM_image) $(csc_SCI_image) $(PROFILE)_aot.log
69
70 # AOT build profile mcs to speed up build
71 ifeq ($(PROFILE),build)
72 all-local: $(mscorlib_aot_image) $(csc_aot_image) $(csc_SRM_image) $(csc_SCI_image)
73 install-local:
74 endif
75
76 ifeq ($(PROFILE), $(DEFAULT_PROFILE))
77 all-local: $(mscorlib_aot_image) $(mcs_aot_image)
78 install-local:
79         $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
80         $(INSTALL_LIB) $(mscorlib_aot_image) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
81         $(INSTALL_LIB) $(mcs_aot_image) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
82 endif
83
84 endif
85
86 endif
87
88 endif
89
90 dist-local: dist-default