2007-06-17 11:13:48 +00:00
|
|
|
# Makefile to manage samples
|
2007-05-07 09:04:02 +00:00
|
|
|
|
2007-06-17 11:13:48 +00:00
|
|
|
# Build the list of available samples
|
2007-07-01 19:04:20 +00:00
|
|
|
CT_TOP_SAMPLES := $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
|
|
|
|
CT_LIB_SAMPLES := $(filter-out $(CT_TOP_SAMPLES),$(patsubst $(CT_LIB_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_LIB_DIR)/samples/*/crosstool.config)))
|
|
|
|
|
2008-06-23 08:07:14 +00:00
|
|
|
CT_SAMPLES := $(sort $(CT_TOP_SAMPLES) $(CT_LIB_SAMPLES))
|
2007-05-07 09:04:02 +00:00
|
|
|
|
2007-06-17 16:24:23 +00:00
|
|
|
help-config::
|
2007-08-15 14:59:37 +00:00
|
|
|
@echo ' saveconfig - Save current config as a preconfigured target'
|
2007-06-17 16:24:23 +00:00
|
|
|
|
|
|
|
help-samples::
|
2008-06-01 21:12:00 +00:00
|
|
|
@echo ' list-samples - prints the list of all samples (for scripting)'
|
|
|
|
@echo ' show-<sample> - show a brief overview of <sample> (list below)'
|
|
|
|
@echo ' <sample> - preconfigure crosstool-NG with <sample> (list below)'
|
2007-07-01 19:04:20 +00:00
|
|
|
@$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
|
2007-06-17 16:24:23 +00:00
|
|
|
|
|
|
|
help-build::
|
2007-08-15 14:59:37 +00:00
|
|
|
@echo ' regtest[.#] - Regtest-build all samples'
|
|
|
|
@echo ' regtest-local[.#] - Regtest-build all local samples'
|
|
|
|
@echo ' regtest-global[.#] - Regtest-build all global samples'
|
2007-05-07 09:04:02 +00:00
|
|
|
|
2008-06-15 19:25:51 +00:00
|
|
|
help-distrib::
|
|
|
|
@echo ' wiki-samples - Print a DokuWiki table of samples'
|
|
|
|
|
2008-05-26 21:49:36 +00:00
|
|
|
$(patsubst %,show-%,$(CT_SAMPLES)):
|
|
|
|
@$(CT_LIB_DIR)/scripts/showSamples.sh -v $(patsubst show-%,%,$(@))
|
|
|
|
|
2008-06-01 21:12:00 +00:00
|
|
|
PHONY += list-samples
|
|
|
|
list-samples: .FORCE
|
2008-05-26 21:49:36 +00:00
|
|
|
@echo $(CT_SAMPLES) |sed -r -e 's/ /\n/g;' |sort
|
2008-05-02 21:49:43 +00:00
|
|
|
|
2008-10-14 19:40:12 +00:00
|
|
|
# How we do recall one sample
|
2007-07-01 19:04:20 +00:00
|
|
|
PHONY += $(CT_SAMPLES)
|
2007-06-17 11:13:48 +00:00
|
|
|
$(CT_SAMPLES):
|
2008-10-14 19:40:12 +00:00
|
|
|
@cp $(call sample_dir,$@)/crosstool.config .config
|
|
|
|
@$(MAKE) -rf $(CT_NG) oldconfig
|
2008-10-14 21:30:27 +00:00
|
|
|
@echo
|
|
|
|
@echo '***********************************************************'
|
|
|
|
@echo
|
|
|
|
@( . $(call sample_dir,$@)/reported.by; \
|
|
|
|
echo "Initially reported by: $${reporter_name:-Yann E. MORIN}"; \
|
|
|
|
echo "URL: $${reporter_url:-http://ymorin.is-a-geek.org/}"; \
|
|
|
|
if [ -n "$${reporter_comment}" ]; then \
|
|
|
|
echo ; \
|
|
|
|
echo "Comment:"; \
|
|
|
|
printf "$${reporter_comment}\n"; \
|
|
|
|
fi; \
|
|
|
|
echo ; \
|
|
|
|
echo '***********************************************************'; \
|
|
|
|
)
|
2008-09-02 12:43:11 +00:00
|
|
|
@if grep -E '^CT_EXPERIMENTAL=y$$' .config >/dev/null 2>&1; then \
|
2008-10-14 21:30:27 +00:00
|
|
|
echo ; \
|
2008-09-02 12:43:11 +00:00
|
|
|
echo 'WARNING! This sample may enable experimental features.'; \
|
|
|
|
echo ' Please be sure to review the configuration prior'; \
|
|
|
|
echo ' to building and using your toolchain!'; \
|
|
|
|
echo 'Now, you have been warned!'; \
|
2008-10-14 21:30:27 +00:00
|
|
|
echo ; \
|
2008-09-02 12:43:11 +00:00
|
|
|
echo '***********************************************************'; \
|
|
|
|
fi
|
2008-10-14 21:30:27 +00:00
|
|
|
@echo
|
2008-10-14 19:40:12 +00:00
|
|
|
@echo 'Now configured for "$@"'
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-10-14 19:40:12 +00:00
|
|
|
# The 'sample_dir' function prints the directory in which the sample is,
|
|
|
|
# searching first in local samples, then in global samples
|
|
|
|
define sample_dir
|
|
|
|
$$( [ -d $(CT_TOP_DIR)/samples/$(1) ] && echo "$(CT_TOP_DIR)/samples/$(1)" || echo "$(CT_LIB_DIR)/samples/$(1)")
|
|
|
|
endef
|
2007-06-17 11:13:48 +00:00
|
|
|
|
|
|
|
# And now for building all samples one after the other
|
2007-07-09 20:58:46 +00:00
|
|
|
PHONY += regtest regtest_local regtest_global
|
|
|
|
regtest: regtest-local regtest-global
|
|
|
|
|
|
|
|
regtest-local: $(patsubst %,regtest_%,$(CT_TOP_SAMPLES))
|
|
|
|
|
|
|
|
regtest-global: $(patsubst %,regtest_%,$(CT_LIB_SAMPLES))
|
|
|
|
|
2007-08-15 14:59:37 +00:00
|
|
|
regtest.% regtest-local.% regtest-global.%:
|
|
|
|
@$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
|
|
|
|
|
2007-07-09 20:58:46 +00:00
|
|
|
# One regtest per sample
|
2007-06-17 11:13:48 +00:00
|
|
|
# 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).
|
2007-07-09 20:58:46 +00:00
|
|
|
$(patsubst %,regtest_%,$(CT_SAMPLES)):
|
|
|
|
@samp=$(patsubst regtest_%,%,$@) ; \
|
|
|
|
echo -e "\rBuilding sample \"$${samp}\"" && \
|
|
|
|
$(CT_NG) copy_config_$${samp} && \
|
|
|
|
yes "" |$(CT_NG) 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_PROGRESS_BAR).*$$:\1=y:;' .config && \
|
|
|
|
yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1 && \
|
|
|
|
$(CT_NG) build && \
|
|
|
|
echo -e "\rSuccessfully built sample \"$${samp}\"" && \
|
|
|
|
echo -e "\rMaking tarball for sample \"$${samp}\"" && \
|
|
|
|
$(CT_NG) tarball && \
|
|
|
|
echo -e "\rSuccessfully built tarball for sample \"$${samp}\"" ; \
|
|
|
|
echo -e "\rCleaning sample \"$${samp}\"" ; \
|
|
|
|
$(CT_NG) distclean ; \
|
|
|
|
echo -e "\r"
|
2007-06-17 11:13:48 +00:00
|
|
|
|
2007-05-07 09:04:02 +00:00
|
|
|
saveconfig:
|
2007-07-02 16:56:42 +00:00
|
|
|
@$(CT_LIB_DIR)/scripts/saveSample.sh
|
2008-06-15 19:25:51 +00:00
|
|
|
|
|
|
|
wiki-samples:
|
|
|
|
@$(CT_LIB_DIR)/scripts/showSamples.sh -w $(CT_SAMPLES)
|