summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/samples.mk29
1 files changed, 11 insertions, 18 deletions
diff --git a/samples/samples.mk b/samples/samples.mk
index bf51135..5c8f130 100644
--- a/samples/samples.mk
+++ b/samples/samples.mk
@@ -26,7 +26,7 @@ help-samples::
@echo ' show-<sample> - show a brief overview of <sample> (list with list-samples)'
@echo ' <sample> - preconfigure crosstool-NG with <sample> (list with list-samples)'
@echo ' build-all[.#] - Build *all* samples (list with list-samples) and install in'
- @echo ' $${CT_PREFIX} (which you must set)'
+ @echo ' $${CT_PREFIX} (set to ~/x-tools by default)'
help-distrib::
@echo ' check-samples - Verify if samples need updates due to Kconfig changes'
@@ -177,14 +177,7 @@ $(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))
host_triplet = $(if $(findstring $(__comma),$(1)),$(firstword $(subst $(__comma), ,$(1))))
target_triplet = $(if $(findstring $(__comma),$(1)),$(word 2,$(subst $(__comma), ,$(1))),$(1))
@@ -193,16 +186,15 @@ target_triplet = $(if $(findstring $(__comma),$(1)),$(word 2,$(subst $(__comma),
define build_sample
@$(CT_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"$(call prefix_dir,$(1))":;' .config
+ $(SILENT)[ -n "$(CT_PREFIX)" ] && $(sed) -i -r -e 's:^(CT_PREFIX=).*$$:\1"$(CT_PREFIX)":;' .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
- $(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config
- $(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config
$(SILENT)$(CONF) -s --oldconfig $(KCONFIG_TOP)
@$(CT_ECHO) ' BUILD $(1)'
- $(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"; \
+ $(SILENT)h=$(call host_triplet,$(1)); \
+ if [ -n "$${h}" -a -r ".build-all/PASS/$${h}/prefix" ]; then \
+ PATH=`cat .build-all/PASS/$${h}/prefix`/bin:$${PATH}; \
fi; \
if $(MAKE) -rf $(CT_NG) V=0 build; then \
status=PASS; \
@@ -214,7 +206,12 @@ define build_sample
printf '\r %-5s %s\n' $$status '$(1)'; \
mkdir -p .build-all/$$status/$(1); \
bzip2 < build.log > .build-all/$$status/$(1)/build.log.bz2; \
- [ "$$status" = PASS -a -z "$(CT_PRESERVE_PASSED_BUILDS)" ] && rm -rf .build/$(call target_triplet,$(1)) || :
+ if [ "$$status" = PASS ]; then \
+ blddir=`$(bash) $(CT_LIB_DIR)/scripts/showConfig.sh '$${CT_BUILD_TOP_DIR}'`; \
+ [ -z "$(CT_PRESERVE_PASSED_BUILDS)" ] && rm -rf $${blddir}; \
+ $(bash) $(CT_LIB_DIR)/scripts/showConfig.sh '$${CT_PREFIX_DIR}' > .build-all/PASS/$(1)/prefix; \
+ fi; \
+ :
endef
# ----------------------------------------------------------
@@ -224,10 +221,6 @@ endef
ifneq ($(strip $(MAKECMDGOALS)),)
ifneq ($(strip $(filter $(patsubst %,build-%,$(CT_SAMPLES)) build-all,$(MAKECMDGOALS))),)
-ifeq ($(strip $(CT_PREFIX)),)
-$(error Please set 'CT_PREFIX' to where you want to install generated toolchain samples!)
-endif
-
endif # MAKECMDGOALS contains a build sample rule
endif # MAKECMDGOALS != ""