diff --git a/include/image.mk b/include/image.mk index 3f5268efacc..f65a835a1a6 100644 --- a/include/image.mk +++ b/include/image.mk @@ -966,10 +966,19 @@ define Device $(call Device/Default,$(1)) $(call Device/$(1),$(1)) $(call Device/Check,$(1)) - $(call Device/$(if $(DUMP),Dump,Build),$(1)) + $(if $(DUMP),$(call Device/Dump,$(1)),$(call Device/BuildSelected,$(1))) endef +# The rules of a device that is not selected can not be reached, and a +# target defines more than 100 devices, so do not define them. The whole +# image Makefile is parsed twice per build. +define Device/BuildSelected + ifneq ($(CONFIG_IB)$$(_PROFILE_SET),) +$(call Device/Build,$(1)) + endif +endef + define BuildImage ifneq ($(DUMP),)