1 # Makefile to manage samples
3 # Build the list of available samples
4 CT_SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
7 @echo ' saveconfig - Save current config as a preconfigured target'
10 @$(CT_TOP_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
13 @echo ' regtest - Regtest-build all samples'
15 # How we do build one sample
18 @cp "$(CT_TOP_DIR)/samples/$(@)/crosstool.config" "$(CT_TOP_DIR)/.config"
21 # And now for building all samples one after the other
22 # We could use a simple rule like: 'regtest: $(CT_SAMPLES)', but that doesn't
23 # work because we want to save the samples as well.
24 # Also, we don't want to see anylog at all, save for the elapsed time, and we
25 # want to save the log file in a specific place
26 # Furthermore, force the location where the toolchain will be installed.
27 # Finaly, we can't use 'make sample-name' as we need to provide default values
28 # if the options set has changed, but oldconfig does not like when stdin is
29 # not a terminal (eg. it is a pipe).
32 @for samp in $(CT_SAMPLES); do \
33 echo -e "\rBuilding sample \"$${samp}\"" && \
34 cp "$(CT_TOP_DIR)/samples/$${samp}/crosstool.config" "$(CT_TOP_DIR)/.config" && \
35 yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1 && \
36 sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config && \
37 sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config && \
38 sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config && \
39 sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config && \
40 sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config && \
41 sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config && \
42 yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1 && \
43 make -C $(CT_TOP_DIR) && \
44 echo -e "\rMaking tarball for sample \"$${samp}\"" && \
45 make -C $(CT_TOP_DIR) tarball; \
46 echo -e "\rCleaning sample \"$${samp}\""; \
47 make -C $(CT_TOP_DIR) distclean; \
51 $(CT_TOP_DIR)/scripts/saveSample.sh