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.
7 thisdir = class/aot-compiler
9 include ../../build/rules.make
11 the_libdir = $(topdir)/class/lib/$(PROFILE)/
13 # mcs.exe is only in the build profile, but the aot image should be compiled against the current
15 mcs_exe = $(topdir)/class/lib/build/mcs.exe
16 mcs_aot_image = $(the_libdir)/mcs.exe$(PLATFORM_AOT_SUFFIX)
18 mscorlib_dll = $(the_libdir)/mscorlib.dll
19 mscorlib_aot_image = $(mscorlib_dll)$(PLATFORM_AOT_SUFFIX)
21 # The $(dir $(RUNTIME)) is necessary to get path to the mono binary in case when we cross-compile
22 # or just compile from a different directory than the top source dir
23 runtime_dep = $(dir $(RUNTIME))/../mono/mini/mono
25 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
26 LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
30 ifdef PLATFORM_AOT_SUFFIX
31 $(mcs_aot_image): $(mcs_exe) $(mscorlib_dll) $(runtime_dep)
32 $(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)
34 $(mscorlib_aot_image): $(mscorlib_dll) $(runtime_dep)
35 $(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)
40 -rm -f $(mscorlib_aot_image) $(mcs_aot_image) $(PROFILE)_aot.log
42 # AOT build profile mcs to speed up build
43 ifeq ($(PROFILE),build)
44 all-local: $(mscorlib_aot_image) $(mcs_aot_image)
48 ifeq ($(PROFILE), $(DEFAULT_PROFILE))
49 all-local: $(mscorlib_aot_image) $(mcs_aot_image)
51 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
52 $(INSTALL_LIB) $(mscorlib_aot_image) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
53 $(INSTALL_LIB) $(mcs_aot_image) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
62 dist-local: dist-default