From aba43b63d31f94ec9598a3e0e5008f25a82b64fd Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Thu, 29 Oct 2015 00:21:43 -0700 Subject: Order the samples in build-all. First, build cross samples (indicated by lack of comma in their names); then, build canadian cross samples (and, when they are supported, cross-native). While building canadian cross, set up the path to the build-to-host cross if it was built previously. Signed-off-by: Alexey Neyman diff --git a/samples/samples.mk b/samples/samples.mk index b3542f6..48f4a74 100644 --- a/samples/samples.mk +++ b/samples/samples.mk @@ -171,6 +171,7 @@ $(CT_SAMPLES): config_files # $1: sample __comma = , prefix_dir = $(CT_PREFIX)/$(subst $(__comma),=,$(1)) +host_triplet = $(if $(findstring $(__comma),$(1)),$(firstword $(subst $(__comma), ,$(1)))) # Create the rule to build a sample # $1: sample name (target tuple, or host/target tuples separated by a comma) @@ -185,7 +186,10 @@ define build_sample $(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config $(SILENT)$(CONF) -s --oldconfig $(KCONFIG_TOP) @$(ECHO) ' BUILD $(1)' - $(SILENT)$(MAKE) -rf $(CT_NG) V=0 build + $(SILENT)if [ ! -z "$(call host_triplet,$(1))" -a -d "$(call prefix_dir,$(call host_triplet,$(1)))" ]; then \ + PATH="$$PATH:$(call prefix_dir,$(call host_triplet,$(1)))/bin"; \ + fi; \ + $(MAKE) -rf $(CT_NG) V=0 build @printf '\r' endef @@ -207,8 +211,14 @@ endif # MAKECMDGOALS != "" $(patsubst %,build-%,$(CT_SAMPLES)): build-%: config_files $(call build_sample,$*) -# Build al samples -build-all: $(patsubst %,build-%,$(CT_SAMPLES)) +# Cross samples (build==host) +CT_SAMPLES_CROSS = $(strip $(foreach s,$(CT_SAMPLES),$(if $(findstring $(__comma),$(s)),, $(s)))) +# Canadian cross (build!=host) +CT_SAMPLES_CANADIAN = $(strip $(foreach s,$(CT_SAMPLES),$(if $(findstring $(__comma),$(s)), $(s),))) + +# Build all samples; first, build simple cross as canadian configurations may depend on +# build-to-host cross being pre-built. +build-all: $(patsubst %,build-%,$(CT_SAMPLES_CROSS) $(CT_SAMPLES_CANADIAN)) # Build all samples, overiding the number of // jobs per sample build-all.%: -- cgit v0.10.2-6-g49f6