Add the possibility to stop after a specified step.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri May 25 19:30:42 2007 +0000 (2007-05-25)
changeset 135b2695c2f1919
parent 134 256614d8ef44
child 136 22b5ef41df97
Add the possibility to stop after a specified step.
Update the Makefile help and the documentation accordingly.
Makefile
docs/overview.txt
scripts/crosstool.sh
scripts/functions
     1.1 --- a/Makefile	Thu May 24 19:00:26 2007 +0000
     1.2 +++ b/Makefile	Fri May 25 19:30:42 2007 +0000
     1.3 @@ -9,6 +9,7 @@
     1.4  # This is crosstool-ng version string
     1.5  export CT_VERSION=$(shell cat $(CT_TOP_DIR)/version)
     1.6  
     1.7 +export CT_STOP=$(STOP)
     1.8  export CT_RESTART=$(RESTART)
     1.9  
    1.10  .PHONY: all
    1.11 @@ -35,8 +36,11 @@
    1.12  	@echo  'Distribution targets:'
    1.13  	@echo  '  tarball        - Build a tarball of the configured toolchain'
    1.14  	@echo
    1.15 +	@echo  'Environement variables:'
    1.16 +	@echo  '  STOP           - Stop the build just after this step'
    1.17 +	@echo  '  RESTART        - Restart the build just before this step'
    1.18 +	@echo
    1.19  	@echo  'Execute "make" or "make all" to build all targets marked with [*]'
    1.20 -	@echo  'Pass RESTART=<step> to restart a previously saved step (read doc first!)'
    1.21  
    1.22  .config: $(CONFIG_FILES) $(CT_TOP_DIR)/config/debug.in
    1.23  	@make oldconfig
     2.1 --- a/docs/overview.txt	Thu May 24 19:00:26 2007 +0000
     2.2 +++ b/docs/overview.txt	Fri May 25 19:30:42 2007 +0000
     2.3 @@ -95,13 +95,46 @@
     2.4  will support, the version of the components you want to use, etc... The
     2.5  value for those options are then stored in a configuration file.
     2.6  
     2.7 -You then simply run make. It will use this configuration file to retrieve,
     2.8 -extract and patch the components, build, install and test your newly built
     2.9 -toolchain.
    2.10 +To enter the menu, type:
    2.11 +  make menuconfig
    2.12 +
    2.13 +To build the so-configured target, simply type:
    2.14 +  make
    2.15 +
    2.16 +This will use the above configuration to retrieve, extract and patch the
    2.17 +components, build, install and eventually test your newly built toolchain.
    2.18  
    2.19  You are then free to add the toolchain /bin directory in your PATH to use
    2.20  it at will.
    2.21  
    2.22 +In any case, you can get some terse help. Just type:
    2.23 +  make help
    2.24 +
    2.25 +
    2.26 +Stoping and restarting a build |
    2.27 +-------------------------------*
    2.28 +
    2.29 +If you want to stop the build after a step you are debugging, you can pass the
    2.30 +variable STOP to make:
    2.31 +  make STOP=some_step
    2.32 +
    2.33 +Conversely, if you want to restart a build at a specific step you are
    2.34 +debugging, you can pass the RESTART variable to make:
    2.35 +  make RESTART=some_step
    2.36 +
    2.37 +The list of steps is, in order of appearence in the build process:
    2.38 +  - libc_check_config
    2.39 +  - kernel_check_config
    2.40 +  - kernel_headers
    2.41 +  - binutils
    2.42 +  - libc_headers
    2.43 +  - cc_core
    2.44 +  - libfloat
    2.45 +  - libc
    2.46 +  - cc
    2.47 +  - libc_finish
    2.48 +  - debug
    2.49 +
    2.50  ____________________________
    2.51                             /
    2.52  Configuring crosstool-NG  /
    2.53 @@ -135,6 +168,7 @@
    2.54    The version of crosstool-NG you are using. Not much help for you, but it's
    2.55    there if you need it.
    2.56  
    2.57 +
    2.58  Interesting config options |
    2.59  ---------------------------*
    2.60  
     3.1 --- a/scripts/crosstool.sh	Thu May 24 19:00:26 2007 +0000
     3.2 +++ b/scripts/crosstool.sh	Fri May 25 19:30:42 2007 +0000
     3.3 @@ -410,6 +410,10 @@
     3.4          fi
     3.5          if [ ${do_it} -eq 1 ]; then
     3.6              do_${step}
     3.7 +            if [ "${CT_STOP}" = "${step}" ]; then
     3.8 +                CT_DoLog ERROR "Stopping just after step \"${step}\", as requested."
     3.9 +                exit 0
    3.10 +            fi
    3.11              if [ "${CTDEBUG_CT_PAUSE_STEPS}" = "y" ]; then
    3.12                  CT_DoPause "Step \"${step}\" finished"
    3.13              fi
     4.1 --- a/scripts/functions	Thu May 24 19:00:26 2007 +0000
     4.2 +++ b/scripts/functions	Fri May 25 19:30:42 2007 +0000
     4.3 @@ -519,12 +519,14 @@
     4.4  CT_DoLoadState(){
     4.5      local state_name="$1"
     4.6      local state_dir="${CT_STATE_DIR}/${state_name}"
     4.7 +    local old_RESTART="${CT_RESTART}"
     4.8 +    local old_STOP="${CT_STOP}"
     4.9  
    4.10      # We need to do something special with the log file!
    4.11      if [ "${CT_LOG_TO_FILE}" = "y" ]; then
    4.12          exec >"${state_dir}/tail.log"
    4.13      fi
    4.14 -    CT_DoLog DEBUG "Restoring state at step \"${state_name}\"..."
    4.15 +    CT_DoLog INFO "Restoring state at step \"${state_name}\", as requested."
    4.16  
    4.17      case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
    4.18          y)  tar_opt=xzf; tar_ext=".tar.gz";;
    4.19 @@ -551,6 +553,11 @@
    4.20      CT_DoLog DEBUG "  Restoring environment"
    4.21      . "${state_dir}/env.sh" >/dev/null 2>&1 || true
    4.22  
    4.23 +    # Restore the new RESTART and STOP steps
    4.24 +    CT_RESTART="${old_RESTART}"
    4.25 +    CT_STOP="${old_STOP}"
    4.26 +    unset old_stop old_restart
    4.27 +
    4.28      if [ "${CT_LOG_TO_FILE}" = "y" ]; then
    4.29          CT_DoLog DEBUG "  Restoring log file"
    4.30          exec >/dev/null