diff options
Diffstat (limited to 'nuttx/tools')
-rwxr-xr-x | nuttx/tools/incdir.bat | 56 | ||||
-rwxr-xr-x | nuttx/tools/incdir.sh | 37 |
2 files changed, 74 insertions, 19 deletions
diff --git a/nuttx/tools/incdir.bat b/nuttx/tools/incdir.bat index 093c5bd2e..f7383fc9a 100755 --- a/nuttx/tools/incdir.bat +++ b/nuttx/tools/incdir.bat @@ -36,14 +36,21 @@ rem rem Handle command line options set progname=%0 +set pathtype=user :ArgLoop -rem [-d] [-w] [-h]. [-w] and [-d] Ignored for compatibility with incdir.sh +rem [-d] [-w] [-s] [-h]. [-w] and [-d] Ignored for compatibility with incdir.sh if "%1"=="-d" goto :NextArg if "%1"=="-w" goto :NextArg if "%1"=="-h" goto :Usage + +if "%1"=="-s" ( + set pathtype=system + goto :NextArg +) + goto :CheckCompiler :NextArg @@ -97,21 +104,43 @@ if not exist %1 ( ) if "%fmt%"=="zds" goto :GenerateZdsPath +if "%response%"=="" goto :FirstStdPath +if "%pathtype%"=="system" goto :NextStdSystemPath -if "%response"=="" ( - set response=-I "%1" -) else ( - set response=%response% -I "%1" -) +set response=%response% -I "%1" +goto :EndOfDirLoop + +:NextStdSystemPath + +set response=%response% -isystem "%1" +goto :EndOfDirLoop + +:FirstStdPath + +if "%pathtype%"=="system" goto :FirstStdSystemPath +set response=-I "%1" +goto :EndOfDirLoop + +:FirstStdSystemPath + +set response=-isystem "%1" goto :EndOfDirLoop :GenerateZdsPath -if "%response"=="" ( - set response=-usrinc:%1 -) else ( - set response=%response%;%1 -) +if "%response%"=="" goto :FirstZdsPath +set response=%response%;%1 +goto :EndOfDirLoop + +:FirstZdsPath + +if "%pathtype%"=="system" goto :FirstZdsSystemPath +set response=-usrinc:%1 +goto :EndOfDirLoop + +:FirstZdsSystemPath + +set response=-stdinc:%1 :EndOfDirLoop shift @@ -120,7 +149,7 @@ goto :DirLoop :Usage 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 USAGE: %progname% [-w] [-d] [-h] ^<compiler-path^> ^<dir1^> [^<dir2^> [^<dir3^> ...]] +echo USAGE: %progname% [-w] [-d] [-s] [-h] ^<compiler-path^> ^<dir1^> [^<dir2^> [^<dir3^> ...]] echo Where: echo ^<compiler-path^> echo The full path to your compiler @@ -128,6 +157,9 @@ echo ^<dir1^> [^<dir2^> [^<dir3^> ...]] 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/nuttx/tools/incdir.sh b/nuttx/tools/incdir.sh index 1e862aae1..af83f8517 100755 --- a/nuttx/tools/incdir.sh +++ b/nuttx/tools/incdir.sh @@ -36,6 +36,7 @@ progname=$0 wintool=n +pathtype=user usage="USAGE: $progname [-w] [-d] [-h] <compiler-path> <dir1> [<dir2> [<dir3> ...]]" advice="Try '$progname -h' for more information" @@ -47,6 +48,9 @@ while [ ! -z "$1" ]; do -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" @@ -61,6 +65,9 @@ while [ ! -z "$1" ]; do 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" @@ -158,11 +165,27 @@ 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=userinc + fmt=zds else 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 +else + if [ "X$pathtype" = "Xsystem" ]; then + cmdarg=-isystem + else + cmdarg=-I + fi +fi + # Now process each directory in the directory list unset response @@ -186,26 +209,26 @@ for dir in $dirlist; do # Handle the output using the selected format - if [ "X$fmt" = "Xuserinc" ]; then + if [ "X$fmt" = "Xzds" ]; then # Treat the first directory differently if [ -z "$response" ]; then - response="-usrinc:'"$path + response="${cmdarg}'"${path} else - response=$response":$path" + response=${response}":${path}" fi else # Treat the first directory differently if [ -z "$response" ]; then - response=-I\"$path\" + response="${cmdarg} \"$path\"" else - response=$response" -I\"$path\"" + response="${response} ${cmdarg} \"$path\"" fi fi done -if [ "X$fmt" = "Xuserinc" ]; then +if [ "X$fmt" = "Xzds" ]; then response=$response"'" fi |