diff options
author | Bryan Hundven <bryanhundven@gmail.com> | 2015-11-04 02:50:05 -0800 |
---|---|---|
committer | Bryan Hundven <bryanhundven@gmail.com> | 2015-11-04 02:50:05 -0800 |
commit | 85f98147f57b3001282fc0365be245b9c81a3a16 (patch) | |
tree | 5f5287226ebc2039b016deff29eea450409c900f /samples | |
parent | 5ffc9ecd10dec73024f8e7f3815c7b2f0851ba56 (diff) | |
parent | b2f8afef8532247c60764fffc938898903c06a4c (diff) | |
download | crosstool-ng-85f98147f57b3001282fc0365be245b9c81a3a16.tar.gz crosstool-ng-85f98147f57b3001282fc0365be245b9c81a3a16.tar.bz2 crosstool-ng-85f98147f57b3001282fc0365be245b9c81a3a16.zip |
Merge pull request #233 from stilor/fix-build-all
Fix build-all
Diffstat (limited to 'samples')
-rw-r--r-- | samples/i686-w64-mingw32,nios2-spico-elf/crosstool.config (renamed from samples/nios2-elf-mingw32/crosstool.config) | 0 | ||||
-rw-r--r-- | samples/i686-w64-mingw32,nios2-spico-elf/reported.by (renamed from samples/nios2-elf-mingw32/reported.by) | 0 | ||||
-rw-r--r-- | samples/samples.mk | 74 |
3 files changed, 60 insertions, 14 deletions
diff --git a/samples/nios2-elf-mingw32/crosstool.config b/samples/i686-w64-mingw32,nios2-spico-elf/crosstool.config index 167df552..167df552 100644 --- a/samples/nios2-elf-mingw32/crosstool.config +++ b/samples/i686-w64-mingw32,nios2-spico-elf/crosstool.config diff --git a/samples/nios2-elf-mingw32/reported.by b/samples/i686-w64-mingw32,nios2-spico-elf/reported.by index c2bc32b9..c2bc32b9 100644 --- a/samples/nios2-elf-mingw32/reported.by +++ b/samples/i686-w64-mingw32,nios2-spico-elf/reported.by diff --git a/samples/samples.mk b/samples/samples.mk index 4545d5c3..c87e5fce 100644 --- a/samples/samples.mk +++ b/samples/samples.mk @@ -117,7 +117,7 @@ $(patsubst %,wiki-%,$(CT_SAMPLES)): config_files PHONY += samples samples: - @$(ECHO) ' MKDIR $@' + @$(CT_ECHO) ' MKDIR $@' $(SILENT)mkdir -p $@ # Save a sample @@ -133,7 +133,7 @@ endef # How we do recall one sample PHONY += $(CT_SAMPLES) $(CT_SAMPLES): config_files - @$(ECHO) " CONF $(KCONFIG_TOP)" + @$(CT_ECHO) " CONF $(KCONFIG_TOP)" $(SILENT)$(CONF) --defconfig=$(call sample_dir,$@)/crosstool.config $(KCONFIG_TOP) @echo @echo '***********************************************************' @@ -164,21 +164,41 @@ $(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)))) + # 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)cp $(call sample_dir,$(1))/crosstool.config .config - $(SILENT)$(sed) -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$(2)":;' .config + @$(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)$(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)$(MAKE) -rf $(CT_NG) V=0 oldconfig - @$(ECHO) ' BUILD $(1)' - $(SILENT)$(MAKE) -rf $(CT_NG) V=0 build + $(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"; \ + fi; \ + if $(MAKE) -rf $(CT_NG) V=0 build; then \ + status=PASS; \ + elif [ -e $(call sample_dir,$(1))/broken ]; then \ + status=XFAIL; \ + else \ + status=FAIL; \ + fi; \ + printf '\r %-5s %s\n' $$status '$(1)'; \ + mkdir -p .build-all/$$status/$(1); \ + bzip2 < build.log > .build-all/$$status/$(1)/build.log.bz2 endef # ---------------------------------------------------------- @@ -196,11 +216,37 @@ endif # MAKECMDGOALS contains a build sample rule endif # MAKECMDGOALS != "" # Build a single sample -$(patsubst %,build-%,$(CT_SAMPLES)): - $(call build_sample,$(patsubst build-%,%,$@),$(CT_PREFIX)/$(patsubst build-%,%,$@)) +$(patsubst %,build-%,$(CT_SAMPLES)): build-%: config_files + $(call build_sample,$*) + +# 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 al samples -build-all: $(patsubst %,build-%,$(CT_SAMPLES)) +# Build all samples; first, build simple cross as canadian configurations may depend on +# build-to-host cross being pre-built. +build-all: build-all-pre $(patsubst %,build-%,$(CT_SAMPLES_CROSS) $(CT_SAMPLES_CANADIAN)) + @echo + @if [ -d .build-all/PASS ]; then \ + echo 'Success:'; \ + (cd .build-all/PASS && ls | sed 's/^/ - /'); \ + echo; \ + fi + @if [ -d .build-all/XFAIL ]; then \ + echo 'Expected failure:'; \ + (cd .build-all/XFAIL && ls | sed 's/^/ - /'); \ + echo; \ + fi + @if [ -d .build-all/FAIL ]; then \ + echo 'Failure:'; \ + (cd .build-all/FAIL && ls | sed 's/^/ - /'); \ + echo; \ + fi + @[ ! -d .build-all/FAIL ] + +build-all-pre: + @rm -rf .build-all # Build all samples, overiding the number of // jobs per sample build-all.%: |