1 # 2 # Copyright (C) 2007 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 17 _device_var_list := \ 18 DEVICE_NAME \ 19 DEVICE_BOARD \ 20 DEVICE_REGION 21 22 define dump-device 23 $(info ==== $(1) ====)\ 24 $(foreach v,$(_device_var_list),\ 25 $(info DEVICES.$(1).$(v) := $(DEVICES.$(1).$(v))))\ 26 $(info --------) 27 endef 28 29 define dump-devices 30 $(foreach p,$(DEVICES),$(call dump-device,$(p))) 31 endef 32 33 # 34 # $(1): device to inherit 35 # 36 define inherit-device 37 $(foreach v,$(_device_var_list), \ 38 $(eval $(v) := $($(v)) $(INHERIT_TAG)$(strip $(1)))) 39 endef 40 41 # 42 # $(1): device makefile list 43 # 44 #TODO: check to make sure that devices have all the necessary vars defined 45 define import-devices 46 $(call import-nodes,DEVICES,$(1),$(_device_var_list)) 47 endef 48 49 50 # 51 # $(1): short device name like "sooner" 52 # 53 define _resolve-short-device-name 54 $(eval dn := $(strip $(1))) 55 $(eval d := \ 56 $(foreach d,$(DEVICES), \ 57 $(if $(filter $(dn),$(DEVICES.$(d).DEVICE_NAME)), \ 58 $(d) \ 59 )) \ 60 ) 61 $(eval d := $(sort $(d))) 62 $(if $(filter 1,$(words $(d))), \ 63 $(d), \ 64 $(if $(filter 0,$(words $(d))), \ 65 $(error No matches for device "$(dn)"), \ 66 $(error Device "$(dn)" ambiguous: matches $(d)) \ 67 ) \ 68 ) 69 endef 70 71 # 72 # $(1): short device name like "sooner" 73 # 74 define resolve-short-device-name 75 $(strip $(call _resolve-short-device-name,$(1))) 76 endef 77