+
+target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
+ifeq ($(DUMP),)
+ PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
+ SUBTARGET:=$(strip $(foreach subdir,$(patsubst $(PLATFORM_DIR)/%/target.mk,%,$(wildcard $(PLATFORM_DIR)/*/target.mk)),$(if $(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(subdir))),$(subdir))))
+else
+ PLATFORM_DIR:=${CURDIR}
+endif
+
+TARGETID:=$(BOARD)$(if $(SUBTARGET),/$(SUBTARGET))
+PLATFORM_SUBDIR:=$(PLATFORM_DIR)$(if $(SUBTARGET),/$(SUBTARGET))
+
+ifneq ($(TARGET_BUILD),1)
+ include $(PLATFORM_DIR)/Makefile
+ ifneq ($(PLATFORM_DIR),$(PLATFORM_SUBDIR))
+ include $(PLATFORM_SUBDIR)/target.mk
+ endif
+else
+ ifneq ($(SUBTARGET),)
+ -include ./$(SUBTARGET)/target.mk
+ endif
+endif
+
+define Profile/Default
+ NAME:=
+ PACKAGES:=
+endef
+
+ifndef Profile
+define Profile
+ $(eval $(call Profile/Default))
+ $(eval $(call Profile/$(1)))
+ $(eval $(call shexport,Profile/$(1)/Config))
+ $(eval $(call shexport,Profile/$(1)/Description))
+ DUMPINFO += \
+ echo "Target-Profile: $(1)"; \
+ echo "Target-Profile-Name: $(NAME)"; \
+ echo "Target-Profile-Packages: $(PACKAGES)"; \
+ if [ -f ./config/profile-$(1) ]; then \
+ echo "Target-Profile-Kconfig: yes"; \
+ fi; \
+ echo "Target-Profile-Config: "; \
+ getvar "$(call shvar,Profile/$(1)/Config)"; \
+ echo "@@"; \
+ echo "Target-Profile-Description:"; \
+ getvar "$(call shvar,Profile/$(1)/Description)"; \
+ echo "@@"; \
+ echo;
+ ifeq ($(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(if $(SUBTARGET),$(SUBTARGET)_)$(1))),y)
+ PROFILE=$(1)
+ endif