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:
parent
6b8b5e7248
commit
19aae949c6
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
ifeq ($(DUMP),)
|
ifeq ($(DUMP),)
|
||||||
define BuildTarget/bin
|
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
|
ifdef Package/$(1)/install
|
||||||
ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
|
ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
|
||||||
$(_pkg_target)compile: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
|
$(_pkg_target)compile: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
|
||||||
|
|
|
@ -105,7 +105,8 @@ ifeq ($(DUMP),)
|
||||||
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
|
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
|
||||||
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
|
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
|
||||||
|
|
||||||
ifeq ($(BUILD_VARIANT),$$(if $$(VARIANT),$$(VARIANT),$(BUILD_VARIANT)))
|
TARGET_VARIANT:=$$(if $(ALL_VARIANTS),$$(if $$(VARIANT),$$(VARIANT),$(firstword $(ALL_VARIANTS))))
|
||||||
|
ifeq ($(BUILD_VARIANT),$$(if $$(TARGET_VARIANT),$$(TARGET_VARIANT),$(BUILD_VARIANT)))
|
||||||
do_install=
|
do_install=
|
||||||
ifdef Package/$(1)/install
|
ifdef Package/$(1)/install
|
||||||
do_install=yes
|
do_install=yes
|
||||||
|
|
|
@ -29,12 +29,14 @@ diralias=$(if $(findstring $(1),$(call lastdir,$(1))),,$(call lastdir,$(1)))
|
||||||
subdir_make_opts = \
|
subdir_make_opts = \
|
||||||
-r -C $(1) \
|
-r -C $(1) \
|
||||||
BUILD_SUBDIR="$(1)" \
|
BUILD_SUBDIR="$(1)" \
|
||||||
BUILD_VARIANT="$(4)"
|
BUILD_VARIANT="$(4)" \
|
||||||
|
ALL_VARIANTS="$(5)"
|
||||||
|
|
||||||
# 1: subdir
|
# 1: subdir
|
||||||
# 2: target
|
# 2: target
|
||||||
# 3: build type
|
# 3: build type
|
||||||
# 4: build variant
|
# 4: build variant
|
||||||
|
# 5: all variants
|
||||||
log_make = \
|
log_make = \
|
||||||
$(if $(call debug,$(1),v),,@)+ \
|
$(if $(call debug,$(1),v),,@)+ \
|
||||||
$(if $(BUILD_LOG), \
|
$(if $(BUILD_LOG), \
|
||||||
|
@ -62,15 +64,15 @@ define subdir
|
||||||
$(foreach target,$(SUBTARGETS) $($(1)/subtargets),
|
$(foreach target,$(SUBTARGETS) $($(1)/subtargets),
|
||||||
$(foreach btype,$(buildtypes-$(bd)),
|
$(foreach btype,$(buildtypes-$(bd)),
|
||||||
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(btype)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(btype)/$(target)) $(call $(1)//$(btype)/$(target),$(1)/$(bd)/$(btype))))
|
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(btype)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(btype)/$(target)) $(call $(1)//$(btype)/$(target),$(1)/$(bd)/$(btype))))
|
||||||
$(call log_make,$(1)/$(bd),$(target),$(btype),$(filter-out __default,$(variant))) \
|
$(call log_make,$(1)/$(bd),$(target),$(btype),$(filter-out __default,$(variant)),$($(1)/$(bd)/variants)) \
|
||||||
|| $(call ERROR,$(2), ERROR: $(1)/$(bd) [$(btype)] failed to build.,$(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target))))
|
|| $(call ERROR,$(2), ERROR: $(1)/$(bd) [$(btype)] failed to build.,$(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target))))
|
||||||
$(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(btype)/$(target): $(1)/$(bd)/$(btype)/$(target)))
|
$(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(btype)/$(target): $(1)/$(bd)/$(btype)/$(target)))
|
||||||
)
|
)
|
||||||
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
|
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
|
||||||
$(foreach variant,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $(strip $($(1)/$(bd)/variants)),$($(1)/$(bd)/variants),$(if $($(1)/$(bd)/default-variant),$($(1)/$(bd)/default-variant),__default))),
|
$(foreach variant,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $(strip $($(1)/$(bd)/variants)),$($(1)/$(bd)/variants),$(if $($(1)/$(bd)/default-variant),$($(1)/$(bd)/default-variant),__default))),
|
||||||
$(if $(BUILD_LOG),@mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd)/$(filter-out __default,$(variant)))
|
$(if $(BUILD_LOG),@mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd)/$(filter-out __default,$(variant)))
|
||||||
$(if $($(1)/autoremove),$(call rebuild_check,$(1)/$(bd),$(target),,$(filter-out __default,$(variant))))
|
$(if $($(1)/autoremove),$(call rebuild_check,$(1)/$(bd),$(target),,$(filter-out __default,$(variant)),$($(1)/$(bd)/variants)))
|
||||||
$(call log_make,$(1)/$(bd),$(target),,$(filter-out __default,$(variant))) \
|
$(call log_make,$(1)/$(bd),$(target),,$(filter-out __default,$(variant)),$($(1)/$(bd)/variants)) \
|
||||||
|| $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).,$(findstring $(bd),$($(1)/builddirs-ignore-$(target))))
|
|| $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).,$(findstring $(bd),$($(1)/builddirs-ignore-$(target))))
|
||||||
)
|
)
|
||||||
$(if $(PREREQ_ONLY)$(DUMP_TARGET_DB),,
|
$(if $(PREREQ_ONLY)$(DUMP_TARGET_DB),,
|
||||||
|
|
Loading…
Reference in New Issue