Centralized the definition of the INCDIR script in tools/Config.mk

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5346 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-11-13 20:24:30 +00:00
parent 9324847103
commit bcdd7936ce
46 changed files with 236 additions and 88 deletions
+80 -1
View File
@@ -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"
+7
View File
@@ -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)
+36 -3
View File
@@ -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 <nuttx>/.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 <program>
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
+69
View File
@@ -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;