[xbuild] Handle a repeat build of a target, when building through ..
[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
13 # mcs.exe is only in the build profile, but the aot image should be compiled against the current
14 # profile
15 mcs_exe = $(topdir)/class/lib/build/mcs.exe
16 mcs_aot_image = $(the_libdir)/mcs.exe$(PLATFORM_AOT_SUFFIX)
17
18 mscorlib_dll = $(the_libdir)/mscorlib.dll
19 mscorlib_aot_image = $(mscorlib_dll)$(PLATFORM_AOT_SUFFIX)
20
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
24
25 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
26 LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
27
28 ifndef SKIP_AOT
29
30 ifdef PLATFORM_AOT_SUFFIX
31 Q_AOT=$(if $(V),,@echo "AOT     [$(PROFILE)] $(notdir $(@))";)
32 $(mcs_aot_image): $(mcs_exe) $(mscorlib_dll) $(runtime_dep)
33         $(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
35 $(mscorlib_aot_image): $(mscorlib_dll) $(runtime_dep)
36         $(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)
37
38 ifdef ENABLE_AOT
39
40 clean-local:
41         -rm -f $(mscorlib_aot_image) $(mcs_aot_image) $(PROFILE)_aot.log
42
43 # AOT build profile mcs to speed up build
44 ifeq ($(PROFILE),build)
45 all-local: $(mscorlib_aot_image) $(mcs_aot_image)
46 install-local:
47 endif
48
49 ifeq ($(PROFILE), $(DEFAULT_PROFILE))
50 all-local: $(mscorlib_aot_image) $(mcs_aot_image)
51 install-local:
52         $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
53         $(INSTALL_LIB) $(mscorlib_aot_image) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
54         $(INSTALL_LIB) $(mcs_aot_image) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
55 endif
56
57 endif
58
59 endif
60
61 endif
62
63 dist-local: dist-default