From 4ee266d94bc7df703153d205bb1b1ccd5891375e Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 13 Nov 2012 20:24:30 +0000 Subject: [PATCH] Centralized the definition of the INCDIR script in tools/Config.mk git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5346 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 3 + binfmt/Makefile | 2 +- configs/stm32f4discovery/winbuild/Make.defs | 2 +- drivers/analog/Make.defs | 6 +- drivers/bch/Make.defs | 4 +- drivers/input/Make.defs | 4 +- drivers/lcd/Make.defs | 2 +- drivers/mmcsd/Make.defs | 4 +- drivers/power/Make.defs | 4 +- drivers/sensors/Make.defs | 4 +- drivers/usbdev/Make.defs | 2 +- drivers/usbhost/Make.defs | 4 +- drivers/wireless/Make.defs | 4 +- graphics/Makefile | 14 ++-- tools/Config.mk | 81 ++++++++++++++++++++- tools/Makefile.host | 7 ++ tools/README.txt | 39 +++++++++- tools/mkdeps.c | 69 ++++++++++++++++++ 18 files changed, 223 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f92fdf7af..31700214f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3613,3 +3613,6 @@ critical CFLAG values that cannot be passed on the CMD.exe command line (line '='). mkdeps.c is a work in progress that will, hopefully, replace both mkdeps.sh and mkdeps.bat. + * tools/Config.mk: Centralize the definition of the scrpt that will be + used to generated header file include paths for the compiler. This + needs to be centralized in order to support the Windows native build. diff --git a/binfmt/Makefile b/binfmt/Makefile index 365997be8b..378a737f60 100644 --- a/binfmt/Makefile +++ b/binfmt/Makefile @@ -38,7 +38,7 @@ ifeq ($(WINTOOL),y) INCDIROPT = -w endif -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/sched} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/sched} # Basic BINFMT source files diff --git a/configs/stm32f4discovery/winbuild/Make.defs b/configs/stm32f4discovery/winbuild/Make.defs index 75051da515..28cf8a5619 100644 --- a/configs/stm32f4discovery/winbuild/Make.defs +++ b/configs/stm32f4discovery/winbuild/Make.defs @@ -130,7 +130,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) LDFLAGS += -g endif -HOSTCC = mingw-gcc.exe +HOSTCC = mingw32-gcc.exe HOSTINCLUDES = -I. HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe HOSTLDFLAGS = diff --git a/drivers/analog/Make.defs b/drivers/analog/Make.defs index d94e397587..425193f7e5 100644 --- a/drivers/analog/Make.defs +++ b/drivers/analog/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # drivers/analog/Make.defs # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -76,12 +76,12 @@ endif ifeq ($(CONFIG_DAC),y) DEPPATH += --dep-path analog VPATH += :analog - CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/analog} + CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/analog} else ifeq ($(CONFIG_ADC),y) DEPPATH += --dep-path analog VPATH += :analog - CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/analog} + CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/analog} endif endif diff --git a/drivers/bch/Make.defs b/drivers/bch/Make.defs index bc22df8e26..2745fcfff0 100644 --- a/drivers/bch/Make.defs +++ b/drivers/bch/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # drivers/bch/Make.defs # -# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -46,7 +46,7 @@ CSRCS += bchlib_setup.c bchlib_teardown.c bchlib_read.c bchlib_write.c \ DEPPATH += --dep-path bch VPATH += :bch -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/bch} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/bch} endif endif diff --git a/drivers/input/Make.defs b/drivers/input/Make.defs index 8b009760c4..8afd76f89e 100644 --- a/drivers/input/Make.defs +++ b/drivers/input/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # drivers/input/Make.defs # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -71,6 +71,6 @@ endif DEPPATH += --dep-path input VPATH += :input -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/input} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/input} endif diff --git a/drivers/lcd/Make.defs b/drivers/lcd/Make.defs index 575751d393..8b6d300523 100644 --- a/drivers/lcd/Make.defs +++ b/drivers/lcd/Make.defs @@ -67,6 +67,6 @@ endif DEPPATH += --dep-path lcd VPATH += :lcd -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/lcd} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/lcd} endif diff --git a/drivers/mmcsd/Make.defs b/drivers/mmcsd/Make.defs index 410da741b6..0ba5efb7f1 100644 --- a/drivers/mmcsd/Make.defs +++ b/drivers/mmcsd/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # drivers/mmcsd/Make.defs # -# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ endif DEPPATH += --dep-path mmcsd VPATH += :mmcsd -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/mmcsd} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/mmcsd} endif diff --git a/drivers/power/Make.defs b/drivers/power/Make.defs index 45c6aebc32..9e6307ae21 100644 --- a/drivers/power/Make.defs +++ b/drivers/power/Make.defs @@ -47,7 +47,7 @@ CSRCS += pm_activity.c pm_changestate.c pm_checkstate.c pm_initialize.c pm_regis POWER_DEPPATH := --dep-path power POWER_VPATH := :power -POWER_CFLAGS := ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/power} +POWER_CFLAGS := ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/power} endif @@ -73,7 +73,7 @@ endif POWER_DEPPATH := --dep-path power POWER_VPATH := :power -POWER_CFLAGS := ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/power} +POWER_CFLAGS := ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/power} endif diff --git a/drivers/sensors/Make.defs b/drivers/sensors/Make.defs index 866ccb0536..17750831ec 100644 --- a/drivers/sensors/Make.defs +++ b/drivers/sensors/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # drivers/sensors/Make.defs # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -57,4 +57,4 @@ endif DEPPATH += --dep-path sensors VPATH += :sensors -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/sensors} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/sensors} diff --git a/drivers/usbdev/Make.defs b/drivers/usbdev/Make.defs index f1b3c405ae..782c185452 100644 --- a/drivers/usbdev/Make.defs +++ b/drivers/usbdev/Make.defs @@ -59,5 +59,5 @@ CSRCS += usbdev_trace.c usbdev_trprintf.c DEPPATH += --dep-path usbdev VPATH += :usbdev -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/usbdev} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/usbdev} endif diff --git a/drivers/usbhost/Make.defs b/drivers/usbhost/Make.defs index fd54ab53e7..91753ef318 100644 --- a/drivers/usbhost/Make.defs +++ b/drivers/usbhost/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # drivers/usbhost/Make.defs # -# Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -54,4 +54,4 @@ endif DEPPATH += --dep-path usbhost VPATH += :usbhost -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/usbhost} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/usbhost} diff --git a/drivers/wireless/Make.defs b/drivers/wireless/Make.defs index f47f7666a5..86ea90e25e 100644 --- a/drivers/wireless/Make.defs +++ b/drivers/wireless/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # drivers/wireless/Make.defs # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -43,5 +43,5 @@ CSRCS += cc1101.c ISM1_868MHzGFSK100kbps.c ISM2_905MHzGFSK250kbps.c DEPPATH += --dep-path wireless/cc1101 VPATH += :wireless/cc1101 -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/wireless/cc1101} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/wireless/cc1101} endif diff --git a/graphics/Makefile b/graphics/Makefile index f638587baf..09d7cfa266 100644 --- a/graphics/Makefile +++ b/graphics/Makefile @@ -44,34 +44,34 @@ endif include nxglib/Make.defs DEPPATH += --dep-path nxglib -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxglib} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxglib} include nxbe/Make.defs DEPPATH += --dep-path nxbe -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxbe} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxbe} ifeq ($(CONFIG_NX_MULTIUSER),y) include nxmu/Make.defs DEPPATH += --dep-path nxmu -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxmu} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxmu} else include nxsu/Make.defs DEPPATH += --dep-path nxsu -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxsu} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxsu} endif include nxtk/Make.defs DEPPATH += --dep-path nxtk -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxtk} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxtk} include nxfonts/Make.defs DEPPATH += --dep-path nxfonts -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxfonts} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxfonts} ifeq ($(CONFIG_NXCONSOLE),y) include nxconsole/Make.defs DEPPATH += --dep-path nxconsole -CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxconsole} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxconsole} endif ASRCS = $(NXGLIB_ASRCS) $(NXBE_ASRCS) $(NX_ASRCS) $(NXTK_ASRCS) $(NXFONTS_ASRCS) $(NXCON_ASRCS) diff --git a/tools/Config.mk b/tools/Config.mk index 06a312fc50..3a0714c10a 100644 --- a/tools/Config.mk +++ b/tools/Config.mk @@ -4,6 +4,9 @@ # # Author: Richard Cochran # +# This file (along with $(TOPDIR)/.config) must be included by every +# configuration-specific Make.defs file. +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: @@ -40,28 +43,104 @@ CONFIG_ARCH := $(patsubst "%",%,$(strip $(CONFIG_ARCH))) CONFIG_ARCH_CHIP := $(patsubst "%",%,$(strip $(CONFIG_ARCH_CHIP))) CONFIG_ARCH_BOARD := $(patsubst "%",%,$(strip $(CONFIG_ARCH_BOARD))) -# Default build rules. +# INCDIR - Convert a list of directory paths to a list of compiler include +# directirves +# Example: CFFLAGS += ${shell $(INCDIR) [options] "compiler" "dir1" "dir2" "dir2" ...} +# +# Note that the compiler string and each directory path string must quoted if +# they contain spaces or any other characters that might get mangled by the +# shell +# +# Depends on this setting passed as a make commaond line definition from the +# toplevel Makefile: +# +# TOPDIR - The path to the the top level NuttX directory in the form +# appropriate for the current build environment +# +# Depends on this settings defined in board-specific defconfig file installed +# at $(TOPDIR)/.config: +# +# CONFIG_WINDOWS_NATIVE - Defined for a Windows native build + +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + INCDIR = "$(TOPDIR)\tools\incdir.bat" +else + INCDIR = "$(TOPDIR)/tools/incdir.sh" +endif + +# PREPROCESS - Default macro to run the C pre-processor +# Example: $(call PREPROCESS, in-file, out-file) +# +# Depends on these settings defined in board-specific Make.defs file +# installed at $(TOPDIR)/Make.defs: +# +# CPP - The command to invoke the C pre-processor +# CPPFLAGS - Options to pass to the C pre-processor define PREPROCESS @echo "CPP: $1->$2" $(Q) $(CPP) $(CPPFLAGS) $1 -o $2 endef +# COMPILE - Default macro to compile one C file +# Example: $(call COMPILE, in-file, out-file) +# +# Depends on these settings defined in board-specific Make.defs file +# installed at $(TOPDIR)/Make.defs: +# +# CC - The command to invoke the C compiler +# CFLAGS - Options to pass to the C compiler + define COMPILE @echo "CC: $1" $(Q) $(CC) -c $(CFLAGS) $1 -o $2 endef +# COMPILEXX - Default macro to compile one C++ file +# Example: $(call COMPILEXX, in-file, out-file) +# +# Depends on these settings defined in board-specific Make.defs file +# installed at $(TOPDIR)/Make.defs: +# +# CXX - The command to invoke the C++ compiler +# CXXFLAGS - Options to pass to the C++ compiler + define COMPILEXX @echo "CXX: $1" $(Q) $(CXX) -c $(CXXFLAGS) $1 -o $2 endef +# ASSEMBLE - Default macro to assemble one assembly language file +# Example: $(call ASSEMBLE, in-file, out-file) +# +# Depends on these settings defined in board-specific Make.defs file +# installed at $(TOPDIR)/Make.defs: +# +# CC - By default, the C compiler is used to compile assembly lagnuage +# files +# AFLAGS - Options to pass to the C+compiler + define ASSEMBLE @echo "AS: $1" $(Q) $(CC) -c $(AFLAGS) $1 -o $2 endef +# ARCHIVE - Add a list of files to an archive +# Example: $(call ARCHIVE, archive-file, "file1 file2 file3 ...") +# +# Note: The fileN strings may not contain spaces or characters that may be +# interpreted strangely by the shell +# +# Depends on these settings defined in board-specific Make.defs file +# installed at $(TOPDIR)/Make.defs: +# +# AR - The command to invoke the archiver (includes any options) +# +# Depends on this settings defined in board-specific defconfig file installed +# at $(TOPDIR)/.config: +# +# CONFIG_WINDOWS_NATIVE - Defined for a Windows native build + ifeq ($(CONFIG_WINDOWS_NATIVE),y) define ARCHIVE @echo "AR: $2" diff --git a/tools/Makefile.host b/tools/Makefile.host index 882a3c0ae9..4786250088 100644 --- a/tools/Makefile.host +++ b/tools/Makefile.host @@ -37,6 +37,13 @@ TOPDIR ?= ${shell pwd}/.. -include $(TOPDIR)/Make.defs include ${TOPDIR}/tools/Config.mk +# strtok_r is used in some tools, but does not seem to be available in +# the MinGW environment. + +ifneq ($(CONFIG_WINDOWS_NATIVE),y) + HOSTCFLAGS += -D HAVE_STRTOK_C +endif + all: mkconfig$(HOSTEXEEXT) mkversion$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) bdf-converter$(HOSTEXEEXT) mksymtab$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) default: mkconfig$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) diff --git a/tools/README.txt b/tools/README.txt index 3c9730d001..38efc7a3f2 100644 --- a/tools/README.txt +++ b/tools/README.txt @@ -1,5 +1,5 @@ tools/README.txt -^^^^^^^^^^^^^^^^ +================ This README file addresses the contents of the NuttX tools/ directory. @@ -8,22 +8,38 @@ that are necessary parts of the the NuttX build system. These files include: README.txt +---------- - This file + This file! + +Config.mk +--------- + + This file contains common definitions used by many configureation files. + This file (along with /.config) must be included at the top of + each configuration-specific Make.defs file like: + + -include $(TOPDIR)/.config + include $(TOPDIR)/tools/Config.mk + + Subsequent logic within the configuration-specific Make.defs file may then + override these default definitions as necessary. configure.sh +------------ This is a bash script that is used to configure NuttX for a given target board. See configs/README.txt or Documentation/NuttxPortingGuide.html for a description of how to configure NuttX with this script. discover.py +----------- Example script for discovering devices in the local network. It is the counter part to apps/netutils/discover - mkconfig.c, cfgparser.c, and cfgparser.h +---------------------------------------- These are Cs file that are used to build mkconfig program. The mkconfig program is used during the initial NuttX build. @@ -38,11 +54,13 @@ mkconfig.c, cfgparser.c, and cfgparser.h NuttX configuration that can be included by C files. cmdconfig.c +----------- This C file can be used to build a utility for comparing two NuttX configuration files. mkexport.sh and Makefile.export +------------------------------- These implement part of the top-level Makefile's 'export' target. That target will bundle up all of the NuttX libraries, header files, and the @@ -51,6 +69,7 @@ mkexport.sh and Makefile.export options from the top-level Make.defs file. mkfsdata.pl +----------- This perl script is used to build the "fake" file system and CGI support as needed for the apps/netutils/webserver. It is currently used only @@ -61,6 +80,7 @@ mkfsdata.pl by Adam Dunkels. uIP has a license that is compatible with NuttX. mkversion.c, cfgparser.c, and cfgparser.h +----------------------------------------- This is C file that is used to build mkversion program. The mkversion program is used during the initial NuttX build. @@ -74,6 +94,7 @@ mkversion.c, cfgparser.c, and cfgparser.h version.h provides version information that can be included by C files. mksyscall.c, cvsparser.c, and cvsparser.h +----------------------------------------- This is a C file that is used to build mksyscall program. The mksyscall program is used during the initial NuttX build by the logic in the top- @@ -96,6 +117,7 @@ mksyscall.c, cvsparser.c, and cvsparser.h stub files as output. See syscall/README.txt for additonal information. mksymtab.c, cvsparser.c, and cvsparser.h +---------------------------------------- This is a C file that is used to build symbol tables from common-separated value (CSV) files. This tool is not used during the NuttX build, but @@ -116,10 +138,12 @@ mksymtab.c, cvsparser.c, and cvsparser.h ./mksymtab.exe tmp.csv tmp.c pic32mx +------- This directory contains build tools used only for PIC32MX platforms bdf-convert.c +------------- This C file is used to build the bdf-converter program. The bdf-converter program be used to convert fonts in Bitmap Distribution Format (BDF) @@ -255,6 +279,7 @@ bdf-convert.c }; Makefile.host +------------- This is the makefile that is used to make the mkconfig program from the mkconfig.c C file, the cmpconfig program from cmpconfig.c C file @@ -265,6 +290,7 @@ Makefile.host make -f Makefile.host mkromfsimg.sh +------------- This script may be used to automate the generate of a ROMFS file system image. It accepts an rcS script "template" and generates and image that @@ -274,6 +300,7 @@ mkdeps.sh mkdeps.bat mkdeps.c mknulldeps.sh +------------- NuttX uses the GCC compilers capabilities to create Makefile dependencies. The bash script mkdeps.sh is used to run GCC in order to create the @@ -317,6 +344,7 @@ mknulldeps.sh that mixed environment. define.sh +--------- Different compilers have different conventions for specifying pre- processor definitions on the compiler command line. This bash @@ -324,6 +352,7 @@ define.sh without concern for the particular compiler in use. incdir.sh +--------- Different compilers have different conventions for specifying lists of include file paths on the the compiler command line. This bash @@ -333,6 +362,7 @@ incdir.sh link.sh winlink.sh unlink.sh +---------- Different file system have different capabilities for symbolic links. Some windows file systems have no native support for symbolic links. @@ -365,16 +395,19 @@ unlink.sh tried that mkimage.sh +---------- The creates a downloadable image as needed with the rrload bootloader. indent.sh +--------- This script can be used to indent .c and .h files in a manner similar to my coding NuttX coding style. It doesn't do a really good job, however (see the comments at the top of the indent.sh file). zipme.sh +-------- I use this script to create the nuttx-xx.yy.tar.gz tarballs for release on SourceForge. It is handy because it also does the diff --git a/tools/mkdeps.c b/tools/mkdeps.c index a90595c980..c688b2b75f 100644 --- a/tools/mkdeps.c +++ b/tools/mkdeps.c @@ -87,6 +87,75 @@ static char *g_topdir = NULL; * Private Functions ****************************************************************************/ + /* MinGW does not seem to provide strtok_r */ + +#ifndef HAVE_STRTOK_R +static char *strtok_r(char *str, const char *delim, char **saveptr) +{ + char *pbegin; + char *pend = NULL; + + /* Decide if we are starting a new string or continuing from + * the point we left off. + */ + + if (str) + { + pbegin = str; + } + else if (saveptr && *saveptr) + { + pbegin = *saveptr; + } + else + { + return NULL; + } + + /* Find the beginning of the next token */ + + for (; + *pbegin && strchr(delim, *pbegin) != NULL; + pbegin++); + + /* If we are at the end of the string with nothing + * but delimiters found, then return NULL. + */ + + if (!*pbegin) + { + return NULL; + } + + /* Find the end of the token */ + + for (pend = pbegin + 1; + *pend && strchr(delim, *pend) == NULL; + pend++); + + /* pend either points to the end of the string or to + * the first delimiter after the string. + */ + + if (*pend) + { + /* Turn the delimiter into a null terminator */ + + *pend++ = '\0'; + } + + /* Save the pointer where we left off and return the + * beginning of the token. + */ + + if (saveptr) + { + *saveptr = pend; + } + return pbegin; +} +#endif + static void append(char **base, char *str) { char *oldbase;