1*7c3d14c8STreehugger Robot# compiler-rt Configuration Support 2*7c3d14c8STreehugger Robot# 3*7c3d14c8STreehugger Robot# This should be included following 'lib_util.mk'. 4*7c3d14c8STreehugger Robot 5*7c3d14c8STreehugger Robot# The simple variables configurations can define. 6*7c3d14c8STreehugger RobotPlainConfigVariables := Configs Description 7*7c3d14c8STreehugger RobotPerConfigVariables := UniversalArchs Arch $(AvailableOptions) 8*7c3d14c8STreehugger RobotRequiredConfigVariables := Configs Description 9*7c3d14c8STreehugger Robot 10*7c3d14c8STreehugger Robot### 11*7c3d14c8STreehugger Robot# Load Platforms 12*7c3d14c8STreehugger Robot 13*7c3d14c8STreehugger Robot# Template: subdir_traverse_template subdir 14*7c3d14c8STreehugger Robotdefine load_platform_template 15*7c3d14c8STreehugger Robot$(call Set,PlatformName,$(basename $(notdir $(1)))) 16*7c3d14c8STreehugger Robotifneq ($(DEBUGMAKE),) 17*7c3d14c8STreehugger Robot $$(info MAKE: $(PlatformName): Loading platform) 18*7c3d14c8STreehugger Robotendif 19*7c3d14c8STreehugger Robot 20*7c3d14c8STreehugger Robot# Construct the variable key for this directory. 21*7c3d14c8STreehugger Robot$(call Set,PlatformKey,Platform.$(PlatformName)) 22*7c3d14c8STreehugger Robot$(call Append,PlatformKeys,$(PlatformKey)) 23*7c3d14c8STreehugger Robot$(call Set,$(PlatformKey).Name,$(PlatformName)) 24*7c3d14c8STreehugger Robot$(call Set,$(PlatformKey).Path,$(1)) 25*7c3d14c8STreehugger Robot 26*7c3d14c8STreehugger Robot# Reset platform specific variables to sentinel value. 27*7c3d14c8STreehugger Robot$$(foreach var,$(PlainConfigVariables) $(PerConfigVariables),\ 28*7c3d14c8STreehugger Robot $$(call Set,$$(var),UNDEFINED)) 29*7c3d14c8STreehugger Robot$$(foreach var,$(PerConfigVariables),\ 30*7c3d14c8STreehugger Robot $$(foreach config,$$(Configs),\ 31*7c3d14c8STreehugger Robot $$(call Set,$$(var).$$(config),UNDEFINED))) 32*7c3d14c8STreehugger Robot$$(foreach var,$(PerConfigVariables),\ 33*7c3d14c8STreehugger Robot $$(foreach arch,$(AvailableArchs),\ 34*7c3d14c8STreehugger Robot $$(call Set,$$(var).$$(arch),UNDEFINED))) 35*7c3d14c8STreehugger Robot 36*7c3d14c8STreehugger Robot# Get the platform variables. 37*7c3d14c8STreehugger Robotinclude make/options.mk 38*7c3d14c8STreehugger Robotinclude $(1) 39*7c3d14c8STreehugger Robot 40*7c3d14c8STreehugger Robot# Check for undefined required variables. 41*7c3d14c8STreehugger Robot$$(foreach var,$(RequiredConfigVariables),\ 42*7c3d14c8STreehugger Robot $$(if $$(call strneq,UNDEFINED,$$($$(var))),, \ 43*7c3d14c8STreehugger Robot $$(error $(Dir): variable '$$(var)' was not undefined))) 44*7c3d14c8STreehugger Robot 45*7c3d14c8STreehugger Robot# Check that exactly one of UniversalArchs or Arch was defined. 46*7c3d14c8STreehugger Robot$$(if $$(and $$(call strneq,UNDEFINED,$$(UniversalArchs)),\ 47*7c3d14c8STreehugger Robot $$(call strneq,UNDEFINED,$$(Arch))),\ 48*7c3d14c8STreehugger Robot $$(error '$(1)': cannot define both 'UniversalArchs' and 'Arch')) 49*7c3d14c8STreehugger Robot$$(if $$(or $$(call strneq,UNDEFINED,$$(UniversalArchs)),\ 50*7c3d14c8STreehugger Robot $$(call strneq,UNDEFINED,$$(Arch))),,\ 51*7c3d14c8STreehugger Robot $$(error '$(1)': must define one of 'UniversalArchs' and 'Arch')) 52*7c3d14c8STreehugger Robot 53*7c3d14c8STreehugger Robot# Collect all the platform variables for subsequent use. 54*7c3d14c8STreehugger Robot$$(foreach var,$(PlainConfigVariables) $(PerConfigVariables),\ 55*7c3d14c8STreehugger Robot $$(if $$(call strneq,UNDEFINED,$$($$(var))),\ 56*7c3d14c8STreehugger Robot $$(call CopyVariable,$$(var),$(PlatformKey).$$(var)))) 57*7c3d14c8STreehugger Robot$$(foreach var,$(PerConfigVariables),\ 58*7c3d14c8STreehugger Robot $$(foreach config,$$(Configs),\ 59*7c3d14c8STreehugger Robot $$(if $$(call strneq,UNDEFINED,$$($$(var).$$(config))),\ 60*7c3d14c8STreehugger Robot $$(call CopyVariable,$$(var).$$(config),$(PlatformKey).$$(var).$$(config))))\ 61*7c3d14c8STreehugger Robot $$(foreach arch,$(AvailableArchs),\ 62*7c3d14c8STreehugger Robot $$(if $$(call strneq,UNDEFINED,$$($$(var).$$(arch))),\ 63*7c3d14c8STreehugger Robot $$(call CopyVariable,$$(var).$$(arch),$(PlatformKey).$$(var).$$(arch))))\ 64*7c3d14c8STreehugger Robot $$(foreach config,$$(Configs),\ 65*7c3d14c8STreehugger Robot $$(foreach arch,$(AvailableArchs),\ 66*7c3d14c8STreehugger Robot $$(if $$(call strneq,UNDEFINED,$$($$(var).$$(config).$$(arch))),\ 67*7c3d14c8STreehugger Robot $$(call CopyVariable,$$(var).$$(config).$$(arch),\ 68*7c3d14c8STreehugger Robot $(PlatformKey).$$(var).$$(config).$$(arch)))))) 69*7c3d14c8STreehugger Robot 70*7c3d14c8STreehugger Robotifneq ($(DEBUGMAKE),) 71*7c3d14c8STreehugger Robot $$(info MAKE: $(PlatformName): Done loading platform) 72*7c3d14c8STreehugger Robotendif 73*7c3d14c8STreehugger Robotendef 74*7c3d14c8STreehugger Robot 75*7c3d14c8STreehugger Robot# Evaluate this now so we do not have to worry about order of evaluation. 76*7c3d14c8STreehugger RobotPlatformFiles := $(wildcard make/platform/*.mk) 77*7c3d14c8STreehugger Robotifneq ($(DEBUGMAKE),) 78*7c3d14c8STreehugger Robot $(info MAKE: Loading platforms: $(PlatformFiles)) 79*7c3d14c8STreehugger Robotendif 80*7c3d14c8STreehugger Robot 81*7c3d14c8STreehugger Robot$(foreach file,$(PlatformFiles),\ 82*7c3d14c8STreehugger Robot $(eval $(call load_platform_template,$(file)))) 83