mk: allow updates to build config on make install
authorBruce Richardson <bruce.richardson@intel.com>
Wed, 14 May 2014 15:55:10 +0000 (16:55 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 10 Jun 2014 20:30:57 +0000 (22:30 +0200)
When running "make config", an additional config.orig file is also
generated, which is intended to hold the original, clean configuration
from the template.
When running make install, we first check if there is no existing
.config file, and run make config if not. If there is a file, we then
check if it's unmodified, in which case we regenerate a new .config to
take account of any possible updates to the template. Finally, in the
case where there is an existing .config file, and it HAS been modified,
we then do a check to see if the template has had further updates, and
throw an error if so. If no updates, we continue with the build using
the existing, user-modified config.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
mk/rte.sdkconfig.mk
mk/rte.sdkinstall.mk

index d0692e7..3124dce 100644 (file)
@@ -74,6 +74,7 @@ $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE
                -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
                if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \
                        cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \
+                       cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \
                fi ; \
                rm -f $(RTE_OUTPUT)/.config_tmp ; \
        else \
index 24b60cf..8571196 100644 (file)
@@ -58,6 +58,18 @@ install: $(INSTALL_TARGETS)
        @echo ================== Installing $*
        $(Q)if [ ! -f $(BUILD_DIR)/$*/.config ]; then \
                $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \
+       elif cmp -s $(BUILD_DIR)/$*/.config.orig $(BUILD_DIR)/$*/.config; then \
+               $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \
+       else \
+               if [ -f $(BUILD_DIR)/$*/.config.orig ] ; then \
+                       tmp_build=$(BUILD_DIR)/$*/.config.tmp; \
+                       $(MAKE) config T=$* O=$$tmp_build; \
+                       if ! cmp -s $(BUILD_DIR)/$*/.config.orig $$tmp_build/.config ; then \
+                               echo "Conflict: local config and template config have both changed"; \
+                               exit 1; \
+                       fi; \
+               fi; \
+               echo "Using local configuration"; \
        fi
        $(Q)$(MAKE) all O=$(BUILD_DIR)/$*