Fix some mkdeps.c issues; Incorporate mkdeps.c build in Makefiles

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5343 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-11-13 02:39:01 +00:00
parent 8f47445bd5
commit 46541cf0fa
5 changed files with 69 additions and 58 deletions

View File

@ -321,8 +321,8 @@ endif
# part of the overall NuttX configuration sequence. Notice that the
# tools/mkversion tool is built and used to create include/nuttx/version.h
tools/mkversion:
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkversion
tools/mkversion$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkversion$(HOSTEXEEXT)
$(TOPDIR)/.version:
$(Q) if [ ! -f .version ]; then \
@ -331,19 +331,24 @@ $(TOPDIR)/.version:
chmod 755 .version; \
fi
include/nuttx/version.h: $(TOPDIR)/.version tools/mkversion
include/nuttx/version.h: $(TOPDIR)/.version tools/mkversion$(HOSTEXEEXT)
$(Q) tools/mkversion $(TOPDIR) > include/nuttx/version.h
# Targets used to build include/nuttx/config.h. Creation of config.h is
# part of the overall NuttX configuration sequence. Notice that the
# tools/mkconfig tool is built and used to create include/nuttx/config.h
tools/mkconfig:
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig
tools/mkconfig$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig$(HOSTEXEEXT)
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig$(HOSTEXEEXT)
$(Q) tools/mkconfig $(TOPDIR) > include/nuttx/config.h
# Targets used to create dependencies
tools/mkdeps$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkdeps$(HOSTEXEEXT)
# dirlinks, and helpers
#
# Directories links. Most of establishing the NuttX configuration involves
@ -550,7 +555,7 @@ lib/libc$(LIBEXT): libc/libc$(LIBEXT)
# is an archive. Exactly what is performed during pass1 or what it generates
# is unknown to this makefule unless CONFIG_PASS1_OBJECT is defined.
pass1deps: context pass1dep $(USERLIBS)
pass1deps: pass1dep $(USERLIBS)
pass1: pass1deps
ifeq ($(CONFIG_BUILD_2PASS),y)
@ -569,7 +574,7 @@ ifeq ($(CONFIG_BUILD_2PASS),y)
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" LINKLIBS="$(LINKLIBS)" USERLIBS="$(USERLIBS)" "$(CONFIG_PASS1_TARGET)"
endif
pass2deps: context pass2dep $(NUTTXLIBS)
pass2deps: pass2dep $(NUTTXLIBS)
pass2: pass2deps
$(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" EXTRA_OBJS="$(EXTRA_OBJS)" LINKLIBS="$(LINKLIBS)" EXTRADEFINES=$(KDEFINE) $(BIN)
@ -619,12 +624,12 @@ download: $(BIN)
# pass1dep: Create pass1 build dependencies
# pass2dep: Create pass2 build dependencies
pass1dep: context
pass1dep: context tools/mkdeps$(HOSTEXEEXT)
$(Q) for dir in $(USERDEPDIRS) ; do \
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" depend ; \
done
pass2dep: context
pass2dep: context tools/mkdeps$(HOSTEXEEXT)
$(Q) for dir in $(KERNDEPDIRS) ; do \
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" EXTRADEFINES=$(KDEFINE) depend; \
done

View File

@ -314,8 +314,8 @@ endif
# part of the overall NuttX configuration sequence. Notice that the
# tools\mkversion tool is built and used to create include\nuttx\version.h
tools\mkversion:
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkversion
tools\mkversion$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkversion$(HOSTEXEEXT)
$(TOPDIR)\.version:
$(Q) if [ ! -f .version ]; then \
@ -324,18 +324,23 @@ $(TOPDIR)\.version:
chmod 755 .version; \
fi
include\nuttx\version.h: $(TOPDIR)\.version tools\mkversion
$(Q) tools\mkversion $(TOPDIR) > include\nuttx\version.h
include\nuttx\version.h: $(TOPDIR)\.version tools\mkversion$(HOSTEXEEXT)
$(Q) tools\mkversion$(HOSTEXEEXT) $(TOPDIR) > include\nuttx\version.h
# Targets used to build include\nuttx\config.h. Creation of config.h is
# part of the overall NuttX configuration sequence. Notice that the
# tools\mkconfig tool is built and used to create include\nuttx\config.h
tools\mkconfig:
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig
tools\mkconfig$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig$(HOSTEXEEXT)
include\nuttx\config.h: $(TOPDIR)\.config tools\mkconfig
$(Q) tools\mkconfig $(TOPDIR) > include\nuttx\config.h
include\nuttx\config.h: $(TOPDIR)\.config tools\mkconfig$(HOSTEXEEXT)
$(Q) tools\mkconfig$(HOSTEXEEXT) $(TOPDIR) > include\nuttx\config.h
# Targets used to create dependencies
tools/mkdeps$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkdeps$(HOSTEXEEXT)
# dirlinks, and helpers
#
@ -566,7 +571,7 @@ lib\libc$(LIBEXT): libc\libc$(LIBEXT)
# is an archive. Exactly what is performed during pass1 or what it generates
# is unknown to this makefule unless CONFIG_PASS1_OBJECT is defined.
pass1deps: context pass1dep $(USERLIBS)
pass1deps: pass1dep $(USERLIBS)
pass1: pass1deps
ifeq ($(CONFIG_BUILD_2PASS),y)
@ -585,7 +590,7 @@ ifeq ($(CONFIG_BUILD_2PASS),y)
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" LINKLIBS="$(LINKLIBS)" USERLIBS="$(USERLIBS)" "$(CONFIG_PASS1_TARGET)"
endif
pass2deps: context pass2dep $(NUTTXLIBS)
pass2deps: pass2dep $(NUTTXLIBS)
pass2: pass2deps
$(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" EXTRA_OBJS="$(EXTRA_OBJS)" LINKLIBS="$(LINKLIBS)" EXTRADEFINES=$(KDEFINE) $(BIN)
@ -635,10 +640,10 @@ download: $(BIN)
# pass1dep: Create pass1 build dependencies
# pass2dep: Create pass2 build dependencies
pass1dep: context
pass1dep: context tools/mkdeps$(HOSTEXEEXT)
$(Q) for %%G in ($(USERDEPDIRS)) do ( $(MAKE) -C %%G TOPDIR="$(TOPDIR)" depend )
pass2dep: context
pass2dep: context tools/mkdeps$(HOSTEXEEXT)
$(Q) for %%G in ($(KERNDEPDIRS)) do ( $(MAKE) -C %%G TOPDIR="$(TOPDIR)" EXTRADEFINES=$(KDEFINE) depend )
# Configuration targets

View File

@ -135,3 +135,5 @@ HOSTCC = mingw-gcc.exe
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
HOSTEXEEXT = .exe

View File

@ -37,10 +37,10 @@ TOPDIR ?= ${shell pwd}/..
-include $(TOPDIR)/Make.defs
include ${TOPDIR}/tools/Config.mk
all: mkconfig$(EXEEXT) mkversion$(EXEEXT) mksyscall$(EXEEXT) bdf-converter$(EXEEXT) mksymtab$(EXEEXT) mkdeps$(EXEEXT)
default: mkconfig$(EXEEXT) mksyscall$(EXEEXT) mkdeps$(EXEEXT)
all: mkconfig$(HOSTEXEEXT) mkversion$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) bdf-converter$(HOSTEXEEXT) mksymtab$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT)
default: mkconfig$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT)
ifdef EXEEXT
ifdef HOSTEXEEXT
.PHONY: clean mkconfig mkversion mksyscall bdf-converter mksymtab mkdeps
else
.PHONY: clean
@ -53,11 +53,11 @@ HOSTCC ?= gcc
# mkconfig - Convert a .config file into a C config.h file
mkconfig$(EXEEXT): mkconfig.c cfgparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkconfig$(EXEEXT) mkconfig.c cfgparser.c
mkconfig$(HOSTEXEEXT): mkconfig.c cfgparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkconfig$(HOSTEXEEXT) mkconfig.c cfgparser.c
ifdef EXEEXT
mkconfig: mkconfig$(EXEEXT)
ifdef HOSTEXEEXT
mkconfig: mkconfig$(HOSTEXEEXT)
endif
# cmpconfig - Compare the contents of two configuration files
@ -65,53 +65,53 @@ endif
cmpconfig: cmpconfig.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o cmpconfig cmpconfig.c
ifdef EXEEXT
cmpconfig: cmpconfig$(EXEEXT)
ifdef HOSTEXEEXT
cmpconfig: cmpconfig$(HOSTEXEEXT)
endif
# mkversion - Convert a .version file into a C version.h file
mkversion$(EXEEXT): mkconfig.c cfgparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkversion$(EXEEXT) mkversion.c cfgparser.c
mkversion$(HOSTEXEEXT): mkconfig.c cfgparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkversion$(HOSTEXEEXT) mkversion.c cfgparser.c
ifdef EXEEXT
mkversion: mkversion$(EXEEXT)
ifdef HOSTEXEEXT
mkversion: mkversion$(HOSTEXEEXT)
endif
# mksyscall - Convert a CSV file into syscall stubs and proxies
mksyscall$(EXEEXT): mksyscall.c csvparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mksyscall$(EXEEXT) mksyscall.c csvparser.c
mksyscall$(HOSTEXEEXT): mksyscall.c csvparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mksyscall$(HOSTEXEEXT) mksyscall.c csvparser.c
ifdef EXEEXT
mksyscall: mksyscall$(EXEEXT)
ifdef HOSTEXEEXT
mksyscall: mksyscall$(HOSTEXEEXT)
endif
# mksymtab - Convert a CSV file into a symbol table
mksymtab$(EXEEXT): mksymtab.c csvparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mksymtab$(EXEEXT) mksymtab.c csvparser.c
mksymtab$(HOSTEXEEXT): mksymtab.c csvparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mksymtab$(HOSTEXEEXT) mksymtab.c csvparser.c
ifdef EXEEXT
mksymtab: mksymtab$(EXEEXT)
ifdef HOSTEXEEXT
mksymtab: mksymtab$(HOSTEXEEXT)
endif
# bdf-converter - Converts a BDF font to the NuttX font format
bdf-converter$(EXEEXT): bdf-converter.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o bdf-converter$(EXEEXT) bdf-converter.c
bdf-converter$(HOSTEXEEXT): bdf-converter.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o bdf-converter$(HOSTEXEEXT) bdf-converter.c
ifdef EXEEXT
bdf-converter: bdf-converter$(EXEEXT)
ifdef HOSTEXEEXT
bdf-converter: bdf-converter$(HOSTEXEEXT)
endif
# Create dependencies for a list of files
mkdeps$(EXEEXT): mkdeps.c csvparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkdeps$(EXEEXT) mkdeps.c
mkdeps$(HOSTEXEEXT): mkdeps.c csvparser.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkdeps$(HOSTEXEEXT) mkdeps.c
ifdef EXEEXT
mkdeps: mkdeps$(EXEEXT)
ifdef HOSTEXEEXT
mkdeps: mkdeps$(HOSTEXEEXT)
endif
clean:

