summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-06-17 11:13:48 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-06-17 11:13:48 (GMT)
commiteae28ee8af1196739707057e99c37cc2d488cb4f (patch)
tree03a0f74b0d4c29d8d3c32af7e74ebcd260f8e05b /samples
parent5e07f7cfc3292f4c185a570546e449b096056da7 (diff)
Add the "regtest" make target: call "make regtest", and all samples wil be built, and a tarball made for each of them. First sample to fail causes the test to stop.
Diffstat (limited to 'samples')
-rw-r--r--samples/Makefile47
1 files changed, 40 insertions, 7 deletions
diff --git a/samples/Makefile b/samples/Makefile
index dede048..e1e2d49 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -1,15 +1,48 @@
-# Build a list of all available samples
+# Makefile to manage samples
-CT_SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(filter-out %Makefile,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config)))
-.PHONY: $(SAMPLES)
-$(CT_SAMPLES):
- @cp "$(CT_TOP_DIR)/samples/$(@)/crosstool.config" "$(CT_TOP_DIR)/.config"
- @$(MAKE) oldconfig
+# Build the list of available samples
+CT_SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
help::
@echo 'Preconfigured targets:'
@$(CT_TOP_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
@echo ''
+# How we do build one sample
+.PHONY: $(CT_SAMPLES)
+$(CT_SAMPLES):
+ @cp "$(CT_TOP_DIR)/samples/$(@)/crosstool.config" "$(CT_TOP_DIR)/.config"
+ @$(MAKE) oldconfig
+
+# And now for building all samples one after the other
+# We could use a simple rule like: 'regtest: $(CT_SAMPLES)', but that doesn't
+# work because we want to save the samples as well.
+# Also, we don't want to see anylog at all, save for the elapsed time, and we
+# want to save the log file in a specific place
+# Furthermore, force the location where the toolchain will be installed.
+# Finaly, we can't use 'make sample-name' as we need to provide default values
+# if the options set has changed, but oldconfig does not like when stdin is
+# not a terminal (eg. it is a pipe).
+.PHONY: regtest
+regtest:
+ @for samp in $(CT_SAMPLES); do \
+ echo "Building sample \"$${samp}\"" && \
+ cp "$(CT_TOP_DIR)/samples/$${samp}/crosstool.config" "$(CT_TOP_DIR)/.config" && \
+ yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1 && \
+ sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config && \
+ sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config && \
+ sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config && \
+ sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config && \
+ sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config && \
+ sed -i -r -e 's:^.*(CT_LOG_FILE).*$$:\1="$${CT_PREFIX_DIR}/build.log":;' .config && \
+ sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config && \
+ yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1 && \
+ make -C $(CT_TOP_DIR) && \
+ make -C $(CT_TOP_DIR) tarball && \
+ chmod -R u+w $(CT_TOP_DIR)/targets && \
+ rm -rf $(CT_TOP_DIR)/targets; \
+ done
+ @make distclean
+
saveconfig:
- @$(CT_TOP_DIR)/scripts/saveSample.sh
+ $(CT_TOP_DIR)/scripts/saveSample.sh