From 3b9efc95a2e0e923f34a857c06b45596beb23552 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 6 Jan 2020 00:29:59 +0800 Subject: [PATCH] Format all shell scripts in tools folder Change-Id: Ieef2eb93d56c03972b4dc63a1c55aabf1fb0d169 Signed-off-by: Xiang Xiao --- tools/configure.bat | 6 +- tools/configure.sh | 154 +++++++++--------- tools/copydir.bat | 4 +- tools/copydir.sh | 41 +++-- tools/define.bat | 18 +-- tools/define.sh | 230 +++++++++++++------------- tools/incdir.bat | 22 +-- tools/incdir.sh | 224 +++++++++++++------------- tools/indent.sh | 132 +++++++-------- tools/kconfig.bat | 11 +- tools/link.bat | 8 +- tools/link.sh | 65 ++++---- tools/mkconfigvars.sh | 66 ++++---- tools/mkctags.sh | 2 +- tools/mkexport.sh | 336 +++++++++++++++++++------------------- tools/mkromfsimg.sh | 104 ++++++------ tools/refresh.sh | 96 +++++------ tools/sethost.sh | 232 +++++++++++++-------------- tools/testbuild.sh | 364 +++++++++++++++++++++--------------------- tools/unlink.bat | 2 +- tools/unlink.sh | 34 ++-- tools/version.sh | 116 +++++++------- tools/zipme.sh | 151 +++++++++--------- 23 files changed, 1205 insertions(+), 1213 deletions(-) diff --git a/tools/configure.bat b/tools/configure.bat index 23096bafb9..64f0fc1a44 100755 --- a/tools/configure.bat +++ b/tools/configure.bat @@ -115,10 +115,10 @@ echo -f: echo Informs the tool that it should use POSIX style paths like /usr/local/bin. echo By default, Windows style paths like C:\\Program Files are used. echo -l selects the Linux (l) host environment. The [-c^|u^|n] options -echo select one of the Windows environments. Default: Use host setup -echo in the defconfig file +echo select one of the Windows environments. Default: Use host setup +echo in the defconfig file echo [-c^|u^|n] selects the Windows host and a Windows environment: Cygwin (c), -echo Ubuntu under Windows 10 (u), or Windows native (n). Default Cygwin +echo Ubuntu under Windows 10 (u), or Windows native (n). Default Cygwin echo -a ^: echo Informs the configuration tool where the application build echo directory. This is a relative path from the top-level NuttX diff --git a/tools/configure.sh b/tools/configure.sh index 321e08787e..b91b3915cb 100755 --- a/tools/configure.sh +++ b/tools/configure.sh @@ -75,52 +75,52 @@ skip=0 while [ ! -z "$1" ]; do case "$1" in - -a ) - shift - appdir=$1 - ;; - -c ) - host=windows - wenv=cygwin - ;; - -d ) - debug=y - set -x - ;; - -g ) - host=windows - wenv=msys - ;; - -h ) + -a ) + shift + appdir=$1 + ;; + -c ) + host=windows + wenv=cygwin + ;; + -d ) + debug=y + set -x + ;; + -g ) + host=windows + wenv=msys + ;; + -h ) + echo "$USAGE" + exit 0 + ;; + -l ) + host=linux + ;; + -m ) + host=macos + ;; + -n ) + host=windows + wenv=native + ;; + -s ) + skip=1 + ;; + -u ) + host=windows + wenv=ubuntu + ;; + *) + if [ ! -z "${boardconfig}" ]; then + echo "" + echo " defined twice" echo "$USAGE" - exit 0 - ;; - -l ) - host=linux - ;; - -m ) - host=macos - ;; - -n ) - host=windows - wenv=native - ;; - -s ) - skip=1 - ;; - -u ) - host=windows - wenv=ubuntu - ;; - *) - if [ ! -z "${boardconfig}" ]; then - echo "" - echo " defined twice" - echo "$USAGE" - exit 1 - fi - boardconfig=$1 - ;; + exit 1 + fi + boardconfig=$1 + ;; esac shift done @@ -330,43 +330,43 @@ if [ ! -z "$host" ]; then sed -i -e "/CONFIG_SIM_X8664_SYSTEMV/d" ${dest_config} case "$host" in - "linux") - echo " Select CONFIG_HOST_LINUX=y" - echo "CONFIG_HOST_LINUX=y" >> "${dest_config}" - echo "CONFIG_SIM_X8664_SYSTEMV=y" >> "${dest_config}" + "linux") + echo " Select CONFIG_HOST_LINUX=y" + echo "CONFIG_HOST_LINUX=y" >> "${dest_config}" + echo "CONFIG_SIM_X8664_SYSTEMV=y" >> "${dest_config}" + ;; + + "macos") + echo " Select CONFIG_HOST_MACOS=y" + echo "CONFIG_HOST_MACOS=y" >> "${dest_config}" + ;; + + "windows") + echo " Select CONFIG_HOST_WINDOWS=y" + echo "CONFIG_HOST_WINDOWS=y" >> "${dest_config}" + echo "CONFIG_SIM_X8664_MICROSOFT=y" >> "${dest_config}" + + case "$wenv" in + "cygwin") + echo " Select CONFIG_WINDOWS_CYGWIN=y" + echo "CONFIG_WINDOWS_CYGWIN=y" >> "${dest_config}" ;; - "macos") - echo " Select CONFIG_HOST_MACOS=y" - echo "CONFIG_HOST_MACOS=y" >> "${dest_config}" + "msys") + echo " Select CONFIG_WINDOWS_MSYS=y" + echo "CONFIG_WINDOWS_MSYS=y" >> "${dest_config}" ;; - "windows") - echo " Select CONFIG_HOST_WINDOWS=y" - echo "CONFIG_HOST_WINDOWS=y" >> "${dest_config}" - echo "CONFIG_SIM_X8664_MICROSOFT=y" >> "${dest_config}" + "ubuntu") + echo " Select CONFIG_WINDOWS_UBUNTU=y" + echo "CONFIG_WINDOWS_UBUNTU=y" >> "${dest_config}" + ;; - case "$wenv" in - "cygwin") - echo " Select CONFIG_WINDOWS_CYGWIN=y" - echo "CONFIG_WINDOWS_CYGWIN=y" >> "${dest_config}" - ;; - - "msys") - echo " Select CONFIG_WINDOWS_MSYS=y" - echo "CONFIG_WINDOWS_MSYS=y" >> "${dest_config}" - ;; - - "ubuntu") - echo " Select CONFIG_WINDOWS_UBUNTU=y" - echo "CONFIG_WINDOWS_UBUNTU=y" >> "${dest_config}" - ;; - - *) - echo " Select CONFIG_WINDOWS_NATIVE=y" - echo "CONFIG_WINDOWS_NATIVE=y" >> "${dest_config}" - ;; - esac + *) + echo " Select CONFIG_WINDOWS_NATIVE=y" + echo "CONFIG_WINDOWS_NATIVE=y" >> "${dest_config}" + ;; + esac esac fi diff --git a/tools/copydir.bat b/tools/copydir.bat index 2857c415f0..8f82431342 100755 --- a/tools/copydir.bat +++ b/tools/copydir.bat @@ -96,7 +96,7 @@ goto :End :ShowUsage echo USAGE: %0 ^ ^ echo Where: -echo ^ is the source directory to be copied -echo ^ is the destination directory to be created +echo ^ is the source directory to be copied +echo ^ is the destination directory to be created :End diff --git a/tools/copydir.sh b/tools/copydir.sh index d3dca213f2..01ce3831b5 100755 --- a/tools/copydir.sh +++ b/tools/copydir.sh @@ -52,8 +52,8 @@ dest=$2 # Verify that arguments were provided if [ -z "${src}" -o -z "${dest}" ]; then - echo "Missing src and/or dest arguments" - exit 1 + echo "Missing src and/or dest arguments" + exit 1 fi # Check if something already exists at the destination path replace it with @@ -62,40 +62,39 @@ fi # report that it does not exist. if [ -h "${dest}" ]; then - rm -f "${dest}" + rm -f "${dest}" else - # If the path exists and is a directory that contains the "fake link" - # mark, then treat it like a soft link (i.e., remove the directory) + # If the path exists and is a directory that contains the "fake link" + # mark, then treat it like a soft link (i.e., remove the directory) - if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then - rm -rf "${dest}" - else + if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then + rm -rf "${dest}" + else - # Does anything exist at the destination path? + # Does anything exist at the destination path? - if [ -e "${dest}" ]; then + if [ -e "${dest}" ]; then - # It is something else (like a file) or directory that does - # not contain the "fake link" mark + # It is something else (like a file) or directory that does + # not contain the "fake link" mark - echo "${dest} already exists but is not a symbolic link" - exit 1 - fi - fi + echo "${dest} already exists but is not a symbolic link" + exit 1 + fi + fi fi # Verify that a directory exists at the source path if [ ! -d "${src}" ]; then - echo "No directory at ${src}" - exit 1 + echo "No directory at ${src}" + exit 1 fi # Copy the directory cp -a "${src}" "${dest}" || \ - { echo "Failed to create link: $dest" ; rm -rf ${dest} ; exit 1 ; } + { echo "Failed to create link: $dest" ; rm -rf ${dest} ; exit 1 ; } touch "${dest}/.fakelnk" || \ - { echo "Failed to touch ${dest}/.fakelnk" ; rm -rf ${dest} ; exit 1 ; } - + { echo "Failed to touch ${dest}/.fakelnk" ; rm -rf ${dest} ; exit 1 ; } diff --git a/tools/define.bat b/tools/define.bat index 13d29ac319..df7bc26684 100755 --- a/tools/define.bat +++ b/tools/define.bat @@ -165,14 +165,14 @@ echo definitions arguments for a variety of diffent ccpaths in a variety of echo compilation environments" echo USAGE:%progname% [-h] ^ [-val ^<^val1^>] [^ [-val ^] [^ [-val ^] ...]] echo Where:" -echo ^ -echo The full path to your ccpath -echo ^ ^ ^ ... -echo A list of pre-preprocesser variable names to be defined. -echo [-val ^] [-val ^] [-val ^] ... -echo optional values to be assigned to each pre-processor variable. -echo If not supplied, the variable will be defined with no explicit value. -echo -h -echo Show this text and exit +echo ^ +echo The full path to your ccpath +echo ^ ^ ^ ... +echo A list of pre-preprocesser variable names to be defined. +echo [-val ^] [-val ^] [-val ^] ... +echo optional values to be assigned to each pre-processor variable. +echo If not supplied, the variable will be defined with no explicit value. +echo -h +echo Show this text and exit :End diff --git a/tools/define.sh b/tools/define.sh index a7d5dcf3ca..e927d2c5b4 100755 --- a/tools/define.sh +++ b/tools/define.sh @@ -42,39 +42,39 @@ usage="USAGE: $progname [-w] [-d] [-h] [=val1] [[=va advice="Try '$progname -h' for more information" while [ ! -z "$1" ]; do - case $1 in - -d ) - set -x - ;; - -w ) - wintool=y - ;; - -h ) - echo "$progname is a tool for flexible generation of command line pre-processor" - echo "definitions arguments for a variety of diffent compilers in a variety of" - echo "compilation environments" - echo "" - echo $usage - echo "" - echo "Where:" - echo " " - echo " The full path to your compiler" - echo " [ ..." - echo " A list of pre-preprocesser variable names to be defined." - echo " [=val1] [=val2] [=val3]" - echo " optional values to be assigned to each pre-processor variable." - echo " If not supplied, the variable will be defined with no explicit value." - echo " -w" - echo " The compiler is a Windows native tool and requires Windows" - echo " style pathnames like C:\\Program Files" - echo " -d" - echo " Enable script debug" - ;; - * ) - break; - ;; - esac - shift + case $1 in + -d ) + set -x + ;; + -w ) + wintool=y + ;; + -h ) + echo "$progname is a tool for flexible generation of command line pre-processor" + echo "definitions arguments for a variety of diffent compilers in a variety of" + echo "compilation environments" + echo "" + echo $usage + echo "" + echo "Where:" + echo " " + echo " The full path to your compiler" + echo " [ ..." + echo " A list of pre-preprocesser variable names to be defined." + echo " [=val1] [=val2] [=val3]" + echo " optional values to be assigned to each pre-processor variable." + echo " If not supplied, the variable will be defined with no explicit value." + echo " -w" + echo " The compiler is a Windows native tool and requires Windows" + echo " style pathnames like C:\\Program Files" + echo " -d" + echo " Enable script debug" + ;; + * ) + break; + ;; + esac + shift done ccpath=$1 @@ -82,17 +82,17 @@ shift varlist=$@ if [ -z "$ccpath" ]; then - echo "Missing compiler path" - echo $usage - echo $advice - exit 1 + echo "Missing compiler path" + echo $usage + echo $advice + exit 1 fi if [ -z "$varlist" ]; then - echo "Missing definition list" - echo $usage - echo $advice - exit 1 + echo "Missing definition list" + echo $usage + echo $advice + exit 1 fi # @@ -121,37 +121,37 @@ gcc=`echo $ccpath | grep gcc` sdcc=`echo $ccpath | grep sdcc` if [ "X$os" = "XCygwin" ]; then - # - # We can treat Cygwin native toolchains just like Linux native - # toolchains in the Linux. Let's assume: - # 1. GCC or SDCC are the only possible Cygwin native compilers - # 2. If this is a Window native GCC version, then -w provided - # on the command line (wintool=y) + # + # We can treat Cygwin native toolchains just like Linux native + # toolchains in the Linux. Let's assume: + # 1. GCC or SDCC are the only possible Cygwin native compilers + # 2. If this is a Window native GCC version, then -w provided + # on the command line (wintool=y) - if [ -z "$gcc" -a -z "$sdcc" ]; then - # - # Not GCC or SDCC, must be Windows native - # - compiler=`cygpath -u "$ccpath"` - else - if [ "X$wintool" == "Xy" ]; then - # - # It is a native GCC or SDCC compiler - # - compiler=`cygpath -u "$ccpath"` - else - # - # GCC or SDCC and not for Windows - # - compiler="$ccpath" - fi - fi + if [ -z "$gcc" -a -z "$sdcc" ]; then + # + # Not GCC or SDCC, must be Windows native + # + compiler=`cygpath -u "$ccpath"` + else + if [ "X$wintool" == "Xy" ]; then + # + # It is a native GCC or SDCC compiler + # + compiler=`cygpath -u "$ccpath"` + else + # + # GCC or SDCC and not for Windows + # + compiler="$ccpath" + fi + fi else - # - # Otherwise, we must be in a Linux environment where there are - # only Linux native toolchains - # - compiler="$ccpath" + # + # Otherwise, we must be in a Linux environment where there are + # only Linux native toolchains + # + compiler="$ccpath" fi exefile=`basename "$compiler"` @@ -159,9 +159,9 @@ exefile=`basename "$compiler"` # a special output format as well as special paths if [ "X$exefile" = "Xez8cc.exe" -o "X$exefile" = "Xzneocc.exe" -o "X$exefile" = "Xez80cc.exe" ]; then - fmt=define + fmt=define else - fmt=std + fmt=std fi # Now process each definition in the definition list @@ -169,60 +169,58 @@ fi unset response for vardef in $varlist; do - varname=`echo $vardef | cut -d'=' -f1` - if [ "X$varname" != "X$vardef" ]; then - varvalue=`echo $vardef | cut -d'=' -f2` - else - unset varvalue - fi + varname=`echo $vardef | cut -d'=' -f1` + if [ "X$varname" != "X$vardef" ]; then + varvalue=`echo $vardef | cut -d'=' -f2` + else + unset varvalue + fi - # Handle the output depending on if there is a value for the variable or not + # Handle the output depending on if there is a value for the variable or not - if [ -z "$varvalue" ]; then + if [ -z "$varvalue" ]; then - # Handle the output using the selected format + # Handle the output using the selected format - if [ "X$fmt" = "Xdefine" ]; then - # Treat the first definition differently + if [ "X$fmt" = "Xdefine" ]; then + # Treat the first definition differently - if [ -z "$response" ]; then - response="-define:"$varname - else - response=$response" -define:$varname" - fi - else - # Treat the first definition differently + if [ -z "$response" ]; then + response="-define:"$varname + else + response=$response" -define:$varname" + fi + else + # Treat the first definition differently - if [ -z "$response" ]; then - response=-D$varname - else - response=$response" -D$varname" - fi - fi - else + if [ -z "$response" ]; then + response=-D$varname + else + response=$response" -D$varname" + fi + fi + else - # Handle the output using the selected format + # Handle the output using the selected format - if [ "X$fmt" = "Xdefine" ]; then - # Treat the first definition differently + if [ "X$fmt" = "Xdefine" ]; then + # Treat the first definition differently - if [ -z "$response" ]; then - response="-define:"$varname=$varvalue - else - response=$response" -define:$varname=$varvalue" - fi - else - # Treat the first definition differently + if [ -z "$response" ]; then + response="-define:"$varname=$varvalue + else + response=$response" -define:$varname=$varvalue" + fi + else + # Treat the first definition differently - if [ -z "$response" ]; then - response=-D$varname=$varvalue - else - response=$response" -D$varname=$varvalue" - fi - fi - fi + if [ -z "$response" ]; then + response=-D$varname=$varvalue + else + response=$response" -D$varname=$varvalue" + fi + fi + fi done echo $response - - diff --git a/tools/incdir.bat b/tools/incdir.bat index f7383fc9a5..81b5c6ef2e 100755 --- a/tools/incdir.bat +++ b/tools/incdir.bat @@ -151,15 +151,15 @@ echo %progname% is a tool for flexible generation of include path arguments for echo variety of different compilers in a variety of compilation environments echo USAGE: %progname% [-w] [-d] [-s] [-h] ^ ^ [^ [^ ...]] echo Where: -echo ^ -echo The full path to your compiler -echo ^ [^ [^ ...]] -echo A list of include directories -echo -w, -d -echo For compatibility with incdir.sh (ignored) -echo -s -echo Generate standard, system header file paths instead of normal user -echo header file paths. -echo -h -echo Shows this help text and exits. +echo ^ +echo The full path to your compiler +echo ^ [^ [^ ...]] +echo A list of include directories +echo -w, -d +echo For compatibility with incdir.sh (ignored) +echo -s +echo Generate standard, system header file paths instead of normal user +echo header file paths. +echo -h +echo Shows this help text and exits. :End diff --git a/tools/incdir.sh b/tools/incdir.sh index 3c3d487b60..d486a1f23f 100755 --- a/tools/incdir.sh +++ b/tools/incdir.sh @@ -41,44 +41,44 @@ usage="USAGE: $progname [-w] [-d] [-h] [ [ .. advice="Try '$progname -h' for more information" while [ ! -z "$1" ]; do - case $1 in - -d ) - set -x - ;; - -w ) - wintool=y - ;; - -s ) - pathtype=system - ;; - -h ) - echo "$progname is a tool for flexible generation of include path arguments for a" - echo "variety of different compilers in a variety of compilation environments" - echo "" - echo $usage - echo "" - echo "Where:" - echo " " - echo " The full path to your compiler" - echo " [ [ ...]]" - echo " A list of include directories" - echo " -w" - echo " The compiler is a Windows native tool and requires Windows" - echo " style pathnames like C:\\Program Files" - echo " -s" - echo " Generate standard, system header file paths instead of normal user" - echo " header file paths." - echo " -d" - echo " Enable script debug" - echo " -h" - echo " Shows this help text and exits." - exit 0 - ;; - * ) - break; - ;; - esac - shift + case $1 in + -d ) + set -x + ;; + -w ) + wintool=y + ;; + -s ) + pathtype=system + ;; + -h ) + echo "$progname is a tool for flexible generation of include path arguments for a" + echo "variety of different compilers in a variety of compilation environments" + echo "" + echo $usage + echo "" + echo "Where:" + echo " " + echo " The full path to your compiler" + echo " [ [ ...]]" + echo " A list of include directories" + echo " -w" + echo " The compiler is a Windows native tool and requires Windows" + echo " style pathnames like C:\\Program Files" + echo " -s" + echo " Generate standard, system header file paths instead of normal user" + echo " header file paths." + echo " -d" + echo " Enable script debug" + echo " -h" + echo " Shows this help text and exits." + exit 0 + ;; + * ) + break; + ;; + esac + shift done ccpath=$1 @@ -86,17 +86,17 @@ shift dirlist=$@ if [ -z "$ccpath" ]; then - echo "Missing compiler path" - echo $usage - echo $advice - exit 1 + echo "Missing compiler path" + echo $usage + echo $advice + exit 1 fi if [ -z "$dirlist" ]; then - echo "Missing include directory list" - echo $usage - echo $advice - exit 1 + echo "Missing include directory list" + echo $usage + echo $advice + exit 1 fi # @@ -132,32 +132,32 @@ fi sdcc=`echo $ccpath | grep sdcc` if [ "X$os" = "XCygwin" ]; then - # We can treat Cygwin native toolchains just like Linux native - # toolchains in the Linux. Let's assume: - # 1. GCC or SDCC are the only possible Cygwin native compilers - # 2. If this is a Window native GCC version, then -w must be - # provided on the command line (wintool=y) + # We can treat Cygwin native toolchains just like Linux native + # toolchains in the Linux. Let's assume: + # 1. GCC or SDCC are the only possible Cygwin native compilers + # 2. If this is a Window native GCC version, then -w must be + # provided on the command line (wintool=y) - if [ -z "$gcc" -a -z "$sdcc" ]; then - # Not GCC or SDCC, must be Windows native - windows=yes - compiler=`cygpath -u "$ccpath"` - else - if [ "X$wintool" == "Xy" ]; then - # It is a native GCC or SDCC compiler - windows=yes - compiler=`cygpath -u "$ccpath"` - else - # GCC or SDCC and not for Windows - windows=no - compiler="$ccpath" - fi - fi + if [ -z "$gcc" -a -z "$sdcc" ]; then + # Not GCC or SDCC, must be Windows native + windows=yes + compiler=`cygpath -u "$ccpath"` + else + if [ "X$wintool" == "Xy" ]; then + # It is a native GCC or SDCC compiler + windows=yes + compiler=`cygpath -u "$ccpath"` + else + # GCC or SDCC and not for Windows + windows=no + compiler="$ccpath" + fi + fi else - # Otherwise, we must be in a Linux environment where there are - # only Linux native toolchains - windows=no - compiler="$ccpath" + # Otherwise, we must be in a Linux environment where there are + # only Linux native toolchains + windows=no + compiler="$ccpath" fi exefile=`basename "$compiler"` @@ -165,25 +165,25 @@ exefile=`basename "$compiler"` # a special output format as well as special paths if [ "X$exefile" = "Xez8cc.exe" -o "X$exefile" = "Xzneocc.exe" -o "X$exefile" = "Xez80cc.exe" ]; then - fmt=zds + fmt=zds else - fmt=std + fmt=std fi # Select system or user header file path command line option if [ "X$fmt" = "Xzds" ]; then - if [ "X$pathtype" = "Xsystem" ]; then - cmdarg=-stdinc: - else - cmdarg=-usrinc: - fi + if [ "X$pathtype" = "Xsystem" ]; then + cmdarg=-stdinc: + else + cmdarg=-usrinc: + fi else - if [ "X$pathtype" = "Xsystem" ]; then - cmdarg=-isystem - else - cmdarg=-I - fi + if [ "X$pathtype" = "Xsystem" ]; then + cmdarg=-isystem + else + cmdarg=-I + fi fi # Now process each directory in the directory list @@ -191,47 +191,45 @@ fi unset response for dir in $dirlist; do - # Verify that the include directory exists + # Verify that the include directory exists - if [ ! -d $dir ]; then - echo "Include path '$dir' does not exist" - echo $showusage - exit 1 - fi + if [ ! -d $dir ]; then + echo "Include path '$dir' does not exist" + echo $showusage + exit 1 + fi - # Check if the path needs to be extended for Windows-based tools under Cygwin + # Check if the path needs to be extended for Windows-based tools under Cygwin - if [ "X$windows" = "Xyes" ]; then - path=`cygpath -w $dir` - else - path=$dir - fi + if [ "X$windows" = "Xyes" ]; then + path=`cygpath -w $dir` + else + path=$dir + fi - # Handle the output using the selected format + # Handle the output using the selected format - if [ "X$fmt" = "Xzds" ]; then - # Treat the first directory differently + if [ "X$fmt" = "Xzds" ]; then + # Treat the first directory differently - if [ -z "$response" ]; then - response="${cmdarg}'"${path} - else - response=${response}";${path}" - fi - else - # Treat the first directory differently + if [ -z "$response" ]; then + response="${cmdarg}'"${path} + else + response=${response}";${path}" + fi + else + # Treat the first directory differently - if [ -z "$response" ]; then - response="${cmdarg} \"$path\"" - else - response="${response} ${cmdarg} \"$path\"" - fi - fi + if [ -z "$response" ]; then + response="${cmdarg} \"$path\"" + else + response="${response} ${cmdarg} \"$path\"" + fi + fi done if [ "X$fmt" = "Xzds" ]; then - response=$response"'" + response=$response"'" fi echo $response - - diff --git a/tools/indent.sh b/tools/indent.sh index 4aa06262d6..caebb1b451 100755 --- a/tools/indent.sh +++ b/tools/indent.sh @@ -70,66 +70,66 @@ mode=inplace fca=-fca while [ ! -z "${1}" ]; do - case ${1} in - -d ) - set -x - ;; - -p ) - fca=-nfca - ;; - -o ) - shift - outfile=${1} - mode=copy - ;; - -h ) - echo "$0 is a tool for generation of proper version files for the NuttX build" - echo "" - echo "USAGE:" - echo " $0 [-d] [-p] -o " - echo " $0 [-d] [-p] " - echo " $0 [-d] -h" - echo "" - echo "Where:" - echo " -" - echo " A single, unformatted input file" - echo " -" - echo " A list of unformatted input files that will be reformatted in place." - echo " -o " - echo " Write the single, reformatted to . " - echo " will not be modified." - echo " -d" - echo " Enable script debug" - echo " -p" - echo " Comments are pre-formatted. Do not reformat." - echo " -h" - echo " Show this help message and exit" - exit 0 - ;; - * ) - if [ ! -r ${1} ]; then - echo "Readable ${1} does not exist" - echo ${advice} - exit 1 - fi - if [ -z "${filelist}" ]; then - filelist="${1}" - files=single - else - filelist="${filelist} ${1}" - files=multiple - fi - ;; - esac - shift + case ${1} in + -d ) + set -x + ;; + -p ) + fca=-nfca + ;; + -o ) + shift + outfile=${1} + mode=copy + ;; + -h ) + echo "$0 is a tool for generation of proper version files for the NuttX build" + echo "" + echo "USAGE:" + echo " $0 [-d] [-p] -o " + echo " $0 [-d] [-p] " + echo " $0 [-d] -h" + echo "" + echo "Where:" + echo " -" + echo " A single, unformatted input file" + echo " -" + echo " A list of unformatted input files that will be reformatted in place." + echo " -o " + echo " Write the single, reformatted to . " + echo " will not be modified." + echo " -d" + echo " Enable script debug" + echo " -p" + echo " Comments are pre-formatted. Do not reformat." + echo " -h" + echo " Show this help message and exit" + exit 0 + ;; + * ) + if [ ! -r ${1} ]; then + echo "Readable ${1} does not exist" + echo ${advice} + exit 1 + fi + if [ -z "${filelist}" ]; then + filelist="${1}" + files=single + else + filelist="${filelist} ${1}" + files=multiple + fi + ;; + esac + shift done # Verify that at least one input file was provided if [ "X${files}" == "Xnone" ]; then - echo "ERROR: Neither nor provided" - echo ${advice} - exit 1 + echo "ERROR: Neither nor provided" + echo ${advice} + exit 1 fi # Options @@ -139,16 +139,16 @@ options="-nbad -bap -bbb -nbbo -nbc -bl -bl2 -bls -nbs -cbi2 -ncdw -nce -ci2 -cl # Perform the indentation if [ "X${mode}" == "Xcopy" ]; then - if [ "X${files}" == "Xmultiple" ]; then - echo "ERROR: Only a single can be used with the -o option" - echo ${advice} - exit 1 - fi - if [ -f $outfile ]; then - echo "Removing old $outfile" - rm $outfile || { echo "Failed to remove $outfile" ; exit 1 ; } - fi - indent $options $filelist -o $outfile + if [ "X${files}" == "Xmultiple" ]; then + echo "ERROR: Only a single can be used with the -o option" + echo ${advice} + exit 1 + fi + if [ -f $outfile ]; then + echo "Removing old $outfile" + rm $outfile || { echo "Failed to remove $outfile" ; exit 1 ; } + fi + indent $options $filelist -o $outfile else - indent $options $filelist + indent $options $filelist fi diff --git a/tools/kconfig.bat b/tools/kconfig.bat index db01e75151..b5b712d6f6 100755 --- a/tools/kconfig.bat +++ b/tools/kconfig.bat @@ -118,14 +118,13 @@ echo ERROR: Missing required argument :ShowUsage echo USAGE: %0 ^ [-a ^] [-c ^] echo Where: -echo ^ is one of config, oldconf, or menuconfig -echo ^ is the relative path to the apps\ directory. -echo This defaults to ..\apps -echo ^ is the relative path to the Cygwin installation -echo directory. This defaults to C:\Cygwin +echo ^ is one of config, oldconf, or menuconfig +echo ^ is the relative path to the apps\ directory. +echo This defaults to ..\apps +echo ^ is the relative path to the Cygwin installation +echo directory. This defaults to C:\Cygwin rem Restore the original PATH settings :End set PATH=%oldpath% - diff --git a/tools/link.bat b/tools/link.bat index 21baa6c03e..fbf9c5b33d 100755 --- a/tools/link.bat +++ b/tools/link.bat @@ -35,7 +35,7 @@ rem set usemklink= if "%1"=="-m" ( -set usemklink="y" + set usemklink="y" shift ) @@ -84,7 +84,7 @@ rem Copy the directory :MkLink if "%usemklink%"=="y" ( -/user:administrator mklink /d %src% %link% + /user:administrator mklink /d %src% %link% goto :End ) @@ -95,7 +95,7 @@ goto :End :ShowUsage echo USAGE: %0 ^ ^ echo Where: -echo ^ is the source directory to be linked -echo ^ is the link to be created +echo ^ is the source directory to be linked +echo ^ is the link to be created :End diff --git a/tools/link.sh b/tools/link.sh index 0254ba159b..496d19ed16 100755 --- a/tools/link.sh +++ b/tools/link.sh @@ -41,8 +41,8 @@ dest=$2 # Verify that arguments were provided if [ -z "${src}" -o -z "${dest}" ]; then - echo "Missing src and/or dest arguments" - exit 1 + echo "Missing src and/or dest arguments" + exit 1 fi # Check if something already exists at the destination path replace it with @@ -52,61 +52,60 @@ fi if [ -h "${dest}" ]; then - # If the link is already created (and matches the request) do nothing + # If the link is already created (and matches the request) do nothing - if [ "$(readlink ${dest})" = "${src}" ]; then - exit 0 - fi + if [ "$(readlink ${dest})" = "${src}" ]; then + exit 0 + fi - # Otherwise, remove the link + # Otherwise, remove the link - rm -f "${dest}" + rm -f "${dest}" else - # If the path exists and is a directory that contains the "fake link" - # mark, then treat it like a soft link (i.e., remove the directory) + # If the path exists and is a directory that contains the "fake link" + # mark, then treat it like a soft link (i.e., remove the directory) - if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then - rm -rf "${dest}" - else + if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then + rm -rf "${dest}" + else - # Does anything exist at the destination path? + # Does anything exist at the destination path? - if [ -e "${dest}" ]; then + if [ -e "${dest}" ]; then - # It is something else (like a file) or directory that does - # not contain the "fake link" mark + # It is something else (like a file) or directory that does + # not contain the "fake link" mark - echo "${dest} already exists but is not a symbolic link" - exit 1 - fi - fi + echo "${dest} already exists but is not a symbolic link" + exit 1 + fi + fi fi # Verify that a directory exists at the source path if [ ! -d "${src}" ]; then - echo "No directory at ${src}" - exit 1 + echo "No directory at ${src}" + exit 1 fi # Create the soft link ln -s "${src}" "${dest}" || \ - { echo "Failed to create link: $dest" ; exit 1 ; } + { echo "Failed to create link: $dest" ; exit 1 ; } # Verify that the link was created if [ ! -h ${dest} ]; then - # The MSYS 'ln' command actually does a directory copy + # The MSYS 'ln' command actually does a directory copy - if [ -d ${dest} ]; then - # Create the .fakelnk for unlink.sh + if [ -d ${dest} ]; then + # Create the .fakelnk for unlink.sh - touch ${dest}/.fakelnk - else - echo "Error: link at ${dest} not created." - exit 1 - fi + touch ${dest}/.fakelnk + else + echo "Error: link at ${dest} not created." + exit 1 + fi fi - diff --git a/tools/mkconfigvars.sh b/tools/mkconfigvars.sh index efcab4f27e..4a5077a7c0 100755 --- a/tools/mkconfigvars.sh +++ b/tools/mkconfigvars.sh @@ -38,37 +38,37 @@ ADVICE="Try '$0 -h' for more information" unset VERSION while [ ! -z "$1" ]; do - case $1 in - -v ) - shift - VERSION=$1 - ;; - -d ) - set -x - ;; - -h ) - echo "$0 is a tool for generation of configuration variable documentation" - echo "" - echo $USAGE - echo "" - echo "Where:" - echo " -v " - echo " The NuttX version number expressed as a major and minor number separated" - echo " by a period" - echo " -d" - echo " Enable script debug" - echo " -h" - echo " show this help message and exit" - exit 0 - ;; - * ) - echo "Unrecognized option: ${1}" - echo $USAGE - echo $ADVICE - exit 1 - ;; - esac + case $1 in + -v ) shift + VERSION=$1 + ;; + -d ) + set -x + ;; + -h ) + echo "$0 is a tool for generation of configuration variable documentation" + echo "" + echo $USAGE + echo "" + echo "Where:" + echo " -v " + echo " The NuttX version number expressed as a major and minor number separated" + echo " by a period" + echo " -d" + echo " Enable script debug" + echo " -h" + echo " show this help message and exit" + exit 0 + ;; + * ) + echo "Unrecognized option: ${1}" + echo $USAGE + echo $ADVICE + exit 1 + ;; + esac + shift done # Find the directory we were executed from and were we expect to @@ -84,12 +84,12 @@ HTMLFILE=Documentation/NuttXConfigVariables.html BKUPFILE=Documentation/NuttXConfigVariables.bkp if [ -x ./${MYNAME} ] ; then - cd .. || { echo "ERROR: cd .. failed" ; exit 1 ; } + cd .. || { echo "ERROR: cd .. failed" ; exit 1 ; } fi if [ ! -x tools/${MYNAME} ] ; then - echo "ERROR: This file must be executed from the top-level NuttX directory: $PWD" - exit 1 + echo "ERROR: This file must be executed from the top-level NuttX directory: $PWD" + exit 1 fi WD=${PWD} diff --git a/tools/mkctags.sh b/tools/mkctags.sh index 8a2977179e..36bc6f9a0c 100755 --- a/tools/mkctags.sh +++ b/tools/mkctags.sh @@ -35,7 +35,7 @@ WD=`pwd` if [[ "$WD" =~ "nuttx/tools" ]] then - cd .. + cd .. fi find .. -type f -iname "*.[chs]" -o -iname "*.cxx" -o -iname "*.hxx" | xargs ctags -a diff --git a/tools/mkexport.sh b/tools/mkexport.sh index d8992488a7..1727b83c24 100755 --- a/tools/mkexport.sh +++ b/tools/mkexport.sh @@ -45,97 +45,97 @@ WINTOOL=n LIBEXT=.a while [ ! -z "$1" ]; do - case $1 in - -a ) - shift - APPDIR="$1" - ;; - -d ) - set -x - ;; - -l ) - shift - LIBLIST=$1 - ;; - -m ) - shift - MAKE="$1" - ;; - -wy ) - WINTOOL=y - ;; - -w | -wn ) - WINTOOL=n - ;; - -t ) - shift - TOPDIR=$1 - ;; - -u ) - USRONLY=y - ;; - -x ) - shift - LIBEXT=$1 - ;; - -z ) - TGZ=y - ;; - -h ) - echo $USAGE - exit 0 - ;; - * ) - echo "Unrecognized argument: $1" - echo $USAGE - exit 1 - ;; - esac - shift + case $1 in + -a ) + shift + APPDIR="$1" + ;; + -d ) + set -x + ;; + -l ) + shift + LIBLIST=$1 + ;; + -m ) + shift + MAKE="$1" + ;; + -wy ) + WINTOOL=y + ;; + -w | -wn ) + WINTOOL=n + ;; + -t ) + shift + TOPDIR=$1 + ;; + -u ) + USRONLY=y + ;; + -x ) + shift + LIBEXT=$1 + ;; + -z ) + TGZ=y + ;; + -h ) + echo $USAGE + exit 0 + ;; + * ) + echo "Unrecognized argument: $1" + echo $USAGE + exit 1 + ;; + esac + shift done # Check arguments if [ -z "${TOPDIR}" -o -z "${LIBLIST}" ]; then - echo "MK: Missing required arguments" - echo $USAGE - exit 1 + echo "MK: Missing required arguments" + echo $USAGE + exit 1 fi if [ ! -d "${TOPDIR}" ]; then - echo "MK: Directory ${TOPDIR} does not exist" - exit 1 + echo "MK: Directory ${TOPDIR} does not exist" + exit 1 fi # Check configuration # Verify that we have Make.defs, .config, and .version files. if [ ! -f "${TOPDIR}/Make.defs" ]; then - echo "MK: Directory ${TOPDIR}/Make.defs does not exist" - exit 1 + echo "MK: Directory ${TOPDIR}/Make.defs does not exist" + exit 1 fi if [ ! -f "${TOPDIR}/.config" ]; then - echo "MK: Directory ${TOPDIR}/.config does not exist" - exit 1 + echo "MK: Directory ${TOPDIR}/.config does not exist" + exit 1 fi if [ ! -f "${TOPDIR}/.version" ]; then - echo "MK: File ${TOPDIR}/.version does not exist" - exit 1 + echo "MK: File ${TOPDIR}/.version does not exist" + exit 1 fi # Check if the make environment variable has been defined if [ -z "${MAKE}" ]; then - MAKE=`which make` + MAKE=`which make` fi # Get the version string source "${TOPDIR}/.version" if [ ! -z "${CONFIG_VERSION_STRING}" -a "${CONFIG_VERSION_STRING}" != "0.0" ]; then - VERSION="-${CONFIG_VERSION_STRING}" + VERSION="-${CONFIG_VERSION_STRING}" fi # Create the export directory @@ -146,8 +146,8 @@ EXPORTDIR="${TOPDIR}/${EXPORTSUBDIR}" # If the export directory already exists, then remove it and create a new one if [ -d "${EXPORTDIR}" ]; then - echo "MK: Removing old export directory" - rm -rf "${EXPORTDIR}" + echo "MK: Removing old export directory" + rm -rf "${EXPORTDIR}" fi # Remove any possible previous results @@ -187,8 +187,8 @@ rm -f "${EXPORTDIR}/Make.defs" # Verify the build info that we got from makeinfo.sh if [ ! -d "${ARCHDIR}" ]; then - echo "MK: Directory ${ARCHDIR} does not exist" - exit 1 + echo "MK: Directory ${ARCHDIR} does not exist" + exit 1 fi # Copy the default linker script @@ -198,27 +198,27 @@ cp -f "${TOPDIR}/binfmt/libelf/gnu-elf.ld" "${EXPORTDIR}/scripts/." # Is there a linker script in this configuration? if [ "X${USRONLY}" != "Xy" ]; then - if [ ! -z "${LDPATH}" ]; then + if [ ! -z "${LDPATH}" ]; then - # Apparently so. Verify that the script exists + # Apparently so. Verify that the script exists - if [ ! -f "${LDPATH}" ]; then - echo "MK: File ${LDPATH} does not exist" - exit 1 - fi + if [ ! -f "${LDPATH}" ]; then + echo "MK: File ${LDPATH} does not exist" + exit 1 + fi - # Copy the linker script + # Copy the linker script - cp -p "${LDPATH}" "${EXPORTDIR}/scripts/." || \ - { echo "MK: cp ${LDPATH} failed"; exit 1; } + cp -p "${LDPATH}" "${EXPORTDIR}/scripts/." || \ + { echo "MK: cp ${LDPATH} failed"; exit 1; } - # Copy addtional ld scripts + # Copy addtional ld scripts - LDDIR="$(dirname "${LDPATH}")" - for f in "${LDDIR}"/*.ld ; do - [ -f "${f}" ] && cp -f "${f}" "${EXPORTDIR}/scripts/." - done - fi + LDDIR="$(dirname "${LDPATH}")" + for f in "${LDDIR}"/*.ld ; do + [ -f "${f}" ] && cp -f "${f}" "${EXPORTDIR}/scripts/." + done + fi fi # Save the compilation options @@ -258,20 +258,20 @@ echo "LDSCRIPT = ${LDSCRIPT}" >>"${EXPORTDIR}/scripts/Make.defs" # Additional compilation options when the kernel is built if [ "X${USRONLY}" != "Xy" ]; then - echo "LDFLAGS = ${LDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs" - echo "HEAD_OBJ = ${HEAD_OBJ}" >>"${EXPORTDIR}/scripts/Make.defs" - echo "EXTRA_OBJS = ${EXTRA_OBJS}" >>"${EXPORTDIR}/scripts/Make.defs" - echo "LDSTARTGROUP = ${LDSTARTGROUP}" >>"${EXPORTDIR}/scripts/Make.defs" - echo "LDLIBS = ${LDLIBS}" >>"${EXPORTDIR}/scripts/Make.defs" - echo "EXTRA_LIBS = ${EXTRA_LIBS}" >>"${EXPORTDIR}/scripts/Make.defs" - echo "LIBGCC = ${LIBGCC}" >>"${EXPORTDIR}/scripts/Make.defs" - echo "LDENDGROUP = ${LDENDGROUP}" >>"${EXPORTDIR}/scripts/Make.defs" + echo "LDFLAGS = ${LDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs" + echo "HEAD_OBJ = ${HEAD_OBJ}" >>"${EXPORTDIR}/scripts/Make.defs" + echo "EXTRA_OBJS = ${EXTRA_OBJS}" >>"${EXPORTDIR}/scripts/Make.defs" + echo "LDSTARTGROUP = ${LDSTARTGROUP}" >>"${EXPORTDIR}/scripts/Make.defs" + echo "LDLIBS = ${LDLIBS}" >>"${EXPORTDIR}/scripts/Make.defs" + echo "EXTRA_LIBS = ${EXTRA_LIBS}" >>"${EXPORTDIR}/scripts/Make.defs" + echo "LIBGCC = ${LIBGCC}" >>"${EXPORTDIR}/scripts/Make.defs" + echo "LDENDGROUP = ${LDENDGROUP}" >>"${EXPORTDIR}/scripts/Make.defs" fi # Copy the system map file(s) if [ -r ${TOPDIR}/System.map ]; then - cp -a "${TOPDIR}/System.map" "${EXPORTDIR}/." + cp -a "${TOPDIR}/System.map" "${EXPORTDIR}/." fi if [ -r ${TOPDIR}/User.map ]; then @@ -281,7 +281,7 @@ fi # Copy the NuttX include directory (retaining attributes and following symbolic links) cp -LR -p "${TOPDIR}/include" "${EXPORTDIR}/." || \ - { echo "MK: 'cp ${TOPDIR}/include' failed"; exit 1; } + { echo "MK: 'cp ${TOPDIR}/include' failed"; exit 1; } # Copy the startup object file(s) @@ -303,112 +303,112 @@ cp -f "${ARCHDIR}"/*.h "${EXPORTDIR}"/arch/. 2>/dev/null # those directories into the EXPORTDIR if [ "X${USRONLY}" != "Xy" ]; then - ARCH_HDRDIRS="arm armv7-m avr avr32 board common chip mips32" - for hdir in $ARCH_HDRDIRS; do + ARCH_HDRDIRS="arm armv7-m avr avr32 board common chip mips32" + for hdir in $ARCH_HDRDIRS; do - # Does the directory (or symbolic link) exist? + # Does the directory (or symbolic link) exist? - if [ -d "${ARCHDIR}/${hdir}" -o -h "${ARCHDIR}/${hdir}" ]; then + if [ -d "${ARCHDIR}/${hdir}" -o -h "${ARCHDIR}/${hdir}" ]; then - # Yes.. create a export sub-directory of the same name + # Yes.. create a export sub-directory of the same name - mkdir "${EXPORTDIR}/arch/${hdir}" || \ - { echo "MK: 'mkdir ${EXPORTDIR}/arch/${hdir}' failed"; exit 1; } + mkdir "${EXPORTDIR}/arch/${hdir}" || \ + { echo "MK: 'mkdir ${EXPORTDIR}/arch/${hdir}' failed"; exit 1; } - # Then copy the header files (only) into the new directory + # Then copy the header files (only) into the new directory - cp -f "${ARCHDIR}"/${hdir}/*.h "${EXPORTDIR}"/arch/${hdir}/. 2>/dev/null + cp -f "${ARCHDIR}"/${hdir}/*.h "${EXPORTDIR}"/arch/${hdir}/. 2>/dev/null - # Most architectures have low directory called "hardware" that - # holds the header files + # Most architectures have low directory called "hardware" that + # holds the header files - if [ -d "${ARCHDIR}/${hdir}/hardware" ]; then + if [ -d "${ARCHDIR}/${hdir}/hardware" ]; then - # Yes.. create a export sub-directory of the same name + # Yes.. create a export sub-directory of the same name - mkdir "${EXPORTDIR}/arch/${hdir}/hardware" || \ - { echo "MK: 'mkdir ${EXPORTDIR}/arch/${hdir}/hardware' failed"; exit 1; } + mkdir "${EXPORTDIR}/arch/${hdir}/hardware" || \ + { echo "MK: 'mkdir ${EXPORTDIR}/arch/${hdir}/hardware' failed"; exit 1; } - # Then copy the header files (only) into the new directory + # Then copy the header files (only) into the new directory - cp -f "${ARCHDIR}"/${hdir}/hardware/*.h "${EXPORTDIR}"/arch/${hdir}/hardware/. 2>/dev/null - fi - fi - done + cp -f "${ARCHDIR}"/${hdir}/hardware/*.h "${EXPORTDIR}"/arch/${hdir}/hardware/. 2>/dev/null + fi + fi + done - # Copy OS internal header files as well. They are used by some architecture- - # specific header files. + # Copy OS internal header files as well. They are used by some architecture- + # specific header files. - mkdir "${EXPORTDIR}/arch/os" || \ - { echo "MK: 'mkdir ${EXPORTDIR}/arch/os' failed"; exit 1; } + mkdir "${EXPORTDIR}/arch/os" || \ + { echo "MK: 'mkdir ${EXPORTDIR}/arch/os' failed"; exit 1; } - OSDIRS="clock environ errno group init irq mqueue paging pthread sched semaphore signal task timer wdog" + OSDIRS="clock environ errno group init irq mqueue paging pthread sched semaphore signal task timer wdog" - for dir in ${OSDIRS}; do - mkdir "${EXPORTDIR}/arch/os/${dir}" || \ - { echo "MK: 'mkdir ${EXPORTDIR}/arch/os/${dir}' failed"; exit 1; } - cp -f "${TOPDIR}"/sched/${dir}/*.h "${EXPORTDIR}"/arch/os/${dir}/. 2>/dev/null - done + for dir in ${OSDIRS}; do + mkdir "${EXPORTDIR}/arch/os/${dir}" || \ + { echo "MK: 'mkdir ${EXPORTDIR}/arch/os/${dir}' failed"; exit 1; } + cp -f "${TOPDIR}"/sched/${dir}/*.h "${EXPORTDIR}"/arch/os/${dir}/. 2>/dev/null + done - # Add the board library to the list of libraries + # Add the board library to the list of libraries - if [ -f "${ARCHDIR}/board/libboard${LIBEXT}" ]; then - LIBLIST="${LIBLIST} ${ARCHSUBDIR}/board/libboard${LIBEXT}" - fi + if [ -f "${ARCHDIR}/board/libboard${LIBEXT}" ]; then + LIBLIST="${LIBLIST} ${ARCHSUBDIR}/board/libboard${LIBEXT}" + fi fi # Then process each library AR=${CROSSDEV}ar for lib in ${LIBLIST}; do - if [ ! -f "${TOPDIR}/${lib}" ]; then - echo "MK: Library ${TOPDIR}/${lib} does not exist" - exit 1 - fi + if [ ! -f "${TOPDIR}/${lib}" ]; then + echo "MK: Library ${TOPDIR}/${lib} does not exist" + exit 1 + fi - # Get some shorter names for the library + # Get some shorter names for the library - libname=`basename ${lib} ${LIBEXT}` - shortname=`echo ${libname} | sed -e "s/^lib//g"` + libname=`basename ${lib} ${LIBEXT}` + shortname=`echo ${libname} | sed -e "s/^lib//g"` - # Copy the application library unmodified + # Copy the application library unmodified - if [ "X${libname}" = "Xlibapps" ]; then - cp -p "${TOPDIR}/${lib}" "${EXPORTDIR}/libs/." || \ - { echo "MK: cp ${TOPDIR}/${lib} failed"; exit 1; } - else + if [ "X${libname}" = "Xlibapps" ]; then + cp -p "${TOPDIR}/${lib}" "${EXPORTDIR}/libs/." || \ + { echo "MK: cp ${TOPDIR}/${lib} failed"; exit 1; } + else - # Create a temporary directory and extract all of the objects there - # Hmmm.. this probably won't work if the archiver is not 'ar' + # Create a temporary directory and extract all of the objects there + # Hmmm.. this probably won't work if the archiver is not 'ar' - mkdir "${EXPORTDIR}/tmp" || \ - { echo "MK: 'mkdir ${EXPORTDIR}/tmp' failed"; exit 1; } - cd "${EXPORTDIR}/tmp" || \ - { echo "MK: 'cd ${EXPORTDIR}/tmp' failed"; exit 1; } - if [ "X${WINTOOL}" = "Xy" ]; then - WLIB=`cygpath -w "${TOPDIR}/${lib}"` - ${AR} x "${WLIB}" - else - ${AR} x "${TOPDIR}/${lib}" - fi + mkdir "${EXPORTDIR}/tmp" || \ + { echo "MK: 'mkdir ${EXPORTDIR}/tmp' failed"; exit 1; } + cd "${EXPORTDIR}/tmp" || \ + { echo "MK: 'cd ${EXPORTDIR}/tmp' failed"; exit 1; } + if [ "X${WINTOOL}" = "Xy" ]; then + WLIB=`cygpath -w "${TOPDIR}/${lib}"` + ${AR} x "${WLIB}" + else + ${AR} x "${TOPDIR}/${lib}" + fi - # Rename each object file (to avoid collision when they are combined) - # and add the file to libnuttx + # Rename each object file (to avoid collision when they are combined) + # and add the file to libnuttx - for file in `ls`; do - mv "${file}" "${shortname}-${file}" - if [ "X${WINTOOL}" = "Xy" ]; then - WLIB=`cygpath -w "${EXPORTDIR}/libs/libnuttx${LIBEXT}"` - ${AR} rcs "${WLIB}" "${shortname}-${file}" - else - ${AR} rcs "${EXPORTDIR}/libs/libnuttx${LIBEXT}" "${shortname}-${file}" - fi - done + for file in `ls`; do + mv "${file}" "${shortname}-${file}" + if [ "X${WINTOOL}" = "Xy" ]; then + WLIB=`cygpath -w "${EXPORTDIR}/libs/libnuttx${LIBEXT}"` + ${AR} rcs "${WLIB}" "${shortname}-${file}" + else + ${AR} rcs "${EXPORTDIR}/libs/libnuttx${LIBEXT}" "${shortname}-${file}" + fi + done - cd "${TOPDIR}" || \ - { echo "MK: 'cd ${TOPDIR}' failed"; exit 1; } - rm -rf "${EXPORTDIR}/tmp" - fi + cd "${TOPDIR}" || \ + { echo "MK: 'cd ${TOPDIR}' failed"; exit 1; } + rm -rf "${EXPORTDIR}/tmp" + fi done # Copy the essential build script file(s) @@ -427,18 +427,18 @@ cp -f "${TOPDIR}/tools/unlink.sh" "${EXPORTDIR}/tools/" # Now tar up the whole export directory cd "${TOPDIR}" || \ - { echo "MK: 'cd ${TOPDIR}' failed"; exit 1; } + { echo "MK: 'cd ${TOPDIR}' failed"; exit 1; } if [ -e "${APPDIR}/Makefile" ]; then - "${MAKE}" -C "${TOPDIR}/${APPDIR}" EXPORTDIR="$(cd "${EXPORTSUBDIR}" ; pwd )" TOPDIR="${TOPDIR}" export || \ - { echo "MK: call make export for APPDIR not supported"; } + "${MAKE}" -C "${TOPDIR}/${APPDIR}" EXPORTDIR="$(cd "${EXPORTSUBDIR}" ; pwd )" TOPDIR="${TOPDIR}" export || \ + { echo "MK: call make export for APPDIR not supported"; } fi if [ "X${TGZ}" = "Xy" ]; then - tar cvf "${EXPORTSUBDIR}.tar" "${EXPORTSUBDIR}" 1>/dev/null 2>&1 - gzip -f "${EXPORTSUBDIR}.tar" + tar cvf "${EXPORTSUBDIR}.tar" "${EXPORTSUBDIR}" 1>/dev/null 2>&1 + gzip -f "${EXPORTSUBDIR}.tar" else - zip -r "${EXPORTSUBDIR}.zip" "${EXPORTSUBDIR}" 1>/dev/null 2>&1 + zip -r "${EXPORTSUBDIR}.zip" "${EXPORTSUBDIR}" 1>/dev/null 2>&1 fi # Clean up after ourselves diff --git a/tools/mkromfsimg.sh b/tools/mkromfsimg.sh index 351490fad9..54bb2b2c06 100755 --- a/tools/mkromfsimg.sh +++ b/tools/mkromfsimg.sh @@ -53,16 +53,16 @@ usage="USAGE: $0 [-nofat] " # Verify if we have the optional "-nofat" if [ "$nofat" == "-nofat" ]; then - echo "We will not mount a FAT/RAMDISK!" - usefat=false + echo "We will not mount a FAT/RAMDISK!" + usefat=false else - topdir=$1 + topdir=$1 fi if [ -z "$topdir" -o ! -d "$topdir" ]; then - echo "The full path to the NuttX base directory must be provided on the command line" - echo $usage - exit 1 + echo "The full path to the NuttX base directory must be provided on the command line" + echo $usage + exit 1 fi # Extract all values from the .config in the $topdir that contains all of the NuttX @@ -71,9 +71,9 @@ fi # to make that practical if [ ! -r $topdir/.config ]; then - echo "No readable file at $topdir/.config" - echo "Has NuttX been configured?" - exit 1 + echo "No readable file at $topdir/.config" + echo "Has NuttX been configured?" + exit 1 fi romfsetc=`grep CONFIG_NSH_ROMFSETC= $topdir/.config | cut -d'=' -f2` @@ -102,42 +102,42 @@ fi # Mountpoint support must be enabled if [ "X$disablempt" = "Xy" ]; then - echo "Mountpoint support is required for this feature" - echo "Set CONFIG_DISABLE_MOUNTPOINT=n to continue" - exit 1 + echo "Mountpoint support is required for this feature" + echo "Set CONFIG_DISABLE_MOUNTPOINT=n to continue" + exit 1 fi # Scripting support must be enabled if [ "X$disablescript" = "Xy" ]; then - echo "NSH scripting support is required for this feature" - echo "Set CONFIG_NSH_DISABLESCRIPT=n to continue" - exit 1 + echo "NSH scripting support is required for this feature" + echo "Set CONFIG_NSH_DISABLESCRIPT=n to continue" + exit 1 fi # We need at least 5 file descriptors: One for the ROMFS mount and one for # FAT mount performed in rcS, plus three for stdio. if [ -z "$ndescriptors" -o "$ndescriptors" -lt 5 ]; then - echo "Insufficient file descriptors have been allocated" - echo "Set CONFIG_NFILE_DESCRIPTORS to value greater than 4" - exit 1 + echo "Insufficient file descriptors have been allocated" + echo "Set CONFIG_NFILE_DESCRIPTORS to value greater than 4" + exit 1 fi # ROMFS support is required, of course if [ "X$romfs" != "Xy" ]; then - echo "ROMFS support is disabled in the NuttX configuration" - echo "Set CONFIG_FS_ROMFS=y to continue" - exit 0 + echo "ROMFS support is disabled in the NuttX configuration" + echo "Set CONFIG_FS_ROMFS=y to continue" + exit 0 fi # If it is the default rcS.template, then it also requires FAT FS support if [ "$usefat" = true -a "X$fatfs" != "Xy" ]; then - echo "FAT FS support is disabled in the NuttX configuration" - echo "Set CONFIG_FS_FAT=y to continue" - exit 0 + echo "FAT FS support is disabled in the NuttX configuration" + echo "Set CONFIG_FS_FAT=y to continue" + exit 0 fi # Verify that genromfs has been installed @@ -151,16 +151,16 @@ genromfs -h 1>/dev/null 2>&1 || { \ # Supply defaults for all un-defined ROMFS settings if [ -z "$romfsmpt" ]; then - romfsmpt="/etc" + romfsmpt="/etc" fi if [ -z "$initscript" ]; then - initscript="init.d/rcS" + initscript="init.d/rcS" fi if [ -z "$romfsdevno" ]; then - romfsdevno=0 + romfsdevno=0 fi if [ -z "$romfssectsize" ]; then - romfssectsize=64 + romfssectsize=64 fi # If FAT FS is a requirement @@ -170,16 +170,16 @@ if [ "$usefat" = true ]; then # Supply defaults for all un-defined FAT FS settings if [ -z "$fatdevno" ]; then - fatdevno=1 + fatdevno=1 fi if [ -z "$fatsectsize" ]; then - fatsectsize=512 + fatsectsize=512 fi if [ -z "$fatnsectors" ]; then - fatnsectors=1024 + fatnsectors=1024 fi if [ -z "$fatmpt" ]; then - fatmpt="/tmp" + fatmpt="/tmp" fi fi @@ -187,50 +187,50 @@ fi # /., /./*, /.., or /../* if [ ${romfsmpt:0:1} != "\"" ]; then - echo "CONFIG_NSH_ROMFSMOUNTPT must be a string" - echo "Change it so that it is enclosed in quotes." - exit 1 + echo "CONFIG_NSH_ROMFSMOUNTPT must be a string" + echo "Change it so that it is enclosed in quotes." + exit 1 fi uromfsmpt=`echo $romfsmpt | sed -e "s/\"//g"` if [ ${uromfsmpt:0:1} != "/" ]; then - echo "CONFIG_NSH_ROMFSMOUNTPT must be an absolute path in the target FS" - echo "Change it so that it begins with the character '/'. Eg. /etc" - exit 1 + echo "CONFIG_NSH_ROMFSMOUNTPT must be an absolute path in the target FS" + echo "Change it so that it begins with the character '/'. Eg. /etc" + exit 1 fi tmpdir=$uromfsmpt while [ ${tmpdir:0:1} == "/" ]; do - tmpdir=${tmpdir:1} + tmpdir=${tmpdir:1} done if [ -z "$tmpdir" -o "X$tmpdir" = "Xdev" -o "X$tmpdir" = "." -o \ ${tmpdir:0:2} = "./" -o "X$tmpdir" = ".." -o ${tmpdir:0:3} = "../" ]; then - echo "Invalid CONFIG_NSH_ROMFSMOUNTPT selection." - exit 1 + echo "Invalid CONFIG_NSH_ROMFSMOUNTPT selection." + exit 1 fi # Verify that the path to the init file is a relative path and not ., ./*, .., or ../* if [ ${initscript:0:1} != "\"" ]; then - echo "CONFIG_NSH_INITSCRIPT must be a string" - echo "Change it so that it is enclosed in quotes." - exit 1 + echo "CONFIG_NSH_INITSCRIPT must be a string" + echo "Change it so that it is enclosed in quotes." + exit 1 fi uinitscript=`echo $initscript | sed -e "s/\"//g"` if [ ${uinitscript:0:1} == "/" ]; then - echo "CONFIG_NSH_INITSCRIPT must be an relative path in under $romfsmpt" - echo "Change it so that it begins with the character '/'. Eg. init.d/rcS. " - exit 1 + echo "CONFIG_NSH_INITSCRIPT must be an relative path in under $romfsmpt" + echo "Change it so that it begins with the character '/'. Eg. init.d/rcS. " + exit 1 fi if [ "X$uinitscript" = "." -o ${uinitscript:0:2} = "./" -o \ "X$uinitscript" = ".." -o ${uinitscript:0:3} = "../" ]; then - echo "Invalid CONFIG_NSH_INITSCRIPT selection. Must not begin with . or .." - exit 1 + echo "Invalid CONFIG_NSH_INITSCRIPT selection. Must not begin with . or .." + exit 1 fi # Create a working directory @@ -241,9 +241,9 @@ mkdir -p $workingdir || { echo "Failed to created the new $workingdir"; exit 1; # Create the rcS file from the rcS.template if [ ! -r $rcstemplate ]; then - echo "$rcstemplate does not exist" - rmdir $workingdir - exit 1 + echo "$rcstemplate does not exist" + rmdir $workingdir + exit 1 fi # If we are using FAT FS with RAMDISK we need to setup it diff --git a/tools/refresh.sh b/tools/refresh.sh index 9bff24990d..3e7c7af2c7 100755 --- a/tools/refresh.sh +++ b/tools/refresh.sh @@ -44,51 +44,51 @@ defaults=n prompt=y while [ ! -z "$1" ]; do - case $1 in - --debug ) - set -x - ;; - --silent ) - silent=y - defaults=y - prompt=n - ;; - --prompt ) - prompt=y - ;; - --defaults ) - defaults=y - ;; - --help ) - echo "$0 is a tool for refreshing board configurations" - echo "" - echo $USAGE - echo "" - echo "Where [options] include:" - echo " --debug" - echo " Enable script debug" - echo " --silent" - echo " Update board configuration without interaction. Implies --defaults." - echo " Assumes no prompt for save. Use --silent --prompt to prompt before saving." - echo " --prompt" - echo " Prompt before updating and overwriting the defconfig file. Default is to" - echo " prompt unless --silent" - echo " --defaults" - echo " Do not prompt for new default selections; accept all recommended default values" - echo " --help" - echo " Show this help message and exit" - echo " " - echo " The board directory under nuttx/boards" - echo " " - echo " The board configuration directory under nuttx/boards//configs" - exit 0 - ;; - * ) - CONFIG=$1 - break - ;; - esac - shift + case $1 in + --debug ) + set -x + ;; + --silent ) + silent=y + defaults=y + prompt=n + ;; + --prompt ) + prompt=y + ;; + --defaults ) + defaults=y + ;; + --help ) + echo "$0 is a tool for refreshing board configurations" + echo "" + echo $USAGE + echo "" + echo "Where [options] include:" + echo " --debug" + echo " Enable script debug" + echo " --silent" + echo " Update board configuration without interaction. Implies --defaults." + echo " Assumes no prompt for save. Use --silent --prompt to prompt before saving." + echo " --prompt" + echo " Prompt before updating and overwriting the defconfig file. Default is to" + echo " prompt unless --silent" + echo " --defaults" + echo " Do not prompt for new default selections; accept all recommended default values" + echo " --help" + echo " Show this help message and exit" + echo " " + echo " The board directory under nuttx/boards" + echo " " + echo " The board configuration directory under nuttx/boards//configs" + exit 0 + ;; + * ) + CONFIG=$1 + break + ;; + esac + shift done # Get the board configuration @@ -153,12 +153,12 @@ fi MYNAME=`basename $0` if [ -x ./${MYNAME} ] ; then - cd .. || { echo "ERROR: cd .. failed" ; exit 1 ; } + cd .. || { echo "ERROR: cd .. failed" ; exit 1 ; } fi if [ ! -x tools/${MYNAME} ] ; then - echo "ERROR: This file must be executed from the top-level NuttX directory: $PWD" - exit 1 + echo "ERROR: This file must be executed from the top-level NuttX directory: $PWD" + exit 1 fi # Set up the environment diff --git a/tools/sethost.sh b/tools/sethost.sh index 37e80729d6..a9187c9cb3 100755 --- a/tools/sethost.sh +++ b/tools/sethost.sh @@ -41,70 +41,70 @@ hsize=64 unset configfile function showusage { - echo "" - echo "USAGE: $progname [-w|l|m] [-c|u|g|n] [-32|64] []" - echo " $progname -h" - echo "" - echo "Where:" - echo " -w|l|m selects Windows (w), Linux (l), or macOS (m). Default: Linux" - echo " -c|u|g|n selects Windows environment option: Cygwin (c), Ubuntu under" - echo " Windows 10 (u), MSYS/MSYS2 (g) or Windows native (n). Default Cygwin" - echo " -32|64 selects 32- or 64-bit host. Default 64" - echo " -h will show this help test and terminate" - echo " selects configuration file. Default: .config" - exit 1 + echo "" + echo "USAGE: $progname [-w|l|m] [-c|u|g|n] [-32|64] []" + echo " $progname -h" + echo "" + echo "Where:" + echo " -w|l|m selects Windows (w), Linux (l), or macOS (m). Default: Linux" + echo " -c|u|g|n selects Windows environment option: Cygwin (c), Ubuntu under" + echo " Windows 10 (u), MSYS/MSYS2 (g) or Windows native (n). Default Cygwin" + echo " -32|64 selects 32- or 64-bit host. Default 64" + echo " -h will show this help test and terminate" + echo " selects configuration file. Default: .config" + exit 1 } # Parse command line while [ ! -z "$1" ]; do - case $1 in - -w ) - host=windows - ;; - -l ) - host=linux - ;; - -c ) - host=windows - wenv=cygwin - ;; - -g ) - host=windows - wenv=msys - ;; - -u ) - host=windows - wenv=ubuntu - ;; - -m ) - host=macos - ;; - -n ) - host=windows - wenv=native - ;; - -32 ) - hsize=32 - ;; - -64 ) - hsize=32 - ;; - -h ) - showusage - ;; - * ) - configfile="$1" - shift - break; - ;; + case $1 in + -w ) + host=windows + ;; + -l ) + host=linux + ;; + -c ) + host=windows + wenv=cygwin + ;; + -g ) + host=windows + wenv=msys + ;; + -u ) + host=windows + wenv=ubuntu + ;; + -m ) + host=macos + ;; + -n ) + host=windows + wenv=native + ;; + -32 ) + hsize=32 + ;; + -64 ) + hsize=32 + ;; + -h ) + showusage + ;; + * ) + configfile="$1" + shift + break; + ;; esac shift done if [ ! -z "$1" ]; then - echo "ERROR: Garbage at the end of line" - showusage + echo "ERROR: Garbage at the end of line" + showusage fi if [ -x sethost.sh ]; then @@ -178,82 +178,82 @@ fi if [ "X$host" == "Xlinux" -o "X$host" == "Xmacos" ]; then - # Enable Linux or macOS + # Enable Linux or macOS - if [ "X$host" == "Xlinux" ]; then - echo " Select CONFIG_HOST_LINUX=y" + if [ "X$host" == "Xlinux" ]; then + echo " Select CONFIG_HOST_LINUX=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_LINUX - kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS - else - echo " Select CONFIG_HOST_MACOS=y" - - kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX - kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_MACOS - fi - - # Disable all Windows options - - kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_WINDOWS - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_MICROSOFT - kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV - - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER - - kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_MICROSOFT - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32 -else - echo " Select CONFIG_HOST_WINDOWS=y" - - # Enable Windows - - kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_WINDOWS - kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX + kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_LINUX kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS + else + echo " Select CONFIG_HOST_MACOS=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_MICROSOFT - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_SYSTEMV + kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX + kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_MACOS + fi - # Enable Windows environment + # Disable all Windows options - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER - if [ "X$wenv" == "Xcygwin" ]; then - echo " Select CONFIG_WINDOWS_CYGWIN=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_CYGWIN - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS + kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_WINDOWS + kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_MICROSOFT + kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV + + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER + + kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV + kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_MICROSOFT + kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32 +else + echo " Select CONFIG_HOST_WINDOWS=y" + + # Enable Windows + + kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_WINDOWS + kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX + kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS + + kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_MICROSOFT + kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_SYSTEMV + + # Enable Windows environment + + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER + if [ "X$wenv" == "Xcygwin" ]; then + echo " Select CONFIG_WINDOWS_CYGWIN=y" + kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_CYGWIN + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE + else + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN + if [ "X$wenv" == "Xmsys" ]; then + echo " Select CONFIG_WINDOWS_MSYS=y" + kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_MSYS kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE else - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN - if [ "X$wenv" == "Xmsys" ]; then - echo " Select CONFIG_WINDOWS_MSYS=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_MSYS - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS + if [ "X$wenv" == "Xubuntu" ]; then + echo " Select CONFIG_WINDOWS_UBUNTU=y" + kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_UBUNTU kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE else - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS - if [ "X$wenv" == "Xubuntu" ]; then - echo " Select CONFIG_WINDOWS_UBUNTU=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_UBUNTU - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE - else - echo " Select CONFIG_WINDOWS_NATIVE=y" - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU - kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_NATIVE - fi + echo " Select CONFIG_WINDOWS_NATIVE=y" + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU + kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_NATIVE fi fi + fi - if [ "X$hsize" == "X32" ]; then - kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_M32 - else - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32 - fi + if [ "X$hsize" == "X32" ]; then + kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_M32 + else + kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32 + fi fi kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS diff --git a/tools/testbuild.sh b/tools/testbuild.sh index 3ddfc56eb5..3925fdffdc 100755 --- a/tools/testbuild.sh +++ b/tools/testbuild.sh @@ -48,78 +48,78 @@ unset testfile unset JOPTION function showusage { - echo "" - echo "USAGE: $progname [-w|l] [-c|u|n] [-s] [-d] [-x] [-j ] [-a ] [-t " - echo " $progname -h" - echo "" - echo "Where:" - echo " -w|l selects Windows (w) or Linux (l). Default: Linux" - echo " -c|u|n selects Windows environment option: Cygwin (c), Ubuntu under" - echo " Windows 10 (u), or Windows native (n). Default Cygwin" - echo " -s Use C++ unsigned long size_t in new operator. Default unsigned int" - echo " -d enables script debug output" - echo " -x exit on build failures" - echo " -j passed on to make. Default: No -j make option." - echo " -a provides the relative path to the apps/ directory. Default ../apps" - echo " -t provides the absolute path to top nuttx/ directory. Default $PWD/../nuttx" - echo " -h will show this help test and terminate" - echo " selects the list of configurations to test. No default" - echo "" - echo "Your PATH variable must include the path to both the build tools and the" - echo "kconfig-frontends tools" - echo "" - exit 1 + echo "" + echo "USAGE: $progname [-w|l] [-c|u|n] [-s] [-d] [-x] [-j ] [-a ] [-t " + echo " $progname -h" + echo "" + echo "Where:" + echo " -w|l selects Windows (w) or Linux (l). Default: Linux" + echo " -c|u|n selects Windows environment option: Cygwin (c), Ubuntu under" + echo " Windows 10 (u), or Windows native (n). Default Cygwin" + echo " -s Use C++ unsigned long size_t in new operator. Default unsigned int" + echo " -d enables script debug output" + echo " -x exit on build failures" + echo " -j passed on to make. Default: No -j make option." + echo " -a provides the relative path to the apps/ directory. Default ../apps" + echo " -t provides the absolute path to top nuttx/ directory. Default $PWD/../nuttx" + echo " -h will show this help test and terminate" + echo " selects the list of configurations to test. No default" + echo "" + echo "Your PATH variable must include the path to both the build tools and the" + echo "kconfig-frontends tools" + echo "" + exit 1 } # Parse command line while [ ! -z "$1" ]; do - case $1 in - -w ) + case $1 in + -w ) host=windows ;; - -l ) + -l ) host=linux ;; - -c ) + -c ) host=windows wenv=cygwin ;; - -d ) + -d ) set -x ;; - -u ) + -u ) host=windows wenv=ubuntu ;; - -n ) + -n ) host=windows wenv=native ;; - -s ) + -s ) host=windows sizet=long ;; - -x ) + -x ) MAKE_FLAGS='--silent --no-print-directory' set -e ;; - -a ) + -a ) shift APPSDIR="$1" ;; - -j ) + -j ) shift JOPTION="-j $1" ;; - -t ) + -t ) shift nuttx="$1" ;; - -h ) + -h ) showusage ;; - * ) + * ) testfile="$1" shift break; @@ -129,133 +129,133 @@ while [ ! -z "$1" ]; do done if [ ! -z "$1" ]; then - echo "ERROR: Garbage at the end of line" - showusage + echo "ERROR: Garbage at the end of line" + showusage fi if [ -z "$testfile" ]; then - echo "ERROR: Missing test list file" - showusage + echo "ERROR: Missing test list file" + showusage fi if [ ! -r "$testfile" ]; then - echo "ERROR: No readable file exists at $testfile" - showusage + echo "ERROR: No readable file exists at $testfile" + showusage fi if [ ! -d "$nuttx" ]; then - echo "ERROR: Expected to find nuttx/ at $nuttx" - showusage + echo "ERROR: Expected to find nuttx/ at $nuttx" + showusage fi # Clean up after the last build function distclean { - cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; } - if [ -f .config ]; then - echo " Cleaning..." - ${MAKE} ${JOPTION} ${MAKE_FLAGS} distclean 1>/dev/null - fi + cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; } + if [ -f .config ]; then + echo " Cleaning..." + ${MAKE} ${JOPTION} ${MAKE_FLAGS} distclean 1>/dev/null + fi } # Configure for the next build function configure { - cd $nuttx/tools || { echo "ERROR: failed to CD to $nuttx/tools"; exit 1; } - echo " Configuring..." - ./configure.sh $config + cd $nuttx/tools || { echo "ERROR: failed to CD to $nuttx/tools"; exit 1; } + echo " Configuring..." + ./configure.sh $config - cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; } + cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; } - if [ "X$host" == "Xlinux" ]; then - echo " Select CONFIG_HOST_LINUX=y" + if [ "X$host" == "Xlinux" ]; then + echo " Select CONFIG_HOST_LINUX=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_LINUX - kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_WINDOWS + kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_LINUX + kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_WINDOWS + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER + + kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV + kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_MICROSOFT + kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32 + else + echo " Select CONFIG_HOST_WINDOWS=y" + kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_WINDOWS + kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX + + if [ "X$wenv" == "Xcygwin" ]; then + echo " Select CONFIG_WINDOWS_CYGWIN=y" + kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_CYGWIN + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE + else + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN + if [ "X$wenv" == "Xubuntu" ]; then + echo " Select CONFIG_WINDOWS_UBUNTU=y" + kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_UBUNTU kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER - - kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_MICROSOFT - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32 - else - echo " Select CONFIG_HOST_WINDOWS=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_WINDOWS - kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX - - if [ "X$wenv" == "Xcygwin" ]; then - echo " Select CONFIG_WINDOWS_CYGWIN=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_CYGWIN - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE - else - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN - if [ "X$wenv" == "Xubuntu" ]; then - echo " Select CONFIG_WINDOWS_UBUNTU=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_UBUNTU - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE - else - echo " Select CONFIG_WINDOWS_NATIVE=y" - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU - kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_NATIVE - fi - fi - - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS - kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER - - kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_MICROSOFT - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_SYSTEMV - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32 + else + echo " Select CONFIG_WINDOWS_NATIVE=y" + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU + kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_NATIVE + fi fi - kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS - kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_OTHER + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS + kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER - if [ "X$sizet" == "Xlong" ]; then - echo " Select CONFIG_CXX_NEWLONG=y" - kconfig-tweak --file $nuttx/.config --enable CONFIG_CXX_NEWLONG - else - echo " Disable CONFIG_CXX_NEWLONG" - kconfig-tweak --file $nuttx/.config --disable CONFIG_CXX_NEWLONG + kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_MICROSOFT + kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_SYSTEMV + kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32 + fi + + kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS + kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_OTHER + + if [ "X$sizet" == "Xlong" ]; then + echo " Select CONFIG_CXX_NEWLONG=y" + kconfig-tweak --file $nuttx/.config --enable CONFIG_CXX_NEWLONG + else + echo " Disable CONFIG_CXX_NEWLONG" + kconfig-tweak --file $nuttx/.config --disable CONFIG_CXX_NEWLONG + fi + + if [ "X$toolchain" != "X" ]; then + setting=`grep TOOLCHAIN $nuttx/.config | grep -v CONFIG_ARCH_TOOLCHAIN_GNU=y | grep =y` + varname=`echo $setting | cut -d'=' -f1` + if [ ! -z "$varname" ]; then + echo " Disabling $varname" + kconfig-tweak --file $nuttx/.config --disable $varname fi - if [ "X$toolchain" != "X" ]; then - setting=`grep TOOLCHAIN $nuttx/.config | grep -v CONFIG_ARCH_TOOLCHAIN_GNU=y | grep =y` - varname=`echo $setting | cut -d'=' -f1` - if [ ! -z "$varname" ]; then - echo " Disabling $varname" - kconfig-tweak --file $nuttx/.config --disable $varname - fi + echo " Enabling $toolchain" + kconfig-tweak --file $nuttx/.config --enable $toolchain + fi - echo " Enabling $toolchain" - kconfig-tweak --file $nuttx/.config --enable $toolchain - fi - - echo " Refreshing..." - cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; } - ${MAKE} ${MAKE_FLAGS} olddefconfig 1>/dev/null 2>&1 + echo " Refreshing..." + cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; } + ${MAKE} ${MAKE_FLAGS} olddefconfig 1>/dev/null 2>&1 } # Perform the next build function build { - cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; } - echo " Building NuttX..." - echo "------------------------------------------------------------------------------------" - ${MAKE} ${JOPTION} ${MAKE_FLAGS} 1>/dev/null + cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; } + echo " Building NuttX..." + echo "------------------------------------------------------------------------------------" + ${MAKE} ${JOPTION} ${MAKE_FLAGS} 1>/dev/null } # Coordinate the steps for the next build test function dotest { - echo "------------------------------------------------------------------------------------" - distclean - configure - build + echo "------------------------------------------------------------------------------------" + distclean + configure + build } # Perform the build test for each entry in the test list file @@ -273,72 +273,72 @@ testlist=`cat $testfile` #while read -r line || [[ -n $line ]]; do for line in $testlist; do - echo "====================================================================================" - firstch=${line:0:1} - if [ "X$firstch" == "X#" ]; then - echo "Skipping: $line" - else - echo "Configuration/Tool: $line" + echo "====================================================================================" + firstch=${line:0:1} + if [ "X$firstch" == "X#" ]; then + echo "Skipping: $line" + else + echo "Configuration/Tool: $line" - # Parse the next line + # Parse the next line - config=`echo $line | cut -d',' -f1` - configdir=`echo $config | cut -s -d':' -f2` + config=`echo $line | cut -d',' -f1` + configdir=`echo $config | cut -s -d':' -f2` + if [ -z "${configdir}" ]; then + configdir=`echo $config | cut -s -d'/' -f2` if [ -z "${configdir}" ]; then - configdir=`echo $config | cut -s -d'/' -f2` - if [ -z "${configdir}" ]; then - echo "ERROR: Malformed configuration: ${config}" - showusage - else - boarddir=`echo $config | cut -d'/' -f1` - fi - else - boarddir=`echo $config | cut -d':' -f1` - fi - - # Detect the architecture of this board. - - ARCHLIST="arm avr hc mips misoc or1k renesas risc-v sim x86 xtensa z16 z80" - CHIPLIST="a1x am335x c5471 cxd56xx dm320 efm32 imx6 imxrt kinetis kl lc823450 - lpc17xx_40xx lpc214x lpc2378 lpc31xx lpc43xx lpc54xx max326xx moxart nrf52 - nuc1xx rx65n s32k1xx sam34 sama5 samd2l2 samd5e5 samv7 stm32 stm32f0l0g0 stm32f7 stm32h7 - stm32l4 str71x tiva tms570 xmc4 at32uc3 at90usb atmega mcs92s12ne64 pic32mx - pic32mz lm32 mor1kx m32262f8 sh7032 fe310 k210 gap8 nr5m100 sim qemu esp32 z16f2811 - ez80 z180 z8 z80" - - for arch in ${ARCHLIST}; do - for chip in ${CHIPLIST}; do - if [ -f ${nuttx}/boards/${arch}/${chip}/${boarddir}/Kconfig ]; then - archdir=${arch} - chipdir=${chip} - fi - done - done - - if [ -z "${archdir}" ]; then - echo "ERROR: Architecture of ${boarddir} not found" - exit 1 - fi - - path=$nuttx/boards/$archdir/$chipdir/$boarddir/configs/$configdir - if [ ! -r "$path/defconfig" ]; then - echo "ERROR: no configuration found at $path" + echo "ERROR: Malformed configuration: ${config}" showusage + else + boarddir=`echo $config | cut -d'/' -f1` fi - - unset toolchain; - if [ "X$config" != "X$line" ]; then - toolchain=`echo $line | cut -d',' -f2` - if [ -z "$toolchain" ]; then - echo " Warning: no tool configuration" - fi - fi - - # Perform the build test - - dotest + else + boarddir=`echo $config | cut -d':' -f1` fi - cd $WD || { echo "ERROR: Failed to CD to $WD"; exit 1; } + + # Detect the architecture of this board. + + ARCHLIST="arm avr hc mips misoc or1k renesas risc-v sim x86 xtensa z16 z80" + CHIPLIST="a1x am335x c5471 cxd56xx dm320 efm32 imx6 imxrt kinetis kl lc823450 + lpc17xx_40xx lpc214x lpc2378 lpc31xx lpc43xx lpc54xx max326xx moxart nrf52 + nuc1xx rx65n s32k1xx sam34 sama5 samd2l2 samd5e5 samv7 stm32 stm32f0l0g0 stm32f7 stm32h7 + stm32l4 str71x tiva tms570 xmc4 at32uc3 at90usb atmega mcs92s12ne64 pic32mx + pic32mz lm32 mor1kx m32262f8 sh7032 fe310 k210 gap8 nr5m100 sim qemu esp32 z16f2811 + ez80 z180 z8 z80" + + for arch in ${ARCHLIST}; do + for chip in ${CHIPLIST}; do + if [ -f ${nuttx}/boards/${arch}/${chip}/${boarddir}/Kconfig ]; then + archdir=${arch} + chipdir=${chip} + fi + done + done + + if [ -z "${archdir}" ]; then + echo "ERROR: Architecture of ${boarddir} not found" + exit 1 + fi + + path=$nuttx/boards/$archdir/$chipdir/$boarddir/configs/$configdir + if [ ! -r "$path/defconfig" ]; then + echo "ERROR: no configuration found at $path" + showusage + fi + + unset toolchain; + if [ "X$config" != "X$line" ]; then + toolchain=`echo $line | cut -d',' -f2` + if [ -z "$toolchain" ]; then + echo " Warning: no tool configuration" + fi + fi + + # Perform the build test + + dotest + fi + cd $WD || { echo "ERROR: Failed to CD to $WD"; exit 1; } done # < $testfile echo "====================================================================================" diff --git a/tools/unlink.bat b/tools/unlink.bat index 83b3b7a8a8..81ad87aa42 100755 --- a/tools/unlink.bat +++ b/tools/unlink.bat @@ -69,6 +69,6 @@ echo Missing Argument :ShowUsage echo USAGE: %0 ^ echo Where: -echo ^ is the linked (or copied) directory to be removed +echo ^ is the linked (or copied) directory to be removed :End diff --git a/tools/unlink.sh b/tools/unlink.sh index c0535be25a..d852e197b0 100755 --- a/tools/unlink.sh +++ b/tools/unlink.sh @@ -39,32 +39,32 @@ link=$1 # Verify that arguments were provided if [ -z "${link}" ]; then - echo "Missing link argument" - exit 1 + echo "Missing link argument" + exit 1 fi # Check if something already exists at the link path if [ -e "${link}" ]; then - # Yes, is it a symbolic link? If so, then remove it + # Yes, is it a symbolic link? If so, then remove it - if [ -h "${link}" ]; then - rm -f "${link}" - else + if [ -h "${link}" ]; then + rm -f "${link}" + else - # If the path is a directory and contains the "fake link" mark, then - # treat it like a soft link (i.e., remove the directory) + # If the path is a directory and contains the "fake link" mark, then + # treat it like a soft link (i.e., remove the directory) - if [ -d "${link}" -a -f "${link}/.fakelnk" ]; then - rm -rf "${link}" - else + if [ -d "${link}" -a -f "${link}/.fakelnk" ]; then + rm -rf "${link}" + else - # It is something else (like a file) or directory that does - # not contain the "fake link" mark + # It is something else (like a file) or directory that does + # not contain the "fake link" mark - echo "${link} already exists but is not a symbolic link" - exit 1 - fi - fi + echo "${link} already exists but is not a symbolic link" + exit 1 + fi + fi fi diff --git a/tools/version.sh b/tools/version.sh index 151bb634a8..8e3f57b3be 100755 --- a/tools/version.sh +++ b/tools/version.sh @@ -44,89 +44,89 @@ unset BUILD unset OUTFILE while [ ! -z "$1" ]; do - case $1 in - -b ) - shift - BUILD=$1 - ;; - -d ) - set -x - ;; - -v ) - shift - VERSION=$1 - ;; - -h ) - echo "$0 is a tool for generation of proper version files for the NuttX build" - echo "" - echo $USAGE - echo "" - echo "Where:" - echo " -b " - echo " Use this build identification string. Default: use GIT build ID" - echo " NOTE: GIT build information may not be available in a snapshot" - echo " -d" - echo " Enable script debug" - echo " -h" - echo " show this help message and exit" - echo " -v " - echo " The NuttX version number expressed as a major and minor number separated" - echo " by a period" - echo " " - echo " The full path to the version file to be created" - exit 0 - ;; - * ) - break; - ;; - esac - shift + case $1 in + -b ) + shift + BUILD=$1 + ;; + -d ) + set -x + ;; + -v ) + shift + VERSION=$1 + ;; + -h ) + echo "$0 is a tool for generation of proper version files for the NuttX build" + echo "" + echo $USAGE + echo "" + echo "Where:" + echo " -b " + echo " Use this build identification string. Default: use GIT build ID" + echo " NOTE: GIT build information may not be available in a snapshot" + echo " -d" + echo " Enable script debug" + echo " -h" + echo " show this help message and exit" + echo " -v " + echo " The NuttX version number expressed as a major and minor number separated" + echo " by a period" + echo " " + echo " The full path to the version file to be created" + exit 0 + ;; + * ) + break; + ;; + esac + shift done OUTFILE=$1 if [ -z ${VERSION} ] ; then - VERSION=`git tag --sort=taggerdate | tail -1 | cut -d'-' -f2` + VERSION=`git tag --sort=taggerdate | tail -1 | cut -d'-' -f2` fi # Make sure we know what is going on if [ -z ${VERSION} ] ; then - echo "Missing versioning information" - echo $USAGE - echo $ADVICE - exit 1 + echo "Missing versioning information" + echo $USAGE + echo $ADVICE + exit 1 fi if [ -z ${OUTFILE} ] ; then - echo "Missing path to the output file" - echo $USAGE - echo $ADVICE - exit 1 + echo "Missing path to the output file" + echo $USAGE + echo $ADVICE + exit 1 fi # Get the major and minor version numbers MAJOR=`echo ${VERSION} | cut -d'.' -f1` if [ "X${MAJOR}" = "X${VERSION}" ]; then - echo "Missing minor version number" - echo $USAGE - echo $ADVICE - exit 2 + echo "Missing minor version number" + echo $USAGE + echo $ADVICE + exit 2 fi MINOR=`echo ${VERSION} | cut -d'.' -f2` # Get GIT information (if not provided on the command line) if [ -z "${BUILD}" ]; then - BUILD=`git log --oneline -1 | cut -d' ' -f1 2>/dev/null` - if [ -z "${BUILD}" ]; then - echo "GIT version information is not available" - exit 3 - fi - if [ -n "`git diff-index --name-only HEAD | head -1`" ]; then - BUILD=${BUILD}-dirty - fi + BUILD=`git log --oneline -1 | cut -d' ' -f1 2>/dev/null` + if [ -z "${BUILD}" ]; then + echo "GIT version information is not available" + exit 3 + fi + if [ -n "`git diff-index --name-only HEAD | head -1`" ]; then + BUILD=${BUILD}-dirty + fi fi # Write a version file into the NuttX directoy. The syntax of file is such that it diff --git a/tools/zipme.sh b/tools/zipme.sh index c754996e21..f84387e5de 100755 --- a/tools/zipme.sh +++ b/tools/zipme.sh @@ -50,38 +50,38 @@ unset BUILD unset DEBUG while [ ! -z "$1" ]; do - case $1 in - -b ) - shift - BUILD="-b ${1}" - ;; - -d ) - set -x - DEBUG=-d - ;; - -h ) - echo "$0 is a tool for generation of release versions of NuttX" - echo "" - echo $USAGE - echo "" - echo "Where:" - echo " -b " - echo " Use this build identification string. Default: use GIT build ID" - echo " NOTE: GIT build information may not be available in a snapshot" - echo " -d" - echo " Enable script debug" - echo " -h" - echo " show this help message and exit" - echo " " - echo " The NuttX version number expressed as a major and minor number separated" - echo " by a period" - exit 0 - ;; - * ) - break; - ;; - esac + case $1 in + -b ) shift + BUILD="-b ${1}" + ;; + -d ) + set -x + DEBUG=-d + ;; + -h ) + echo "$0 is a tool for generation of release versions of NuttX" + echo "" + echo $USAGE + echo "" + echo "Where:" + echo " -b " + echo " Use this build identification string. Default: use GIT build ID" + echo " NOTE: GIT build information may not be available in a snapshot" + echo " -d" + echo " Enable script debug" + echo " -h" + echo " show this help message and exit" + echo " " + echo " The NuttX version number expressed as a major and minor number separated" + echo " by a period" + exit 0 + ;; + * ) + break; + ;; + esac + shift done # The last thing on the command line is the version number @@ -92,21 +92,21 @@ VERSIONOPT="-v ${VERSION}" # Make sure we know what is going on if [ -z ${VERSION} ] ; then - echo "You must supply a version like xx.yy as a parameter" - echo $USAGE - echo $ADVICE - exit 1; + echo "You must supply a version like xx.yy as a parameter" + echo $USAGE + echo $ADVICE + exit 1; fi if [ -z "${BUILD}" ]; then - GITINFO=`git log 2>/dev/null | head -1` - if [ -z "${GITINFO}" ]; then - echo "GIT version information is not available. Use the -b option" - echo $USAGE - echo $ADVICE - exit 1; - fi - echo "GIT: ${GITINFO}" + GITINFO=`git log 2>/dev/null | head -1` + if [ -z "${GITINFO}" ]; then + echo "GIT version information is not available. Use the -b option" + echo $USAGE + echo $ADVICE + exit 1; + fi + echo "GIT: ${GITINFO}" fi @@ -116,18 +116,18 @@ fi MYNAME=`basename $0` if [ -x ${WD}/${MYNAME} ] ; then - TRUNKDIR="${WD}/../.." + TRUNKDIR="${WD}/../.." else - if [ -x ${WD}/tools/${MYNAME} ] ; then - TRUNKDIR="${WD}/.." - else - if [ -x ${WD}/nuttx-${VERSION}/tools/${MYNAME} ] ; then - TRUNKDIR="${WD}" - else - echo "You must cd into the NUTTX directory to execute this script." - exit 1 - fi - fi + if [ -x ${WD}/tools/${MYNAME} ] ; then + TRUNKDIR="${WD}/.." + else + if [ -x ${WD}/nuttx-${VERSION}/tools/${MYNAME} ] ; then + TRUNKDIR="${WD}" + else + echo "You must cd into the NUTTX directory to execute this script." + exit 1 + fi + fi fi # Get the NuttX directory names and the path to the parent directory @@ -138,21 +138,21 @@ APPDIR=${TRUNKDIR}/apps-${VERSION} # Make sure that the versioned directory exists if [ ! -d ${TRUNKDIR} ]; then - echo "Directory ${TRUNKDIR} does not exist" - exit 1 + echo "Directory ${TRUNKDIR} does not exist" + exit 1 fi cd ${TRUNKDIR} || \ - { echo "Failed to cd to ${TRUNKDIR}" ; exit 1 ; } + { echo "Failed to cd to ${TRUNKDIR}" ; exit 1 ; } if [ ! -d nuttx-${VERSION} ] ; then - echo "Directory ${TRUNKDIR}/nuttx-${VERSION} does not exist!" - exit 1 + echo "Directory ${TRUNKDIR}/nuttx-${VERSION} does not exist!" + exit 1 fi if [ ! -d apps-${VERSION} ] ; then - echo "Directory ${TRUNKDIR}/apps-${VERSION} does not exist!" - exit 1 + echo "Directory ${TRUNKDIR}/apps-${VERSION} does not exist!" + exit 1 fi # Create the versioned tarball names @@ -179,8 +179,8 @@ cd ${NUTTX}/Documentation || \ VERSIONSH=${NUTTX}/tools/version.sh if [ ! -x "${VERSIONSH}" ]; then - echo "No executable script was found at: ${VERSIONSH}" - exit 1 + echo "No executable script was found at: ${VERSIONSH}" + exit 1 fi ${VERSIONSH} ${DEBUG} ${BUILD} ${VERSIONOPT} ${NUTTX}/.version || \ @@ -216,27 +216,27 @@ make -C ${NUTTX} distclean # Remove any previous tarballs if [ -f ${NUTTX_TARNAME} ] ; then - echo "Removing ${TRUNKDIR}/${NUTTX_TARNAME}" - rm -f ${NUTTX_TARNAME} || \ - { echo "rm ${NUTTX_TARNAME} failed!" ; exit 1 ; } + echo "Removing ${TRUNKDIR}/${NUTTX_TARNAME}" + rm -f ${NUTTX_TARNAME} || \ + { echo "rm ${NUTTX_TARNAME} failed!" ; exit 1 ; } fi if [ -f ${NUTTX_ZIPNAME} ] ; then - echo "Removing ${TRUNKDIR}/${NUTTX_ZIPNAME}" - rm -f ${NUTTX_ZIPNAME} || \ - { echo "rm ${NUTTX_ZIPNAME} failed!" ; exit 1 ; } + echo "Removing ${TRUNKDIR}/${NUTTX_ZIPNAME}" + rm -f ${NUTTX_ZIPNAME} || \ + { echo "rm ${NUTTX_ZIPNAME} failed!" ; exit 1 ; } fi if [ -f ${APPS_TARNAME} ] ; then - echo "Removing ${TRUNKDIR}/${APPS_TARNAME}" - rm -f ${APPS_TARNAME} || \ - { echo "rm ${APPS_TARNAME} failed!" ; exit 1 ; } + echo "Removing ${TRUNKDIR}/${APPS_TARNAME}" + rm -f ${APPS_TARNAME} || \ + { echo "rm ${APPS_TARNAME} failed!" ; exit 1 ; } fi if [ -f ${APPS_ZIPNAME} ] ; then - echo "Removing ${TRUNKDIR}/${APPS_ZIPNAME}" - rm -f ${APPS_ZIPNAME} || \ - { echo "rm ${APPS_ZIPNAME} failed!" ; exit 1 ; } + echo "Removing ${TRUNKDIR}/${APPS_ZIPNAME}" + rm -f ${APPS_ZIPNAME} || \ + { echo "rm ${APPS_ZIPNAME} failed!" ; exit 1 ; } fi # Then tar and zip-up the directories @@ -255,4 +255,3 @@ ${ZIP} ${APPS_TARNAME} || \ { echo "zip of ${APPS_TARNAME} failed!" ; exit 1 ; } cd ${NUTTX} -