summaryrefslogtreecommitdiff
path: root/samples/samples.mk
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2015-11-14 02:47:13 (GMT)
committerAlexey Neyman <stilor@att.net>2015-11-14 23:03:35 (GMT)
commitf7d6e53e2b40bd70fdfcd6178ea6f57c64fabf9f (patch)
tree184b810834a2907328d60d002d78bd370845a2ff /samples/samples.mk
parent6c0e31be341f5733144bb0322d55b351ae227f27 (diff)
Add update-samples target.
Same as check-samples, but actually updates the crosstool.config. Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'samples/samples.mk')
-rw-r--r--samples/samples.mk24
1 files changed, 18 insertions, 6 deletions
diff --git a/samples/samples.mk b/samples/samples.mk
index c87e5fc..2d9a287 100644
--- a/samples/samples.mk
+++ b/samples/samples.mk
@@ -11,6 +11,10 @@ CT_SAMPLES := $(shell echo $(sort $(CT_TOP_SAMPLES) $(CT_LIB_SAMPLES)) \
|$(sed) -r -e 's/(.*),(.*)/\2,\1/;' \
)
+# If set to yes on command line, updates the sample configuration
+# instead of just dumping the diff.
+CT_UPDATE_SAMPLES := no
+
# ----------------------------------------------------------
# This part deals with the samples help entries
@@ -81,21 +85,29 @@ list-samples-short: FORCE
# Check one sample
PHONY += $(patsubst %,check-%,$(CT_SAMPLES))
-$(patsubst %,check-%,$(CT_SAMPLES)): config_files
+$(patsubst %,check-%,$(CT_SAMPLES)): check-%: config_files
@export KCONFIG_CONFIG=$$(pwd)/.config.sample; \
- CT_NG_SAMPLE=$(call sample_dir,$(patsubst check-%,%,$(@)))/crosstool.config; \
- $(CONF) --defconfig=$${CT_NG_SAMPLE} $(KCONFIG_TOP) >/dev/null; \
- $(CONF) --savedefconfig=$$(pwd)/.defconfig $(KCONFIG_TOP) >/dev/null; \
+ CT_NG_SAMPLE=$(call sample_dir,$*)/crosstool.config; \
+ $(CONF) -s --defconfig=$${CT_NG_SAMPLE} $(KCONFIG_TOP) &>/dev/null; \
+ $(CONF) -s --savedefconfig=$$(pwd)/.defconfig $(KCONFIG_TOP) &>/dev/null; \
old_sha1=$$( sha1sum "$${CT_NG_SAMPLE}" |cut -d ' ' -f 1 ); \
new_sha1=$$( sha1sum .defconfig |cut -d ' ' -f 1 ); \
if [ $${old_sha1} != $${new_sha1} ]; then \
- echo "$(patsubst check-%,%,$(@)) needs update:"; \
- diff -du0 "$${CT_NG_SAMPLE}" .defconfig |tail -n +4; \
+ if [ $(CT_UPDATE_SAMPLES) = yes ]; then \
+ echo "Updating $*"; \
+ mv .defconfig "$${CT_NG_SAMPLE}"; \
+ else \
+ echo "$* needs update:"; \
+ diff -du0 "$${CT_NG_SAMPLE}" .defconfig |tail -n +4; \
+ fi; \
fi
@rm -f .config.sample* .defconfig
check-samples: $(patsubst %,check-%,$(CT_SAMPLES))
+update-samples:
+ $(SILENT)$(MAKE) -rf $(CT_NG) check-samples CT_UPDATE_SAMPLES=yes
+
PHONY += wiki-samples
wiki-samples: wiki-samples-pre $(patsubst %,wiki-%,$(CT_SAMPLES)) wiki-samples-post