View File

@ -105,7 +105,7 @@ static void append(char **base, char *str)
}
else
{
alloclen = strlen(newbase) + strlen(str) + 2;
alloclen = strlen(oldbase) + strlen(str) + 2;
newbase = (char *)malloc(alloclen);
if (!newbase)
{
@ -288,7 +288,6 @@ static void do_dependency(const char *file, char separator)
struct stat buf;
char *altpath;
char *path;
char *bufptr;
int cmdlen;
int pathlen;
int filelen;
@ -300,7 +299,7 @@ static void do_dependency(const char *file, char separator)
cmdlen = strlen(g_cc);
if (cmdlen >= MAX_BUFFER)
{
fprintf(stderr, "ERROR: Compiler string is too long: %s\n", path);
fprintf(stderr, "ERROR: Compiler string is too long: %s\n", g_cc);
exit(EXIT_FAILURE);
}
@ -355,7 +354,7 @@ static void do_dependency(const char *file, char separator)
if (command[totallen] != '\0')
{
fprintf(stderr, "ERROR: Missing NUL terminator\n", path);
fprintf(stderr, "ERROR: Missing NUL terminator\n");
exit(EXIT_FAILURE);
}
@ -379,7 +378,7 @@ static void do_dependency(const char *file, char separator)
/* Check that a file actually exists at this path */
ret = stat(command, &buf);
ret = stat(&command[cmdlen], &buf);
if (ret < 0)
{
altpath = NULL;
@ -388,7 +387,7 @@ static void do_dependency(const char *file, char separator)
if (!S_ISREG(buf.st_mode))
{
fprintf(stderr, "ERROR: File %s exists but is not a regular file\n");
fprintf(stderr, "ERROR: File %s exists but is not a regular file\n", &command[cmdlen]);
exit(EXIT_FAILURE);
}
@ -397,7 +396,7 @@ static void do_dependency(const char *file, char separator)
ret = system(command);
if (ret != 0)
{
fprintf(stderr, "ERROR: ssystem(%s) failed\n");
fprintf(stderr, "ERROR: ssystem(%s) failed\n", command);
exit(EXIT_FAILURE);
}