From 2427febba9537f269430e27dde9101b4cbe0bb04 Mon Sep 17 00:00:00 2001 From: liuhaitao Date: Fri, 10 Apr 2020 11:15:46 +0800 Subject: [PATCH] tools/testbuild.sh: add -e option to append extra c/c++ flags build support Call 'tools/testbuild.sh -e -Wno-cpp testlist' would pass "EXTRAFLAGS=-Wno-cpp" to make command line. Then it could suppress the warnings with pre-processor directive #warning in GCC. Change-Id: I61e5f9b3774149f64bdd625677cc9aabaa2fea90 Signed-off-by: liuhaitao --- tools/testbuild.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/testbuild.sh b/tools/testbuild.sh index fd901b65b4..9125f34547 100755 --- a/tools/testbuild.sh +++ b/tools/testbuild.sh @@ -39,6 +39,7 @@ progname=$0 fail=0 APPSDIR=$WD/../apps MAKE_FLAGS=-k +EXTRA_FLAGS= MAKE=make unset testfile unset HOPTION @@ -48,13 +49,14 @@ GITCLEAN=0 function showusage { echo "" - echo "USAGE: $progname [-l|m|c|u|g|n] [-d] [-x] [-j ] [-a ] [-t ] [-p] [-G] " + echo "USAGE: $progname [-l|m|c|u|g|n] [-d] [-e ] [-x] [-j ] [-a ] [-t ] [-p] [-G] " echo " $progname -h" echo "" echo "Where:" echo " -l|m|c|u|g|n selects Linux (l), macOS (m), Cygwin (c)," echo " Ubuntu under Windows 10 (u), MSYS/MSYS2 (g) or Windows native (n). Default Linux" echo " -d enables script debug output" + echo " -e pass extra c/c++ flags such as -Wno-cpp via make command line" 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" @@ -85,6 +87,10 @@ while [ ! -z "$1" ]; do -d ) set -x ;; + -e ) + shift + EXTRA_FLAGS="EXTRAFLAGS=$1" + ;; -x ) MAKE_FLAGS='--silent --no-print-directory' set -e @@ -214,7 +220,7 @@ function configure { function build { echo " Building NuttX..." echo "------------------------------------------------------------------------------------" - makefunc ${JOPTION} ${MAKE_FLAGS} 1>/dev/null + makefunc ${JOPTION} ${MAKE_FLAGS} ${EXTRA_FLAGS} 1>/dev/null } # Coordinate the steps for the next build test