summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2008-10-14 19:40:12 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2008-10-14 19:40:12 (GMT)
commit637a4b94e8e7a4955d9b1bf0a258207068a06a1a (patch)
tree4dd7fb1327809f37aca610400055e6c978b3da07 /samples
parent6a4dc6568b124a11c07c840565a01723a4598799 (diff)
Use a function to retrieve a sample directory.
/trunk/samples/samples.mk | 19 9 10 0 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
Diffstat (limited to 'samples')
-rw-r--r--samples/samples.mk19
1 files changed, 9 insertions, 10 deletions
diff --git a/samples/samples.mk b/samples/samples.mk
index 40db58f..fc0581f 100644
--- a/samples/samples.mk
+++ b/samples/samples.mk
@@ -30,11 +30,11 @@ PHONY += list-samples
list-samples: .FORCE
@echo $(CT_SAMPLES) |sed -r -e 's/ /\n/g;' |sort
-# How we do build one sample
+# How we do recall one sample
PHONY += $(CT_SAMPLES)
$(CT_SAMPLES):
- @echo 'Configuring for "$@"'
- @$(CT_NG) $(patsubst %,copy_config_%,$(@)) oldconfig
+ @cp $(call sample_dir,$@)/crosstool.config .config
+ @$(MAKE) -rf $(CT_NG) oldconfig
@if grep -E '^CT_EXPERIMENTAL=y$$' .config >/dev/null 2>&1; then \
echo ''; \
echo '***********************************************************'; \
@@ -47,14 +47,13 @@ $(CT_SAMPLES):
echo '***********************************************************'; \
echo ''; \
fi
- @echo 'Execute "$(CT_NG) build" to build your toolchain'
+ @echo 'Now configured for "$@"'
-$(patsubst %,copy_config_%,$(CT_SAMPLES)):
- @if [ -f $(CT_TOP_DIR)/samples/$(patsubst copy_config_%,%,$(@))/crosstool.config ]; then \
- cp "$(CT_TOP_DIR)/samples/$(patsubst copy_config_%,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
- else \
- cp "$(CT_LIB_DIR)/samples/$(patsubst copy_config_%,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
- fi
+# 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
# And now for building all samples one after the other
PHONY += regtest regtest_local regtest_global