Add the possibility to force the number of // jobs without reconfiguring.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Aug 15 14:59:37 2007 +0000 (2007-08-15)
changeset 333d647d0e6021e
parent 332 44623d725a82
child 334 49b354cfd34d
Add the possibility to force the number of // jobs without reconfiguring.
ct-ng.in
kconfig/kconfig.mk
samples/samples.mk
scripts/crosstool.sh
steps.mk
tools/tools.mk
     1.1 --- a/ct-ng.in	Wed Aug 15 14:35:11 2007 +0000
     1.2 +++ b/ct-ng.in	Wed Aug 15 14:59:37 2007 +0000
     1.3 @@ -41,7 +41,7 @@
     1.4  
     1.5  help-build::
     1.6  	@echo
     1.7 -	@echo  'Build actions:'
     1.8 +	@echo  'Build actions (#: force number of // jobs):'
     1.9  
    1.10  help-clean::
    1.11  	@echo
    1.12 @@ -65,32 +65,39 @@
    1.13  # End help system
    1.14  
    1.15  help-build::
    1.16 -	@echo  '  build          - Build the toolchain'
    1.17 +	@echo  '  build[.#]          - Build the toolchain'
    1.18  
    1.19  help-clean::
    1.20 -	@echo  '  clean          - Remove generated files'
    1.21 -	@echo  '  distclean      - Remove generated files, configuration and build directories'
    1.22 +	@echo  '  clean              - Remove generated files'
    1.23 +	@echo  '  distclean          - Remove generated files, configuration and build directories'
    1.24  
    1.25  include $(CT_LIB_DIR)/kconfig/kconfig.mk
    1.26 +include $(CT_LIB_DIR)/steps.mk
    1.27  include $(CT_LIB_DIR)/samples/samples.mk
    1.28  include $(CT_LIB_DIR)/tools/tools.mk
    1.29 -include $(CT_LIB_DIR)/steps.mk
    1.30  
    1.31  help-distrib::
    1.32 -	@echo  '  tarball        - Build a tarball of the configured toolchain'
    1.33 +	@echo  '  tarball            - Build a tarball of the configured toolchain'
    1.34  
    1.35  help-env::
    1.36 -	@echo  '  STOP           - Stop the build just after this step'
    1.37 -	@echo  '  RESTART        - Restart the build just before this step'
    1.38 +	@echo  '  STOP               - Stop the build just after this step'
    1.39 +	@echo  '  RESTART            - Restart the build just before this step'
    1.40  
    1.41  .config:
    1.42  	@echo  'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
    1.43  	@false
    1.44  
    1.45  # Actual build
    1.46 +ifeq ($(CT_JOBS),)
    1.47 +CT_JOBS:=1
    1.48 +endif
    1.49 +export CT_JOBS
    1.50  build:: .config
    1.51  	@$(CT_LIB_DIR)/scripts/crosstool.sh
    1.52  
    1.53 +build.%::
    1.54 +	@$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
    1.55 +
    1.56  PHONY += tarball
    1.57  #tarball:
    1.58  #	@$(CT_LIB_DIR)/scripts/tarball.sh
     2.1 --- a/kconfig/kconfig.mk	Wed Aug 15 14:35:11 2007 +0000
     2.2 +++ b/kconfig/kconfig.mk	Wed Aug 15 14:59:37 2007 +0000
     2.3 @@ -74,11 +74,11 @@
     2.4  
     2.5  # Help text used by make help
     2.6  help-config::
     2.7 -	@echo  '  config         - Update current config using a line-oriented program'
     2.8 -	@echo  '  menuconfig     - Update current config using a menu based program'
     2.9 -	@echo  '  oldconfig      - Update current config using a provided .config as base'
    2.10 -	@echo  '  extractconfig  - Create a new config using options extracted from a'
    2.11 -	@echo  '                   build log piped into stdin'
    2.12 +	@echo  '  config             - Update current config using a line-oriented program'
    2.13 +	@echo  '  menuconfig         - Update current config using a menu based program'
    2.14 +	@echo  '  oldconfig          - Update current config using a provided .config as base'
    2.15 +	@echo  '  extractconfig      - Create a new config using options extracted from a'
    2.16 +	@echo  '                       build log piped into stdin'
    2.17  
    2.18  # Cheesy build
    2.19  
     3.1 --- a/samples/samples.mk	Wed Aug 15 14:35:11 2007 +0000
     3.2 +++ b/samples/samples.mk	Wed Aug 15 14:59:37 2007 +0000
     3.3 @@ -7,15 +7,15 @@
     3.4  CT_SAMPLES := $(CT_TOP_SAMPLES) $(CT_LIB_SAMPLES)
     3.5  
     3.6  help-config::
     3.7 -	@echo  '  saveconfig     - Save current config as a preconfigured target'
     3.8 +	@echo  '  saveconfig         - Save current config as a preconfigured target'
     3.9  
    3.10  help-samples::
    3.11  	@$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
    3.12  
    3.13  help-build::
    3.14 -	@echo  '  regtest        - Regtest-build all samples'
    3.15 -	@echo  '  regtest-local  - Regtest-build all local samples'
    3.16 -	@echo  '  regtest-global - Regtest-build all global samples'
    3.17 +	@echo  '  regtest[.#]        - Regtest-build all samples'
    3.18 +	@echo  '  regtest-local[.#]  - Regtest-build all local samples'
    3.19 +	@echo  '  regtest-global[.#] - Regtest-build all global samples'
    3.20  
    3.21  # How we do build one sample
    3.22  PHONY += $(CT_SAMPLES)
    3.23 @@ -39,6 +39,9 @@
    3.24  
    3.25  regtest-global: $(patsubst %,regtest_%,$(CT_LIB_SAMPLES))
    3.26  
    3.27 +regtest.% regtest-local.% regtest-global.%:
    3.28 +	@$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
    3.29 +
    3.30  # One regtest per sample
    3.31  # We could use a simple rule like: 'regtest: $(CT_SAMPLES)', but that doesn't
    3.32  # work because we want to save the samples as well.
     4.1 --- a/scripts/crosstool.sh	Wed Aug 15 14:35:11 2007 +0000
     4.2 +++ b/scripts/crosstool.sh	Wed Aug 15 14:59:37 2007 +0000
     4.3 @@ -319,6 +319,9 @@
     4.4      CT_CFLAGS_FOR_HOST=
     4.5      [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST="${CT_CFLAGS_FOR_HOST} -pipe"
     4.6  
     4.7 +    # Override the configured jobs with what's been given on the command line
     4.8 +    [ -n "${CT_JOBS}" ] && CT_PARALLEL_JOBS="${CT_JOBS}"
     4.9 +
    4.10      # And help make go faster
    4.11      PARALLELMFLAGS=
    4.12      [ ${CT_PARALLEL_JOBS} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -j${CT_PARALLEL_JOBS}"
     5.1 --- a/steps.mk	Wed Aug 15 14:35:11 2007 +0000
     5.2 +++ b/steps.mk	Wed Aug 15 14:59:37 2007 +0000
     5.3 @@ -25,7 +25,7 @@
     5.4  	@$(CT_NG) RESTART=$(patsubst %+,%,$@) build
     5.5  
     5.6  help-build::
     5.7 -	@echo  '  liststeps      - List all build steps'
     5.8 +	@echo  '  liststeps          - List all build steps'
     5.9  
    5.10  liststeps:
    5.11  	@echo  'Available build steps, in order:'
     6.1 --- a/tools/tools.mk	Wed Aug 15 14:35:11 2007 +0000
     6.2 +++ b/tools/tools.mk	Wed Aug 15 14:59:37 2007 +0000
     6.3 @@ -25,7 +25,7 @@
     6.4  	@chmod u+rwx,go+rx-w $@
     6.5  
     6.6  help-distrib::
     6.7 -	@echo  '  updatetools    - Update the config tools'
     6.8 +	@echo  '  updatetools        - Update the config tools'
     6.9  
    6.10  distclean::
    6.11  	@[ $(CT_TOP_DIR) = $(CT_LIB_DIR) ] || rm -rf $(CT_TOP_DIR)/tools