image: only define the rules of selected devices

A target defines more than 100 devices, and the image Makefile
expands the kernel, image and artifact rules of every one of them. The
rules of a device that is not selected are only reachable through
install-disabled and compile-disabled, so nothing uses them. The image
Makefile is parsed twice per build, 0.3 s each for mediatek.

Only expand Device/Build for selected devices, and for all devices if
CONFIG_IB is set, as the ImageBuilder compiles them all.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin committed 2026-09-22 18:18:58 +02:00
1 parent 9772acb4f7
commit 6258a11bac
1 file changed
+10 -1
+10 -1
View File
@@ -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),)