diff mbox

[6/6] Makefile: Fix merge defconfig clobber of .config.old

Message ID 1463599530-28752-7-git-send-email-patrick@stwcx.xyz
State Superseded
Headers show

Commit Message

Patrick Williams May 18, 2016, 7:25 p.m. UTC
The merged defconfig support was using .config as a temporary file to
store the merged defconfig.  The result of then running the 'conf' tool
is that .config.old contains the contents of the merged defconfig
instead of the actual old .config.

Place the temporary merged defconfig into $(CONFIG_DIR)/.merge_config
instead to prevent this clobbering.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
---
 Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 2694339..7a675d6 100644
--- a/Makefile
+++ b/Makefile
@@ -850,9 +850,11 @@  define CREATE_DEFCONFIG_RECIPES
 		$$< --defconfig=$1/$$@ $$(CONFIG_CONFIG_IN)
 
 %_defconfig: $$(BUILD_DIR)/buildroot-config/conf $1/%_defconfig.merge outputmakefile
-	@cd $1 && xargs -a $$@.merge -x -P 1 $$(TOPDIR)/support/kconfig/merge_config.sh -m -O $$(CONFIG_DIR)
-	@$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$$(CONFIG_DIR)/.config \
-		$$< --defconfig=$$(CONFIG_DIR)/.config $$(CONFIG_CONFIG_IN)
+	@mkdir $$(CONFIG_DIR)/.merge_config
+	@cd $1 && xargs -a $$@.merge -x -P 1 $$(TOPDIR)/support/kconfig/merge_config.sh -m -O $$(CONFIG_DIR)/.merge_config
+	@$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$$(CONFIG_DIR)/.merge_config/.config \
+		$$< --defconfig=$$(CONFIG_DIR)/.merge_config/.config $$(CONFIG_CONFIG_IN)
+	@rm -rf $$(CONFIG_DIR)/.merge_config
 endef
 
 $(foreach path,$(BR2_DEFCONFIG_PATHS),$(eval $(call CREATE_DEFCONFIG_RECIPES,$(path))))