summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-01-04 09:08:14 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-01-04 09:08:14 -0600
commitcc60a6fda923b5355f856b375dad46d9a5024282 (patch)
tree33e9a2e1032a383815458d716a3933046aea8465
parent747a4d6bf5a7d9897010fcaf403010f956ff4c7c (diff)
downloadpx4-nuttx-cc60a6fda923b5355f856b375dad46d9a5024282.tar.gz
px4-nuttx-cc60a6fda923b5355f856b375dad46d9a5024282.tar.bz2
px4-nuttx-cc60a6fda923b5355f856b375dad46d9a5024282.zip
nuttx/tools: Fixes for some Windows native build issues from Max Holtzberg
-rw-r--r--nuttx/ChangeLog2
-rw-r--r--nuttx/tools/configure.c10
-rw-r--r--nuttx/tools/mkdeps.c22
3 files changed, 22 insertions, 12 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 77e52b99d..3ff4e4bac 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -6358,4 +6358,6 @@
yet work (2014-1-1).
* arch/arm/src/stm32/stm32_serial.c: Single-wire UART support from
Thomas Grubler (2014-1-2).
+ * tools/configure.c and mkdeps.c: Fixes for Windows build issues
+ from Max Holtzberg (2014-1-4).
diff --git a/nuttx/tools/configure.c b/nuttx/tools/configure.c
index 9e82c3657..1bb68147a 100644
--- a/nuttx/tools/configure.c
+++ b/nuttx/tools/configure.c
@@ -58,6 +58,10 @@
#define BUFFER_SIZE 1024
+#ifdef WIN32
+# define strndup(x, y) strdup(x)
+#endif
+
/****************************************************************************
* Private Data
****************************************************************************/
@@ -630,7 +634,7 @@ static void check_configuration(void)
}
g_srcdefconfig = strdup(g_buffer);
-
+
snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_configpath, g_delim);
debug("check_configuration: Checking %s\n", g_buffer);
if (!verify_file(g_buffer))
@@ -789,7 +793,7 @@ static void configure(void)
debug("configure: Copying from %s to %s\n", g_srcsetenvsh, g_buffer);
copy_file(g_srcsetenvsh, g_buffer, 0755);
}
-
+
/* Copy the setenv.bat file if have one and need one */
if (g_srcsetenvbat)
@@ -841,7 +845,7 @@ static void configure(void)
}
/* Open the file for appending */
-
+
stream = fopen(destconfig, "a");
if (!stream)
{
diff --git a/nuttx/tools/mkdeps.c b/nuttx/tools/mkdeps.c
index fd85213bd..646f0e3ad 100644
--- a/nuttx/tools/mkdeps.c
+++ b/nuttx/tools/mkdeps.c
@@ -54,6 +54,10 @@
#define MAX_BUFFER (4096)
+#ifdef WIN32
+# define NAME_MAX FILENAME_MAX
+#endif
+
/****************************************************************************
* Private Types
****************************************************************************/
@@ -171,7 +175,7 @@ static void append(char **base, char *str)
oldbase = *base;
if (!oldbase)
{
- newbase = strdup(str);
+ newbase = strdup(str);
if (!newbase)
{
fprintf(stderr, "ERROR: Failed to strdup %s\n", str);
@@ -187,7 +191,7 @@ static void append(char **base, char *str)
fprintf(stderr, "ERROR: Failed to allocate %d bytes\n", alloclen);
exit(EXIT_FAILURE);
}
-
+
snprintf(newbase, alloclen, "%s %s\n", oldbase, str);
free(oldbase);
}
@@ -277,7 +281,7 @@ static void parse_args(int argc, char **argv)
}
else
{
- append(&g_altpath, argv[argidx]);
+ append(&g_altpath, argv[argidx]);
}
}
else if (strcmp(argv[argidx], "--obj-path") == 0)
@@ -359,7 +363,7 @@ static void parse_args(int argc, char **argv)
{
fprintf(stderr, " OBJDIR : (None)\n");
}
-
+
#ifdef HAVE_WINPATH
fprintf(stderr, " Windows Paths : [%s]\n", g_winpath ? "TRUE" : "FALSE");
if (g_winpath)
@@ -544,7 +548,7 @@ static void do_dependency(const char *file, char separator)
totallen, MAX_BUFFER);
exit(EXIT_FAILURE);
}
-
+
strcat(g_command, file);
/* Check that a file actually exists at this path */
@@ -573,7 +577,7 @@ static void do_dependency(const char *file, char separator)
* compiler, system() will return -1; Otherwise, the returned value
* from the compiler is in WEXITSTATUS(ret).
*/
-
+
ret = system(g_command);
#ifdef WEXITSTATUS
if (ret < 0 || WEXITSTATUS(ret) != 0)
@@ -598,9 +602,9 @@ static void do_dependency(const char *file, char separator)
exit(EXIT_FAILURE);
}
#endif
-
+
/* We don't really know that the command succeeded... Let's assume that it did */
-
+
free(alloc);
return;
}
@@ -632,7 +636,7 @@ static char *cywin2windows(const char *str, const char *append, enum slashmode_e
if (append)
{
char *tmp;
-
+
alloclen = sizeof(str) + sizeof(append) + 1;
allocpath = (char *)malloc(alloclen);
if (!allocpath)