From 319023c7afc4a48593240db4afe58ac57c4cc4a6 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 30 Oct 2015 01:04:39 -0700 Subject: Implement 'ct-ng source'. Provides a simpler alternative to editing config to enable CT_ONLY_DOWNLOAD, doing ct-ng build and then restoring .config. Signed-off-by: Alexey Neyman diff --git a/ct-ng.in b/ct-ng.in index 8a407ba..036f534 100644 --- a/ct-ng.in +++ b/ct-ng.in @@ -104,6 +104,7 @@ help-tail:: @echo 'See "man 1 $(notdir $(CT_NG))" for some help as well' help-build:: + @echo ' source - Download sources for currently configured toolchain' @echo ' build[.#] - Build the currently configured toolchain' help-clean:: @@ -143,6 +144,9 @@ show-tuple: .config.2 $(SILENT)$(bash) $(CT_LIB_DIR)/scripts/showTuple.sh # Actual build +source: .config.2 + $(SILENT)CT_SOURCE=y $(CT_LIB_DIR)/scripts/crosstool-NG.sh + build: .config.2 $(SILENT)$(CT_LIB_DIR)/scripts/crosstool-NG.sh diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index ab654da..e29dea5 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -524,6 +524,9 @@ if [ -z "${CT_RESTART}" ]; then [ ${CT_PARALLEL_JOBS} -gt 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${CT_PARALLEL_JOBS}" JOBSFLAGS="${JOBSFLAGS} -l${CT_LOAD}" + # Override 'download only' option + [ -n "${CT_SOURCE}" ] && CT_ONLY_DOWNLOAD=y + # Now that we've set up $PATH and $CT_CFLAGS_FOR_HOST, sanity test that gcc # is runnable so that the user can troubleshoot problems if not. CT_DoStep DEBUG "Checking that we can run gcc -v" -- cgit v0.10.2-6-g49f6 From 263e8026eca666e09516764f6535da518f36fcb9 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 30 Oct 2015 10:32:16 -0700 Subject: Change sed monstrosity into a make variable. The convoluted sed expression was doing what is already available in make as `$*'. Signed-off-by: Alexey Neyman diff --git a/ct-ng.in b/ct-ng.in index 036f534..6450aab 100644 --- a/ct-ng.in +++ b/ct-ng.in @@ -151,7 +151,7 @@ build: .config.2 $(SILENT)$(CT_LIB_DIR)/scripts/crosstool-NG.sh build.%: - $(SILENT)$(MAKE) -rf $(CT_NG) $(shell echo "$(@)" |$(sed) -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;') + $(SILENT)$(MAKE) -rf $(CT_NG) build CT_JOBS=$* PHONY += version version: diff --git a/samples/samples.mk b/samples/samples.mk index e154e5c..4545d5c 100644 --- a/samples/samples.mk +++ b/samples/samples.mk @@ -204,5 +204,5 @@ build-all: $(patsubst %,build-%,$(CT_SAMPLES)) # Build all samples, overiding the number of // jobs per sample build-all.%: - $(SILENT)$(MAKE) -rf $(CT_NG) V=$(V) $(shell echo "$(@)" |$(sed) -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;') + $(SILENT)$(MAKE) -rf $(CT_NG) build-all CT_JOBS=$* -- cgit v0.10.2-6-g49f6 From f849505ac94a3f616fc3af243f50be42409335ca Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 30 Oct 2015 13:53:53 -0700 Subject: Sanity check for number of parallel jobs. Signed-off-by: Alexey Neyman diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index e29dea5..a3514cb 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -516,7 +516,12 @@ if [ -z "${CT_RESTART}" ]; then # And help make go faster JOBSFLAGS= # Override the configured jobs with what's been given on the command line - [ -n "${CT_JOBS}" ] && CT_PARALLEL_JOBS="${CT_JOBS}" + if [ -n "${CT_JOBS}" ]; then + if [ ! -z "`echo "${CT_JOBS}" | sed 's/[0-9]//g'`" ]; then + CT_Abort "Number of parallel jobs must be integer." + fi + CT_PARALLEL_JOBS="${CT_JOBS}" + fi # Use the number of processors+1 when automatically setting the number of # parallel jobs. Fall back to 1 if the host doesn't use GLIBC. AUTO_JOBS=$((`getconf _NPROCESSORS_ONLN 2> /dev/null || echo 0` + 1)) -- cgit v0.10.2-6-g49f6