+ifneq ($(words $(KERNEL_CONFIG)), 1)
+$(error There were $(words $(KERNEL_CONFIG)) parameters passed to KERNEL_CONFIG = $(KERNEL_CONFG). \
+ Are you sure? To specify multiple configurations please use KERNEL_CONFIGS)
+endif
+
+ifndef MACHINE_CONFIG
+export MACHINE_CONFIG = DEFAULT
+endif
+
+
+#
+# Target configuration options. NOTE - target configurations will
+# override ARCH_CONFIGS and KERNEL_CONFIGS.
+#
+# Target configs come in groups of three parameters. The first is the
+# kernel configuration, the second is the architecture configuration,
+# and the third is the machine configuration. You may pass in as
+# many groups of configurations as you wish. Each item passed in is
+# seperated by whitespace.
+#
+# Example:
+# TARGET_CONFIGS="release ppc default debug i386 default release arm MX31ADS"
+# Parameters may be in upper or lower case (they are converted to upper).
+#
+# "default" parameter is a special case. It means use the default value for
+# that parameter. Here are the default values for each configuration:
+#
+# default kernel configuration = DEFAULT_KERNEL_CONFIG
+# default architecture configuration = system architecture where you are running make.
+# default machine configuration for ppc = none at this time.
+# default machine configuration for i386 = none at this time.
+# default machine configuration for arm = "S5L8900X".
+#
+ifndef TARGET_CONFIGS_UC
+ifdef TARGET_CONFIGS
+ export TARGET_CONFIGS_UC = $(strip $(shell printf "%s" "$(TARGET_CONFIGS)" | $(TR) a-z A-Z))
+ export MACHINE_CONFIG = $(word 3, $(TARGET_CONFIGS_UC))
+ export DEFAULT_KERNEL_CONFIG = $(word 1, $(TARGET_CONFIGS_UC))
+else
+ # generate TARGET_CONFIGS using KERNEL_CONFIGS and ARCH_CONFIGS and MACHINE_CONFIG (which defaults to "DEFAULT")
+ temp_list = $(foreach my_kern_config, $(KERNEL_CONFIGS), $(my_kern_config) arch_slot $(MACHINE_CONFIG))
+ export TARGET_CONFIGS = $(strip $(foreach my_arch_config, $(ARCH_CONFIGS), $(subst arch_slot,$(my_arch_config),$(temp_list))))
+ export TARGET_CONFIGS_UC := $(shell printf "%s" "$(TARGET_CONFIGS)" | $(TR) a-z A-Z)
+ export MACHINE_CONFIG = $(word 3, $(TARGET_CONFIGS_UC))
+ export DEFAULT_KERNEL_CONFIG = $(word 1, $(TARGET_CONFIGS_UC))
+endif
+endif
+
+export MACHINE_CONFIG_LC := $(shell printf "%s" "$(MACHINE_CONFIG)" | $(TR) A-Z a-z)
+export KERNEL_CONFIG_LC := $(shell printf "%s" "$(KERNEL_CONFIG)" | $(TR) A-Z a-z)
+