build: avoid rebuilds of unset VARIANT packages

If a Makefile defines some packages with VARIANT set, and others without
it, the latter will be built once for every different VARIANT set, each
build trumping the previous one.

Avoid rebuilds by only building unnamed variant packages when the first
variant is built.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
Eneas U de Queiroz
2021-10-22 16:12:10 -03:00
committed by Felix Fietkau
parent 6b8b5e7248
commit 19aae949c6
3 changed files with 10 additions and 6 deletions

View File

@@ -4,7 +4,8 @@
ifeq ($(DUMP),)
define BuildTarget/bin
ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT))
TARGET_VARIANT=$(if $(ALL_VARIANTS),$(if $(VARIANT),$(VARIANT),$(firstword $(ALL_VARIANTS))))
ifeq ($(if $(TARGET_VARIANT),$(BUILD_VARIANT)),$(TARGET_VARIANT))
ifdef Package/$(1)/install
ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
$(_pkg_target)compile: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed