summaryrefslogtreecommitdiff
path: root/ct-ng.in
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2019-01-28 03:04:15 (GMT)
committerAlexey Neyman <stilor@att.net>2019-01-28 06:55:26 (GMT)
commitadc16046f769fdf27db9b533260609fe675d8c6b (patch)
tree5b9b1727f256c7c07d7c517daf769b002f4a6bc8 /ct-ng.in
parent20c6accc65b9dafbb3e764b36e162c919b3b728c (diff)
Add upgrade logic to version-check.sh
Slightly rework config version detector to catch the case where neither CONFIG_VERSION/CONFIG_VERSION_CURRENT is defined in the config file. Add olddefconfig and use it after the upgrade. Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'ct-ng.in')
-rw-r--r--ct-ng.in22
1 files changed, 20 insertions, 2 deletions
diff --git a/ct-ng.in b/ct-ng.in
index fddc464..6f08032 100644
--- a/ct-ng.in
+++ b/ct-ng.in
@@ -1,5 +1,5 @@
#!@MAKE@ -rf
-# vim: set filetype=make :
+# vim: set filetype=make noet :
# Makefile for crosstool-NG.
# Copyright 2006 Yann E. MORIN <yann.morin.1998@free.fr>
@@ -37,6 +37,12 @@ export CT_VERSION:=@PACKAGE_VERSION@
# user-visible configurators, and suppresses a warning from kconfig.
export CT_VCHECK=
+# Current version of the configuration file. Defined here, because we also
+# need to pass it to the upgrade script - which may receive an input that
+# was not preprocessed by kconfig, and hence have no string for "up-to-date"
+# version.
+export CT_CONFIG_VERSION_CURRENT=1
+
# Download agents used by scripts.mk
CT_WGET := @wget@
CT_CURL := @curl@
@@ -106,7 +112,8 @@ CONF-nconfig := $(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 check-config
+.PHONY: menuconfig nconfig oldconfig olddefconfig savedefconfig defconfig check-config extractconfig
+.PHONY: upgradeconfig
check-config:
@[ ! -e .config -o -f .config ] || { echo ".config is not a regular file:"; ls -dl .config; exit 1; } >&2
@@ -124,6 +131,11 @@ oldconfig: .config check-config
@$(bash) $(CT_LIB_DIR)/scripts/version-check.sh .config
$(SILENT)$(CONF) --silent$@ $(KCONFIG_TOP)
+olddefconfig: .config check-config
+ @$(CT_ECHO) " CONF $@"
+ @$(bash) $(CT_LIB_DIR)/scripts/version-check.sh .config
+ $(SILENT)$(CONF) --$@ $(KCONFIG_TOP)
+
savedefconfig: .config check-config
@$(CT_ECHO) ' GEN $@'
$(SILENT)CT_VCHECK=save $(CONF) --savedefconfig=$${DEFCONFIG-defconfig} $(KCONFIG_TOP)
@@ -132,6 +144,11 @@ defconfig: check-config
@$(CT_ECHO) ' CONF $@'
$(SILENT)CT_VCHECK=save $(CONF) --defconfig=$${DEFCONFIG-defconfig} $(KCONFIG_TOP)
+upgradeconfig: .config check-config
+ $(SILENT)CT_UPGRADECONFIG=yes $(bash) $(CT_LIB_DIR)/scripts/version-check.sh .config
+ $(SILENT)$(CONF) --olddefconfig $(KCONFIG_TOP)
+ @$(CT_ECHO) "Done. You may now run 'ct-ng menuconfig' to edit the configuration."
+
# Always be silent, the stdout an be >.config
extractconfig:
@$(awk) 'BEGIN { dump=0; } \
@@ -206,6 +223,7 @@ help-config::
@echo ' menuconfig - Update current config using a menu based program'
@echo ' nconfig - Update current config using a menu based program'
@echo ' oldconfig - Update current config using a provided .config as base'
+ @echo ' upgradeconfig - Upgrade config file to current crosstool-NG'
@echo ' extractconfig - Extract to stdout the configuration items from a'
@echo ' build.log file piped to stdin'
@echo ' savedefconfig - Save current config as a mini-defconfig to $${DEFCONFIG}'