LIBRARY = System.Core.dll
+ifeq ($(PROFILE),build)
+CSC_RUNTIME_FLAGS=--profile=aot:output=$(topdir)/class/lib/$(PROFILE)/csc.$(LIBRARY).aotprofile
+endif
+
REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE
LIB_REFS = System
LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) -d:INSIDE_SYSCORE -d:LIBC -unsafe -nowarn:436
ifndef SKIP_AOT
-profile_file=$(wildcard $(topdir)/class/lib/build/csc.aotprofile)
+profile_file:=$(wildcard $(topdir)/class/lib/build/csc.*.aotprofile)
ifneq ($(profile_file),)
-profile_arg=,profile=$(profile_file)
+comma:=,
+space:=
+space+=
+profile_arg:=$(subst $(space)$(comma),$(comma),$(foreach pf,$(profile_file),$(comma)profile=$(strip $(pf))))
endif
ifdef PLATFORM_AOT_SUFFIX
$(mscorlib_aot_image): $(mscorlib_dll) $(runtime_dep)
$(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)
-# Disabled as it hits AOT too big limit
$(csc_MC_image): $(csc_MC_dll) $(runtime_dep)
$(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)
-# Disabled as it hits AOT too big limit
$(csc_MCS_image): $(csc_MCS_dll) $(runtime_dep)
$(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)
endif
ifeq ($(PROFILE),build)
-CSC_RUNTIME_FLAGS=--profile=aot:output=$(topdir)/class/lib/build/csc.aotprofile
+CSC_RUNTIME_FLAGS=--profile=aot:output=$(topdir)/class/lib/$(PROFILE)/csc.$(LIBRARY).aotprofile
endif
RESOURCE_STRINGS = ../referencesource/mscorlib/mscorlib.txt