Dependency generation fix for directories that keep object files in a sub-directory
This commit is contained in:
parent
417f67c132
commit
c038f4efe0
@ -5666,4 +5666,7 @@
|
||||
* nuttx/fs/fs_sendfile.c, nuttx/net/net_sendfile.c, and other file:
|
||||
Integrate an optimized sendfile() operation from Max Holtzberg
|
||||
(2013-9-28).
|
||||
|
||||
* tools/mkdeps.*, nuttx/mm/Makefile, nuttx/libc/Makefile: Dependency
|
||||
generation generation was broken for directories that keep objects in
|
||||
a sub-directory. Fixed by adding a object path to the mkdeps.c,
|
||||
mkdeps.bat, mkdeps.sh tools (2013-0-29).
|
||||
|
@ -359,6 +359,7 @@
|
||||
#define PIO_WPMR_WPEN (1 << 0) /* Bit 0: Write Protect Enable */
|
||||
#define PIO_WPMR_WPKEY_SHIFT (8) /* Bits 8-31: Write Protect KEY */
|
||||
#define PIO_WPMR_WPKEY_MASK (0xffffff << PIO_WPMR_WPKEY_SHIFT)
|
||||
# define PIO_WPMR_WPKEY (0x50494f << PIO_WPMR_WPKEY_SHIFT)
|
||||
|
||||
/* PIO Write Protect Status Register */
|
||||
|
||||
|
4
libc/.gitignore
vendored
4
libc/.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
/Make.dep
|
||||
/Make_bin.dep
|
||||
/Make_ubin.dep
|
||||
/Make_kbin.dep
|
||||
/.depend
|
||||
/*.asm
|
||||
/*.obj
|
||||
|
@ -105,7 +105,12 @@ endif
|
||||
# Dependencies
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
$(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
$(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep
|
||||
$(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_kbin.dep
|
||||
else
|
||||
$(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep
|
||||
endif
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
@ -127,7 +132,11 @@ distclean: clean
|
||||
$(Q) $(MAKE) -C bin distclean TOPDIR=$(TOPDIR)
|
||||
$(Q) $(MAKE) -C ubin distclean TOPDIR=$(TOPDIR)
|
||||
$(Q) $(MAKE) -C kbin distclean TOPDIR=$(TOPDIR)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, Make_bin.dep)
|
||||
$(call DELFILE, Make_ubin.dep)
|
||||
$(call DELFILE, Make_kbin.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
-include Make_bin.dep
|
||||
-include Make_ubin.dep
|
||||
-include Make_kbin.dep
|
||||
|
4
mm/.gitignore
vendored
4
mm/.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
/Make.dep
|
||||
/Make_bin.dep
|
||||
/Make_ubin.dep
|
||||
/Make_kbin.dep
|
||||
/.depend
|
||||
/*.asm
|
||||
/*.obj
|
||||
|
15
mm/Makefile
15
mm/Makefile
@ -100,7 +100,12 @@ endif
|
||||
# Dependencies
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
$(Q) $(MKDEP) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
$(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep
|
||||
$(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_kbin.dep
|
||||
else
|
||||
$(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep
|
||||
endif
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
@ -122,7 +127,11 @@ distclean: clean
|
||||
$(Q) $(MAKE) -C bin distclean TOPDIR=$(TOPDIR)
|
||||
$(Q) $(MAKE) -C ubin distclean TOPDIR=$(TOPDIR)
|
||||
$(Q) $(MAKE) -C kbin distclean TOPDIR=$(TOPDIR)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, Make_bin.dep)
|
||||
$(call DELFILE, Make_ubin.dep)
|
||||
$(call DELFILE, Make_kbin.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
-include Make_bin.dep
|
||||
-include Make_ubin.dep
|
||||
-include Make_kbin.dep
|
||||
|
@ -180,7 +180,7 @@ config NET_SENDFILE
|
||||
bool "Optimized network sendfile()"
|
||||
default n
|
||||
---help---
|
||||
Support larger, high performance sendfile() from transferring
|
||||
Support larger, higher performance sendfile() for transferring
|
||||
files out a TCP connection.
|
||||
|
||||
endif # NET_TCP
|
||||
|
@ -39,6 +39,8 @@ set cflags=
|
||||
set altpath=
|
||||
set files=
|
||||
set args=
|
||||
set objpath=
|
||||
set suffix=.o
|
||||
set debug=n
|
||||
|
||||
:Loop
|
||||
@ -61,6 +63,18 @@ if "%1"=="--dep-path" (
|
||||
goto NextParm
|
||||
)
|
||||
|
||||
if "%1"=="--obj-path" (
|
||||
set objpath=%2
|
||||
shift
|
||||
goto NextParm
|
||||
)
|
||||
|
||||
if "%1"=="--obj-suffix" (
|
||||
set suffix=%2
|
||||
shift
|
||||
goto NextParm
|
||||
)
|
||||
|
||||
if "%1"=="--dep-debug" (
|
||||
rem @echo on
|
||||
set debug=y
|
||||
@ -111,8 +125,15 @@ for %%G in (%files%) do (
|
||||
call :Checkpaths
|
||||
if "%debug%"=="y" echo %file%: fullpath=%fullpath%
|
||||
if "%fullpath%"=="" goto :NoFile
|
||||
|
||||
mtarg=""
|
||||
if "%objpath%"=="" (
|
||||
set objname=%~n1
|
||||
set mtarg="-MT %objpath%\%objname%%suffix%
|
||||
)
|
||||
|
||||
if "%debug%"=="y" echo CMD: %cc% -M %cflags% %fullpath%
|
||||
%cc% -M %cflags% %fullpath% || goto DepFail
|
||||
%cc% -M %mtarg% %cflags% %fullpath% || goto DepFail
|
||||
)
|
||||
goto :End
|
||||
|
||||
@ -167,6 +188,12 @@ echo --dep-path ^<path^>
|
||||
echo Do not look in the current directory for the file. Instead, look in <path> to see
|
||||
echo if the file resides there. --dep-path may be used multiple times to specify
|
||||
echo multiple alternative location
|
||||
echo --obj-path ^<path^>
|
||||
echo The final objects will not reside in this path but, rather, at the path provided by
|
||||
echo ^<path^>. if provided multiple time, only the last --obj-path will be used.
|
||||
echo --obj-suffix ^<suffix^>
|
||||
echo If and object path is provided, then the extension will be assumed to be .o. This
|
||||
echo default suffix can be overrided with this command line option.
|
||||
echo --help
|
||||
echo Shows this message and exits
|
||||
|
||||
|
117
tools/mkdeps.c
117
tools/mkdeps.c
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* tools/mkdeps.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -45,6 +45,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
@ -68,15 +69,20 @@ enum slashmode_e
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static char *g_cc = NULL;
|
||||
static char *g_cflags = NULL;
|
||||
static char *g_files = NULL;
|
||||
static char *g_altpath = NULL;
|
||||
static int g_debug = 0;
|
||||
static char *g_cc = NULL;
|
||||
static char *g_cflags = NULL;
|
||||
static char *g_files = NULL;
|
||||
static char *g_altpath = NULL;
|
||||
static char *g_objpath = NULL;
|
||||
static char *g_suffix = ".o";
|
||||
static int g_debug = 0;
|
||||
static bool g_winnative = false;
|
||||
#ifdef HAVE_WINPATH
|
||||
static bool g_winpath = false;
|
||||
static char *g_topdir = NULL;
|
||||
static bool g_winpath = false;
|
||||
static char *g_topdir = NULL;
|
||||
#define DELIM "\\"
|
||||
#else
|
||||
#define DELIM "/"
|
||||
#endif
|
||||
|
||||
static char g_command[MAX_BUFFER];
|
||||
@ -217,6 +223,12 @@ static void show_usage(const char *progname, const char *msg, int exitcode)
|
||||
fprintf(stderr, " Do not look in the current directory for the file. Instead, look in <path> to see\n");
|
||||
fprintf(stderr, " if the file resides there. --dep-path may be used multiple times to specify\n");
|
||||
fprintf(stderr, " multiple alternative location\n");
|
||||
fprintf(stderr, " --obj-path <path>\n");
|
||||
fprintf(stderr, " The final objects will not reside in this path but, rather, at the path provided by\n");
|
||||
fprintf(stderr, " <path>. if provided multiple time, only the last --obj-path will be used.\n");
|
||||
fprintf(stderr, " --obj-suffix <suffix>\n");
|
||||
fprintf(stderr, " If and object path is provided, then the extension will be assumed to be .o. This\n");
|
||||
fprintf(stderr, " default suffix can be overrided with this command line option.\n");
|
||||
fprintf(stderr, " --winnative\n");
|
||||
fprintf(stderr, " By default, a POSIX-style environment is assumed (e.g., Linux, Cygwin, etc.) This option is\n");
|
||||
fprintf(stderr, " inform the tool that is working in a pure Windows native environment.\n");
|
||||
@ -268,6 +280,26 @@ static void parse_args(int argc, char **argv)
|
||||
append(&g_altpath, argv[argidx]);
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[argidx], "--obj-path") == 0)
|
||||
{
|
||||
argidx++;
|
||||
if (argidx >= argc)
|
||||
{
|
||||
show_usage(argv[0], "ERROR: Missing argument to --obj-path", EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_objpath = argv[argidx];
|
||||
}
|
||||
else if (strcmp(argv[argidx], "--obj-suffix") == 0)
|
||||
{
|
||||
argidx++;
|
||||
if (argidx >= argc)
|
||||
{
|
||||
show_usage(argv[0], "ERROR: Missing argument to --obj-suffix", EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_suffix = argv[argidx];
|
||||
}
|
||||
else if (strcmp(argv[argidx], "--winnative") == 0)
|
||||
{
|
||||
g_winnative = true;
|
||||
@ -318,6 +350,16 @@ static void parse_args(int argc, char **argv)
|
||||
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)");
|
||||
if (g_objpath)
|
||||
{
|
||||
fprintf(stderr, " OBJDIR : [%s]\n", g_objpath);
|
||||
fprintf(stderr, " SUFFIX : [%s]\n", g_suffix);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, " OBJDIR : (None)\n");
|
||||
}
|
||||
|
||||
#ifdef HAVE_WINPATH
|
||||
fprintf(stderr, " Windows Paths : [%s]\n", g_winpath ? "TRUE" : "FALSE");
|
||||
if (g_winpath)
|
||||
@ -389,17 +431,60 @@ static void do_dependency(const char *file, char separator)
|
||||
|
||||
strcat(g_command, moption);
|
||||
|
||||
/* Copy the CFLAGS into the command buffer */
|
||||
/* Copy " -MT " */
|
||||
|
||||
cmdlen += strlen(g_cflags);
|
||||
if (cmdlen >= MAX_BUFFER)
|
||||
if (g_objpath)
|
||||
{
|
||||
fprintf(stderr, "ERROR: CFLAG string is too long [%d/%d]: %s\n",
|
||||
cmdlen, MAX_BUFFER, g_cflags);
|
||||
exit(EXIT_FAILURE);
|
||||
char tmp[NAME_MAX+6];
|
||||
char *dupname;
|
||||
char *objname;
|
||||
char *dotptr;
|
||||
|
||||
dupname = strdup(file);
|
||||
if (!dupname)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Failed to dup: %s\n", file);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
objname = basename(dupname);
|
||||
dotptr = strrchr(objname, '.');
|
||||
if (dotptr)
|
||||
{
|
||||
dotptr = '\0';
|
||||
}
|
||||
|
||||
snprintf(tmp, NAME_MAX+6, " -MT %s" DELIM "%s%s ",
|
||||
g_objpath, objname, g_suffix);
|
||||
|
||||
cmdlen += strlen(tmp);
|
||||
if (cmdlen >= MAX_BUFFER)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Option string is too long [%d/%d]: %s\n",
|
||||
cmdlen, MAX_BUFFER, moption);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
strcat(g_command, tmp);
|
||||
free(dupname);
|
||||
}
|
||||
|
||||
strcat(g_command, g_cflags);
|
||||
strcat(g_command, moption);
|
||||
|
||||
/* Copy the CFLAGS into the command buffer */
|
||||
|
||||
if (g_cflags)
|
||||
{
|
||||
cmdlen += strlen(g_cflags);
|
||||
if (cmdlen >= MAX_BUFFER)
|
||||
{
|
||||
fprintf(stderr, "ERROR: CFLAG string is too long [%d/%d]: %s\n",
|
||||
cmdlen, MAX_BUFFER, g_cflags);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
strcat(g_command, g_cflags);
|
||||
}
|
||||
|
||||
/* Add a space */
|
||||
|
||||
@ -699,7 +784,7 @@ int main(int argc, char **argv, char **envp)
|
||||
files = g_files;
|
||||
while ((file = strtok_r(files, " ", &lasts)) != NULL)
|
||||
{
|
||||
/* Check if we need to do path conversions for a Windows-natvie tool
|
||||
/* Check if we need to do path conversions for a Windows-natvive tool
|
||||
* being using in a POSIX/Cygwin environment.
|
||||
*/
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
############################################################################
|
||||
# tools/mkdeps.sh
|
||||
#
|
||||
# Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -33,7 +33,6 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
#
|
||||
# Usage:
|
||||
|
||||
@ -58,6 +57,12 @@ show_usage ()
|
||||
echo " Do not look in the current directory for the file. Instead, look in <path> to see"
|
||||
echo " if the file resides there. --dep-path may be used multiple times to specify"
|
||||
echo " multiple alternative location"
|
||||
echo " --obj-path <path>"
|
||||
echo " The final objects will not reside in this path but, rather, at the path provided by"
|
||||
echo " <path>. if provided multiple time, only the last --obj-path will be used."
|
||||
echo " --obj-suffix <suffix>"
|
||||
echo " If and object path is provided, then the extension will be assumed to be .o. This"
|
||||
echo " default suffix can be overrided with this command line option."
|
||||
echo " --winpaths <TOPDIR>"
|
||||
echo " CC generates dependency lists using Windows paths (e.g., C:\blablah\blabla). This"
|
||||
echo " switch instructs the script to use 'cygpath' to convert the Windows paths to Cygwin"
|
||||
@ -91,7 +96,14 @@ dodep ()
|
||||
fi
|
||||
fi
|
||||
|
||||
$cc -M $cflags $fullpath || \
|
||||
unset mtarg
|
||||
if [ ! -z "$objpath" ]; then
|
||||
srcname=`basename $1`
|
||||
objname="${srcname%.*}"
|
||||
mtarg="-MT ${objpath}/${objname}${suffix}"
|
||||
fi
|
||||
|
||||
$cc -M $mtarg $cflags $fullpath || \
|
||||
( echo "# ERROR: $cc -M $cflags $fullpath FAILED"; exit 4; )
|
||||
}
|
||||
|
||||
@ -100,6 +112,8 @@ unset cflags
|
||||
unset files
|
||||
unset args
|
||||
unset altpath
|
||||
unset objpath
|
||||
suffix=.o
|
||||
winpaths=n
|
||||
unset topdir
|
||||
|
||||
@ -127,6 +141,14 @@ while [ ! -z "$1" ]; do
|
||||
args="$args $1"
|
||||
fi
|
||||
;;
|
||||
--obj-path )
|
||||
shift
|
||||
objpath="$1"
|
||||
;;
|
||||
--obj-suffix )
|
||||
shift
|
||||
suffix="$1"
|
||||
;;
|
||||
--winpaths )
|
||||
if [ -z "$args" ]; then
|
||||
shift
|
||||
|
Loading…
Reference in New Issue
Block a user