diff --git a/Makefile b/Makefile index 06020ca18a..404dcaa270 100644 --- a/Makefile +++ b/Makefile @@ -1013,13 +1013,18 @@ oldconfig syncconfig olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmake defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN) -define percent_defconfig -# Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig -%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(1)/configs/%_defconfig outputmakefile - @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/configs/$$@ \ - $$< --defconfig=$(1)/configs/$$@ $$(CONFIG_CONFIG_IN) -endef -$(eval $(foreach d,$(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)),$(call percent_defconfig,$(d))$(sep))) +%_defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile + @defconfig=$(or \ + $(firstword \ + $(foreach d, \ + $(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)), \ + $(wildcard $(d)/configs/$@) \ + ) \ + ), \ + $(error "Can't find $@") \ + ); \ + $(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$${defconfig} \ + $< --defconfig=$${defconfig} $(CONFIG_CONFIG_IN) update-defconfig: savedefconfig