summaryrefslogtreecommitdiff
path: root/nuttx/tools
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-21 17:44:14 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-21 17:44:14 +0000
commitc17d30566b3b01abb2451595cdd7845fb47eb64e (patch)
tree5d0480e13686df861c95a3155b04cfc1bab704e6 /nuttx/tools
parent1f3f6cf2f343aad23ea3b808fc3ae4b5be5f37a2 (diff)
downloadpx4-nuttx-c17d30566b3b01abb2451595cdd7845fb47eb64e.tar.gz
px4-nuttx-c17d30566b3b01abb2451595cdd7845fb47eb64e.tar.bz2
px4-nuttx-c17d30566b3b01abb2451595cdd7845fb47eb64e.zip
Update for ez80 Windows native build (still does not work)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5377 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/tools')
-rw-r--r--nuttx/tools/README.txt6
-rwxr-xr-xnuttx/tools/configure.sh36
-rw-r--r--nuttx/tools/define.bat178
-rwxr-xr-xnuttx/tools/define.sh8
-rw-r--r--nuttx/tools/mkdeps.c14
5 files changed, 218 insertions, 24 deletions
diff --git a/nuttx/tools/README.txt b/nuttx/tools/README.txt
index dd971fadc..68b85dc4f 100644
--- a/nuttx/tools/README.txt
+++ b/nuttx/tools/README.txt
@@ -344,6 +344,7 @@ mknulldeps.sh
that mixed environment.
define.sh
+define.bat
---------
Different compilers have different conventions for specifying pre-
@@ -351,6 +352,9 @@ define.sh
script allows the build system to create create command line definitions
without concern for the particular compiler in use.
+ The define.bat script is a counterpart for use in the native Windows
+ build.
+
incdir.sh
incdir.bat
---------
@@ -361,7 +365,7 @@ incdir.bat
concern for the particular compiler in use.
The incdir.bat script is a counterpart for use in the native Windows
- build. However, their is currently only one compiler supported in
+ build. However, there is currently only one compiler supported in
that context: MinGW-GCC.
link.sh
diff --git a/nuttx/tools/configure.sh b/nuttx/tools/configure.sh
index 1cba7805f..5bff89922 100755
--- a/nuttx/tools/configure.sh
+++ b/nuttx/tools/configure.sh
@@ -135,11 +135,15 @@ fi
# Extract values needed from the defconfig file. We need:
# (1) The CONFIG_NUTTX_NEWCONFIG setting to know if this is a "new" style
-# configuration, and
-# (2) The CONFIG_APPS_DIR to see if there is a configured location for the
-# application directory.
+# configuration,
+# (2) The CONFIG_WINDOWS_NATIVE setting to know it this is target for a
+# native Windows (meaning that we want setenv.bat vs setenv.sh and we need
+# to use backslashes in the CONFIG_APPS_DIR setting).
+# (3) The CONFIG_APPS_DIR setting to see if there is a configured location for the
+# application directory. This can be overridden from the command line.
newconfig=`grep CONFIG_NUTTX_NEWCONFIG= "${src_config}" | cut -d'=' -f2`
+winnative=`grep CONFIG_WINDOWS_NATIVE= "${src_config}" | cut -d'=' -f2`
defappdir=y
if [ -z "${appdir}" ]; then
@@ -175,24 +179,29 @@ if [ -z "${appdir}" ]; then
fi
fi
+# For checking the apps dir path, we need a POSIX version of the relative path.
+
+posappdir=`echo "${appdir}" | sed -e "s/\\/\/g"`
+winappdir=`echo "${appdir}" | sed -e "s/\//\\/g"`
+
# If appsdir was provided (or discovered) then make sure that the apps/
# directory exists
-if [ ! -z "${appdir}" -a ! -d "${TOPDIR}/${appdir}" ]; then
- echo "Directory \"${TOPDIR}/${appdir}\" does not exist"
+if [ ! -z "${appdir}" -a ! -d "${TOPDIR}/${posappdir}" ]; then
+ echo "Directory \"${TOPDIR}/${posappdir}\" does not exist"
exit 7
fi
# Okay... Everything looks good. Setup the configuration
-install -C "${src_makedefs}" "${dest_makedefs}" || \
+install "${src_makedefs}" "${dest_makedefs}" || \
{ echo "Failed to copy \"${src_makedefs}\"" ; exit 7 ; }
if [ "X${have_setenv}" = "Xy" ]; then
- install -C "${src_setenv}" "${dest_setenv}" || \
+ install "${src_setenv}" "${dest_setenv}" || \
{ echo "Failed to copy ${src_setenv}" ; exit 8 ; }
chmod 755 "${dest_setenv}"
fi
-install -C "${src_config}" "${tmp_config}" || \
+install "${src_config}" "${tmp_config}" || \
{ echo "Failed to copy \"${src_config}\"" ; exit 9 ; }
# If we did not use the CONFIG_APPS_DIR that was in the defconfig config file,
@@ -204,7 +213,11 @@ if [ "X${defappdir}" = "Xy" ]; then
echo "" >> "${tmp_config}"
echo "# Application configuration" >> "${tmp_config}"
echo "" >> "${tmp_config}"
- echo "CONFIG_APPS_DIR=\"$appdir\"" >> "${tmp_config}"
+ if [ "X${winnative)" = "Xy" ]; then
+ echo "CONFIG_APPS_DIR=\"$winappdir\"" >> "${tmp_config}"
+ else
+ echo "CONFIG_APPS_DIR=\"$posappdir\"" >> "${tmp_config}"
+ fi
fi
# Copy appconfig file. The appconfig file will be copied to ${appdir}/.config
@@ -215,7 +228,7 @@ if [ ! -z "${appdir}" -a "X${newconfig}" != "Xy" ]; then
if [ ! -r "${configpath}/appconfig" ]; then
echo "NOTE: No readable appconfig file found in ${configpath}"
else
- install -C "${configpath}/appconfig" "${TOPDIR}/${appdir}/.config" || \
+ install "${configpath}/appconfig" "${TOPDIR}/${posappdir}/.config" || \
{ echo "Failed to copy ${configpath}/appconfig" ; exit 10 ; }
fi
fi
@@ -223,6 +236,5 @@ fi
# install the final .configX only if it differs from any existing
# .config file.
-install -C "${tmp_config}" "${dest_config}"
+install "${tmp_config}" "${dest_config}"
rm -f "${tmp_config}"
-
diff --git a/nuttx/tools/define.bat b/nuttx/tools/define.bat
new file mode 100644
index 000000000..13d29ac31
--- /dev/null
+++ b/nuttx/tools/define.bat
@@ -0,0 +1,178 @@
+@echo off
+
+rem tools/define.bat
+rem
+rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
+rem Author: Gregory Nutt <gnutt@nuttx.org>
+rem
+rem Redistribution and use in source and binary forms, with or without
+rem modification, are permitted provided that the following conditions
+rem are met:
+rem
+rem 1. Redistributions of source code must retain the above copyright
+rem notice, this list of conditions and the following disclaimer.
+rem 2. Redistributions in binary form must reproduce the above copyright
+rem notice, this list of conditions and the following disclaimer in
+rem the documentation and/or other materials provided with the
+rem distribution.
+rem 3. Neither the name NuttX nor the names of its contributors may be
+rem used to endorse or promote products derived from this software
+rem without specific prior written permission.
+rem
+rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+rem POSSIBILITY OF SUCH DAMAGE.
+
+rem Handle command line options
+rem [-h] <compiler-path> <def1> [-val <val1>] [<def2> [-val <val2>] [<def3> [-val <val3>] ...]]
+rem [-w] [-d] ignored for compatibility with define.sh
+
+set progname=%0
+
+:ArgLoop
+if "%1"=="-d" goto :NextArg
+if "%1"=="-w" goto :NextArg
+if "%1"=="-h" goto :ShowUsage
+
+goto :CheckCompilerPath
+
+:NextArg
+shift
+goto :ArgLoop
+
+:CheckCompilerPath
+
+if "%1"=="" (
+ echo Missing compiler path
+ goto :ShowUsage
+)
+
+set ccpath=%1
+shift
+
+set compiler=
+for /F %%i in ("%ccpath%") do set compiler=%%~ni
+
+if "%1"=="" (
+ echo Missing definition list
+ goto :ShowUsage
+)
+
+rem Check for some well known, non-GCC Windows native tools that require
+rem a special output format as well as special paths
+
+:GetFormat
+set fmt=std
+if "%compiler%"=="ez8cc" goto :SetZdsFormt
+if "%compiler%"=="zneocc" goto :SetZdsFormt
+if "%compiler%"=="ez80cc" goto :SetZdsFormt
+goto :ProcessDefinitions
+
+:SetZdsFormt
+set fmt=zds
+
+rem Now process each directory in the directory list
+
+:ProcessDefinitions
+set response=
+
+:DefinitionLoop
+if "%1"=="" goto :Done
+
+set varname=%1
+shift
+
+rem Handle the output depending on if there is a value for the variable or not
+
+if "%1"=="-val" goto :GetValue
+
+rem Handle the output using the selected format
+
+:NoValue
+if "%fmt%"=="zds" goto :NoValueZDS
+
+:NoValueStandard
+rem Treat the first definition differently
+
+if "%response%"=="" (
+ set response=-D%varname%
+ goto :DefinitionLoop
+)
+
+set response=%response% -D%varname%
+goto :DefinitionLoop
+
+:NoValueZDS
+rem Treat the first definition differently
+
+if "%response%"=="" (
+ set response=-define:%varname%
+ goto :DefinitionLoop
+)
+
+set response=%response% -define:%varname%
+goto :DefinitionLoop
+
+rem Get value following the variable name
+
+:GetValue
+shift
+set varvalue=%1
+shift
+
+rem Handle the output using the selected format
+
+if "%fmt%"=="zds" goto :ValueZDS
+
+:ValueStandard
+rem Treat the first definition differently
+
+if "%response%"=="" (
+ set response=-D%varname%=%varvalue%
+ goto :DefinitionLoop
+)
+
+set response=%response% -D%varname%=%varvalue%
+goto :DefinitionLoop
+
+:ValueZds
+rem Treat the first definition differently
+
+if "%response%"=="" (
+ set response=-define:%varname%=%varvalue%
+ goto :DefinitionLoop
+)
+
+set response=%response% -define:%varname%=%varvalue%
+goto :DefinitionLoop
+
+:Done
+echo %response%
+goto :End
+
+:ShowUsage
+echo %progname% is a tool for flexible generation of command line pre-processor
+echo definitions arguments for a variety of diffent ccpaths in a variety of
+echo compilation environments"
+echo USAGE:%progname% [-h] ^<compiler-path^> [-val ^<^val1^>] [^<def2^> [-val ^<val2^>] [^<def3^> [-val ^<val3^>] ...]]
+echo Where:"
+echo ^<compiler-path^>
+echo The full path to your ccpath
+echo ^<def1^> ^<def2^> ^<def3^> ...
+echo A list of pre-preprocesser variable names to be defined.
+echo [-val ^<val1^>] [-val ^<val2^>] [-val ^<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 -h
+echo Show this text and exit
+
+:End
diff --git a/nuttx/tools/define.sh b/nuttx/tools/define.sh
index c53cb92a8..dc982cc64 100755
--- a/nuttx/tools/define.sh
+++ b/nuttx/tools/define.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# tools/define.sh
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,7 @@
progname=$0
wintool=n
-usage="USAGE: $progname [-w] [-d] [-l] [-h] <compiler-path> <def1>[=val1] [<def2>[=val2] [<def3>[=val3] ...]]"
+usage="USAGE: $progname [-w] [-d] [-h] <compiler-path> <def1>[=val1] [<def2>[=val2] [<def3>[=val3] ...]]"
advice="Try '$progname -h' for more information"
while [ ! -z "$1" ]; do
@@ -60,7 +60,7 @@ while [ ! -z "$1" ]; do
echo " <compiler-path>"
echo " The full path to your compiler"
echo " <def1> <def2> [<def3> ..."
- echo " A list of pre-preprocesser variable names to be defind."
+ 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."
@@ -164,7 +164,7 @@ else
fmt=std
fi
-# Now process each directory in the directory list
+# Now process each definition in the definition list
unset response
for vardef in $varlist; do
diff --git a/nuttx/tools/mkdeps.c b/nuttx/tools/mkdeps.c
index 289385dfc..64d81cbd7 100644
--- a/nuttx/tools/mkdeps.c
+++ b/nuttx/tools/mkdeps.c
@@ -314,18 +314,18 @@ static void parse_args(int argc, char **argv)
if (g_debug)
{
fprintf(stderr, "SELECTIONS\n");
- fprintf(stderr, " CC : \"%s\"\n", g_cc ? g_cc : "(None)");
- fprintf(stderr, " CFLAGS : \"%s\"\n", g_cflags ? g_cflags : "(None)");
- fprintf(stderr, " FILES : \"%s\"\n", g_files ? g_files : "(None)");
- fprintf(stderr, " PATHS : \"%s\"\n", g_altpath ? g_altpath : "(None)");
+ fprintf(stderr, " CC : [%s]\n", g_cc ? g_cc : "(None)");
+ fprintf(stderr, " CFLAGS : [%s]\n", g_cflags ? g_cflags : "(None)");
+ fprintf(stderr, " FILES : [%s]\n", g_files ? g_files : "(None)");
+ fprintf(stderr, " PATHS : [%s]\n", g_altpath ? g_altpath : "(None)");
#ifdef HAVE_WINPATH
- fprintf(stderr, " Windows Paths : \"%s\"\n", g_winpath ? "TRUE" : "FALSE");
+ fprintf(stderr, " Windows Paths : [%s]\n", g_winpath ? "TRUE" : "FALSE");
if (g_winpath)
{
- fprintf(stderr, " TOPDIR : \"%s\"\n", g_topdir);
+ fprintf(stderr, " TOPDIR : [%s]\n", g_topdir);
}
#endif
- fprintf(stderr, " Windows Native : \"%s\"\n", g_winnative ? "TRUE" : "FALSE");
+ fprintf(stderr, " Windows Native : [%s]\n", g_winnative ? "TRUE" : "FALSE");
}
/* Check for required paramters */