188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Copyright (C) 2007 The Android Open Source Project
388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Licensed under the Apache License, Version 2.0 (the "License");
588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# you may not use this file except in compliance with the License.
688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# You may obtain a copy of the License at
788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#      http://www.apache.org/licenses/LICENSE-2.0
988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
1088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Unless required by applicable law or agreed to in writing, software
1188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# distributed under the License is distributed on an "AS IS" BASIS,
1288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# See the License for the specific language governing permissions and
1488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# limitations under the License.
1588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
1688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
1788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project_device_var_list := \
1888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    DEVICE_NAME \
1988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    DEVICE_BOARD \
2088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    DEVICE_REGION
2188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
2288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine dump-device
2388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(info ==== $(1) ====)\
2488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(foreach v,$(_device_var_list),\
2588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(info DEVICES.$(1).$(v) := $(DEVICES.$(1).$(v))))\
2688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(info --------)
2788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
2888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
2988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine dump-devices
3088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(foreach p,$(DEVICES),$(call dump-device,$(p)))
3188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
3288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
3388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
3488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(1): device to inherit
3588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
3688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine inherit-device
3788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  $(foreach v,$(_device_var_list), \
3888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project      $(eval $(v) := $($(v)) $(INHERIT_TAG)$(strip $(1))))
3988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
4088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
4188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
4288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(1): device makefile list
4388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
4488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#TODO: check to make sure that devices have all the necessary vars defined
4588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine import-devices
4688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(call import-nodes,DEVICES,$(1),$(_device_var_list))
4788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
4888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
4988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
5088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
5188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(1): short device name like "sooner"
5288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
5388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine _resolve-short-device-name
5488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  $(eval dn := $(strip $(1)))
5588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  $(eval d := \
5688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project      $(foreach d,$(DEVICES), \
5788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project          $(if $(filter $(dn),$(DEVICES.$(d).DEVICE_NAME)), \
5888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project            $(d) \
5988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project       )) \
6088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project   )
6188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  $(eval d := $(sort $(d)))
6288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  $(if $(filter 1,$(words $(d))), \
6388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(d), \
6488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(if $(filter 0,$(words $(d))), \
6588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project      $(error No matches for device "$(dn)"), \
6688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project      $(error Device "$(dn)" ambiguous: matches $(d)) \
6788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    ) \
6888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  )
6988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
7088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
7188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
7288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(1): short device name like "sooner"
7388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
7488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine resolve-short-device-name
7588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(strip $(call _resolve-short-device-name,$(1)))
7688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
77