blob: 20ff447caa81d377f43b95662f628eb583b5294b [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001#
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
22define dump-device
23$(info ==== $(1) ====)\
24$(foreach v,$(_device_var_list),\
25$(info DEVICES.$(1).$(v) := $(DEVICES.$(1).$(v))))\
26$(info --------)
27endef
28
29define dump-devices
30$(foreach p,$(DEVICES),$(call dump-device,$(p)))
31endef
32
33#
34# $(1): device to inherit
35#
36define inherit-device
37 $(foreach v,$(_device_var_list), \
38 $(eval $(v) := $($(v)) $(INHERIT_TAG)$(strip $(1))))
39endef
40
41#
42# $(1): device makefile list
43#
44#TODO: check to make sure that devices have all the necessary vars defined
45define import-devices
46$(call import-nodes,DEVICES,$(1),$(_device_var_list))
47endef
48
49
50#
51# $(1): short device name like "sooner"
52#
53define _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 )
69endef
70
71#
72# $(1): short device name like "sooner"
73#
74define resolve-short-device-name
75$(strip $(call _resolve-short-device-name,$(1)))
76endef