diff options
author | Alexey Neyman <stilor@att.net> | 2016-12-14 00:59:08 -0800 |
---|---|---|
committer | Alexey Neyman <stilor@att.net> | 2017-01-19 18:08:29 -0800 |
commit | 832bee87c03ce2fecdbf8b00996fc1fca8f2b2e0 (patch) | |
tree | 73691e8beb7531585f5b323affd8a93a207f378c /samples/samples.mk | |
parent | 7fad3936351bc145630ec882a92063153d601d4d (diff) | |
download | crosstool-ng-832bee87c03ce2fecdbf8b00996fc1fca8f2b2e0.tar.gz crosstool-ng-832bee87c03ce2fecdbf8b00996fc1fca8f2b2e0.tar.bz2 crosstool-ng-832bee87c03ce2fecdbf8b00996fc1fca8f2b2e0.zip |
Make build-all rely on kconfig options.
For that, make CT_BUILD_TOP_DIR a non-settable config option (so that it is
recursively expanded with CT_HOST/CT_TARGET). Use a common prefix, with
same default as for regular sample build.
Use showConfig.sh to determine host toolchain path (for canadian crosses)
and build directory to be removed.
Remove LIBC_SYSROOT_ARG (unused).
Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'samples/samples.mk')
-rw-r--r-- | samples/samples.mk | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/samples/samples.mk b/samples/samples.mk index bf51135f..5c8f130e 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 != "" |