Merge pull request #1080 from stilor/check-dot-config

Check if .config is a regular file before clobbering it
This commit is contained in:
Alexey Neyman 2018-11-01 23:23:45 -07:00 committed by GitHub
commit 673046cd2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -101,26 +101,29 @@ NCONF := $(CT_LIBEXEC_DIR)/nconf
# TBD needed? We do supply the defconfig name explicitly below
export srctree=$(CT_LIB_DIR)
.PHONY: menuconfig nconfig oldconfig savedefconfig defconfig
.PHONY: menuconfig nconfig oldconfig savedefconfig defconfig check-config
menuconfig:
check-config:
@[ ! -e .config -o -f .config ] || { echo ".config is not a regular file:"; ls -dl .config; exit 1; } >&2
menuconfig: check-config
@$(CT_ECHO) " CONF $@"
$(SILENT)$(MCONF) $(KCONFIG_TOP)
nconfig:
nconfig: check-config
@$(CT_ECHO) " CONF $@"
$(SILENT)$(NCONF) $(KCONFIG_TOP)
oldconfig: .config
oldconfig: .config check-config
@$(CT_ECHO) " CONF $@"
$(SILENT)$(sed) -i -r -f $(CT_LIB_DIR)/scripts/upgrade.sed $<
$(SILENT)$(CONF) --silent$@ $(KCONFIG_TOP)
savedefconfig: .config
savedefconfig: .config check-config
@$(CT_ECHO) ' GEN $@'
$(SILENT)$(CONF) --savedefconfig=$${DEFCONFIG-defconfig} $(KCONFIG_TOP)
defconfig:
defconfig: check-config
@$(CT_ECHO) ' CONF $@'
$(SILENT)$(CONF) --defconfig=$${DEFCONFIG-defconfig} $(KCONFIG_TOP)

View File

@ -130,7 +130,7 @@ endef
# How we do recall one sample
PHONY += $(CT_SAMPLES)
$(CT_SAMPLES):
$(CT_SAMPLES): check-config
@$(CT_ECHO) " CONF $@"
$(SILENT)$(CONF) --defconfig=$(call sample_dir,$@)/crosstool.config $(KCONFIG_TOP)
@echo