summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2015-10-29 01:12:03 (GMT)
committerAlexey Neyman <stilor@att.net>2015-10-30 23:24:52 (GMT)
commitb36e00212458309335f939cda6ba92de94068dec (patch)
treec997bfee234ddc639801022762a1b52b2cf05563 /samples
parent1d6bed6254ac819ef7b6deb653053024311ec5be (diff)
Avoid commas in autogenerated CT_PREFIX_DIR.
Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'samples')
-rw-r--r--samples/samples.mk17
1 files changed, 12 insertions, 5 deletions
diff --git a/samples/samples.mk b/samples/samples.mk
index 35f3435..b3542f6 100644
--- a/samples/samples.mk
+++ b/samples/samples.mk
@@ -164,13 +164,20 @@ $(CT_SAMPLES): config_files
# ----------------------------------------------------------
# Some helper functions
+# Construct a CT_PREFIX_DIR path from the sample name. Sample names use
+# comma as a separator between host and target triplets in canadian cross
+# configurations, but ct-ng does not allow commas in the path. Substitute
+# with = (equal sign).
+# $1: sample
+__comma = ,
+prefix_dir = $(CT_PREFIX)/$(subst $(__comma),=,$(1))
+
# Create the rule to build a sample
-# $1: sample tuple
-# $2: prefix
+# $1: sample name (target tuple, or host/target tuples separated by a comma)
define build_sample
@$(ECHO) ' CONF $(1)'
$(SILENT)$(CONF) -s --defconfig=$(call sample_dir,$(1))/crosstool.config $(KCONFIG_TOP)
- $(SILENT)$(sed) -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$(2)":;' .config
+ $(SILENT)$(sed) -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$(call prefix_dir,$(1))":;' .config
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config
$(SILENT)$(sed) -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config
@@ -197,8 +204,8 @@ endif # MAKECMDGOALS contains a build sample rule
endif # MAKECMDGOALS != ""
# Build a single sample
-$(patsubst %,build-%,$(CT_SAMPLES)): config_files
- $(call build_sample,$(patsubst build-%,%,$@),$(CT_PREFIX)/$(patsubst build-%,%,$@))
+$(patsubst %,build-%,$(CT_SAMPLES)): build-%: config_files
+ $(call build_sample,$*)
# Build al samples
build-all: $(patsubst %,build-%,$(CT_SAMPLES))