Correctly auto-complete with start-steps as well.
/trunk/ct-ng.comp | 2 1 1 0 +-
1 file changed, 1 insertion(+), 1 deletion(-)
1 # Makefile to manage samples
3 # Build the list of available samples
4 CT_TOP_SAMPLES := $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
5 CT_LIB_SAMPLES := $(filter-out $(CT_TOP_SAMPLES),$(patsubst $(CT_LIB_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_LIB_DIR)/samples/*/crosstool.config)))
7 CT_SAMPLES := $(sort $(CT_TOP_SAMPLES) $(CT_LIB_SAMPLES))
10 @echo ' saveconfig - Save current config as a preconfigured target'
13 @echo ' list-samples - prints the list of all samples (for scripting)'
14 @echo ' show-<sample> - show a brief overview of <sample> (list below)'
15 @echo ' <sample> - preconfigure crosstool-NG with <sample> (list below)'
16 @$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
19 @echo ' regtest[.#] - Regtest-build all samples'
20 @echo ' regtest-local[.#] - Regtest-build all local samples'
21 @echo ' regtest-global[.#] - Regtest-build all global samples'
24 @echo ' wiki-samples - Print a DokuWiki table of samples'
26 $(patsubst %,show-%,$(CT_SAMPLES)):
27 @$(CT_LIB_DIR)/scripts/showSamples.sh -v $(patsubst show-%,%,$(@))
31 @echo $(CT_SAMPLES) |sed -r -e 's/ /\n/g;' |sort
33 # How we do recall one sample
34 PHONY += $(CT_SAMPLES)
36 @cp $(call sample_dir,$@)/crosstool.config .config
37 @$(MAKE) -rf $(CT_NG) oldconfig
38 @if grep -E '^CT_EXPERIMENTAL=y$$' .config >/dev/null 2>&1; then \
40 echo '***********************************************************'; \
42 echo 'WARNING! This sample may enable experimental features.'; \
43 echo ' Please be sure to review the configuration prior'; \
44 echo ' to building and using your toolchain!'; \
45 echo 'Now, you have been warned!'; \
47 echo '***********************************************************'; \
50 @echo 'Now configured for "$@"'
52 # The 'sample_dir' function prints the directory in which the sample is,
53 # searching first in local samples, then in global samples
55 $$( [ -d $(CT_TOP_DIR)/samples/$(1) ] && echo "$(CT_TOP_DIR)/samples/$(1)" || echo "$(CT_LIB_DIR)/samples/$(1)")
58 # And now for building all samples one after the other
59 PHONY += regtest regtest_local regtest_global
60 regtest: regtest-local regtest-global
62 regtest-local: $(patsubst %,regtest_%,$(CT_TOP_SAMPLES))
64 regtest-global: $(patsubst %,regtest_%,$(CT_LIB_SAMPLES))
66 regtest.% regtest-local.% regtest-global.%:
67 @$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
69 # One regtest per sample
70 # We could use a simple rule like: 'regtest: $(CT_SAMPLES)', but that doesn't
71 # work because we want to save the samples as well.
72 # Also, we don't want to see anylog at all, save for the elapsed time, and we
73 # want to save the log file in a specific place
74 # Furthermore, force the location where the toolchain will be installed.
75 # Finaly, we can't use 'make sample-name' as we need to provide default values
76 # if the options set has changed, but oldconfig does not like when stdin is
77 # not a terminal (eg. it is a pipe).
78 $(patsubst %,regtest_%,$(CT_SAMPLES)):
79 @samp=$(patsubst regtest_%,%,$@) ; \
80 echo -e "\rBuilding sample \"$${samp}\"" && \
81 $(CT_NG) copy_config_$${samp} && \
82 yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1 && \
83 sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config && \
84 sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config && \
85 sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config && \
86 sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config && \
87 sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config && \
88 sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config && \
89 yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1 && \
91 echo -e "\rSuccessfully built sample \"$${samp}\"" && \
92 echo -e "\rMaking tarball for sample \"$${samp}\"" && \
94 echo -e "\rSuccessfully built tarball for sample \"$${samp}\"" ; \
95 echo -e "\rCleaning sample \"$${samp}\"" ; \
96 $(CT_NG) distclean ; \
100 @$(CT_LIB_DIR)/scripts/saveSample.sh
103 @$(CT_LIB_DIR)/scripts/showSamples.sh -w $(CT_SAMPLES)