mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 22:03:33 +08:00
Merge branch 'master' into nuttx-merge-5447
This commit is contained in:
+156
-7
@@ -2,7 +2,12 @@
|
||||
# Config.mk
|
||||
# Global build rules and macros.
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Richard Cochran
|
||||
# Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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
|
||||
@@ -40,33 +45,177 @@ 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.
|
||||
# Some defaults just to prohibit some bad behavior if for some reason they
|
||||
# are not defined
|
||||
|
||||
OBJEXT ?= .o
|
||||
LIBEXT ?= .a
|
||||
|
||||
# DELIM - Path segment delimiter character
|
||||
#
|
||||
# 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)
|
||||
DELIM = $(strip \)
|
||||
else
|
||||
DELIM = $(strip /)
|
||||
endif
|
||||
|
||||
# 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)
|
||||
#
|
||||
# NOTE that the most common toolchain, GCC, uses the compiler to assemble
|
||||
# files because this has the advantage of running the C Pre-Processor against
|
||||
# the assembly language files. This is not possible with other toolchains;
|
||||
# platforms using those other tools should define AS and over-ride this
|
||||
# definition in order to use the assembler directly.
|
||||
#
|
||||
# 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 language
|
||||
# files
|
||||
# AFLAGS - Options to pass to the C+compiler
|
||||
|
||||
define ASSEMBLE
|
||||
@echo "AS: $1"
|
||||
$(Q) $(CC) -c $(AFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define ARCHIVE
|
||||
echo "AR: $2"; \
|
||||
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
|
||||
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
|
||||
|
||||
define CLEAN
|
||||
$(Q) rm -f *.o *.a
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
define ARCHIVE
|
||||
@echo AR: $2
|
||||
$(Q) $(AR) $1 $(2)
|
||||
endef
|
||||
else
|
||||
define ARCHIVE
|
||||
@echo "AR: $2"
|
||||
$(Q) $(AR) $1 $(2) || { echo "$(AR) $1 FAILED!" ; exit 1 ; }
|
||||
endef
|
||||
endif
|
||||
|
||||
# DELFILE - Delete one file
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
define DELFILE
|
||||
$(Q) if exist $1 (del /f /q $1)
|
||||
endef
|
||||
else
|
||||
define DELFILE
|
||||
$(Q) rm -f $1
|
||||
endef
|
||||
endif
|
||||
|
||||
# DELDIR - Delect one directory
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
define DELDIR
|
||||
$(Q) if exist $1 (rmdir /q /s $1)
|
||||
endef
|
||||
else
|
||||
define DELDIR
|
||||
$(Q) rm -rf $1
|
||||
endef
|
||||
endif
|
||||
|
||||
# CLEAN - Default clean target
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
define CLEAN
|
||||
$(Q) if exist *$(OBJEXT) (del /f /q *$(OBJEXT))
|
||||
$(Q) if exist *$(LIBEXT) (del /f /q *$(LIBEXT))
|
||||
$(Q) if exist *~ (del /f /q *~)
|
||||
$(Q) if exist (del /f /q .*.swp)
|
||||
endef
|
||||
else
|
||||
define CLEAN
|
||||
$(Q) rm -f *$(OBJEXT) *$(LIBEXT) *~ .*.swp
|
||||
endef
|
||||
endif
|
||||
|
||||
@@ -37,10 +37,16 @@ include $(TOPDIR)/.config
|
||||
include $(EXPORTDIR)/Make.defs
|
||||
|
||||
ifdef ARCHSCRIPT
|
||||
LDPATH = ${shell echo "$(ARCHSCRIPT)" | sed -e "s/^-T[ ]*//g"}
|
||||
ifeq ($(WINTOOL),y)
|
||||
LDPATH = ${shell cygpath -u $(patsubst -T,,$(ARCHSCRIPT))}
|
||||
else
|
||||
LDPATH = $(patsubst -T,,$(ARCHSCRIPT))
|
||||
endif
|
||||
|
||||
LDNAME = ${shell basename ${LDPATH}}
|
||||
LDDIR = ${shell dirname ${LDPATH}}
|
||||
endif
|
||||
|
||||
ARCHSUBDIR = "arch/$(CONFIG_ARCH)/src"
|
||||
ARCHDIR ="$(TOPDIR)/$(ARCHSUBDIR)"
|
||||
|
||||
|
||||
+93
-19
@@ -33,45 +33,119 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
all: mkconfig mkversion mksyscall bdf-converter
|
||||
default: mkconfig mksyscall
|
||||
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: b16$(HOSTEXEEXT) bdf-converter$(HOSTEXEEXT) cmpconfig$(HOSTEXEEXT) \
|
||||
mkconfig$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) mksymtab$(HOSTEXEEXT) \
|
||||
mksyscall$(HOSTEXEEXT) mkversion$(HOSTEXEEXT)
|
||||
default: mkconfig$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT)
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
.PHONY: b16 bdf-converter cmpconfig clean mkconfig mkdeps mksymtab \
|
||||
mksyscall mkversion
|
||||
else
|
||||
.PHONY: clean
|
||||
endif
|
||||
|
||||
# Add CFLAGS=-g on the make command line build debug versions
|
||||
# Add HOSTCFLAGS=-g on the make command line build debug versions
|
||||
|
||||
CFLAGS = -O2 -Wall -I.
|
||||
HOSTCFLAGS ?= -O2 -Wall -I.
|
||||
HOSTCC ?= gcc
|
||||
|
||||
# b16 - Fixed precision math converstion tool
|
||||
|
||||
b16$(HOSTEXEEXT): b16.c
|
||||
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o b16$(HOSTEXEEXT) b16.c
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
b16: b16$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
# mkconfig - Convert a .config file into a C config.h file
|
||||
|
||||
mkconfig: mkconfig.c cfgparser.c
|
||||
@gcc $(CFLAGS) -o mkconfig mkconfig.c cfgparser.c
|
||||
mkconfig$(HOSTEXEEXT): mkconfig.c cfgparser.c
|
||||
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkconfig$(HOSTEXEEXT) mkconfig.c cfgparser.c
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
mkconfig: mkconfig$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
# cmpconfig - Compare the contents of two configuration files
|
||||
|
||||
cmpconfig: cmpconfig.c
|
||||
@gcc $(CFLAGS) -o cmpconfig cmpconfig.c
|
||||
cmpconfig$(HOSTEXEEXT): cmpconfig.c
|
||||
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o cmpconfig$(HOSTEXEEXT) cmpconfig.c
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
cmpconfig: cmpconfig$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
# mkversion - Convert a .version file into a C version.h file
|
||||
|
||||
mkversion: mkconfig.c cfgparser.c
|
||||
@gcc $(CFLAGS) -o mkversion mkversion.c cfgparser.c
|
||||
mkversion$(HOSTEXEEXT): mkconfig.c cfgparser.c
|
||||
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkversion$(HOSTEXEEXT) mkversion.c cfgparser.c
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
mkversion: mkversion$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
# mksyscall - Convert a CSV file into syscall stubs and proxies
|
||||
|
||||
mksyscall: mksyscall.c csvparser.c
|
||||
@gcc $(CFLAGS) -o mksyscall mksyscall.c csvparser.c
|
||||
mksyscall$(HOSTEXEEXT): mksyscall.c csvparser.c
|
||||
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mksyscall$(HOSTEXEEXT) mksyscall.c csvparser.c
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
mksyscall: mksyscall$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
# mksymtab - Convert a CSV file into a symbol table
|
||||
|
||||
mksymtab: mksymtab.c csvparser.c
|
||||
@gcc $(CFLAGS) -o mksymtab mksymtab.c csvparser.c
|
||||
mksymtab$(HOSTEXEEXT): mksymtab.c csvparser.c
|
||||
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mksymtab$(HOSTEXEEXT) mksymtab.c csvparser.c
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
mksymtab: mksymtab$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
# bdf-converter - Converts a BDF font to the NuttX font format
|
||||
|
||||
bdf-converter: bdf-converter.c
|
||||
@gcc $(CFLAGS) -o bdf-converter bdf-converter.c
|
||||
bdf-converter$(HOSTEXEEXT): bdf-converter.c
|
||||
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o bdf-converter$(HOSTEXEEXT) bdf-converter.c
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
bdf-converter: bdf-converter$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
# Create dependencies for a list of files
|
||||
|
||||
mkdeps$(HOSTEXEEXT): mkdeps.c csvparser.c
|
||||
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkdeps$(HOSTEXEEXT) mkdeps.c
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
mkdeps: mkdeps$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
clean:
|
||||
@rm -f *.o *.a *~ .*.swp
|
||||
@rm -f mkconfig mksyscall mkversion bdf-converter
|
||||
@rm -f mkconfig.exe mksyscall.exe mkversion.exe bdf-converter.exe
|
||||
$(call DELFILE, mkdeps)
|
||||
$(call DELFILE, mkdeps.exe)
|
||||
$(call DELFILE, mkconfig)
|
||||
$(call DELFILE, mkconfig.exe)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, mksyscall)
|
||||
$(call DELFILE, mksyscall.exe)
|
||||
$(call DELFILE, mkversion)
|
||||
$(call DELFILE, mkversion.exe)
|
||||
$(call DELFILE, bdf-converter)
|
||||
$(call DELFILE, bdf-converter.exe)
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
$(Q) rm -rf *.dSYM
|
||||
endif
|
||||
$(call CLEAN)
|
||||
|
||||
+96
-15
@@ -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,20 +290,25 @@ 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
|
||||
may be mounted under /etc in the NuttX pseudo file system.
|
||||
|
||||
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
|
||||
dependencies. If a NuttX configuration uses the GCC toolchain, its Make.defs
|
||||
file (see configs/README.txt) will include a line like:
|
||||
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh, or
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps[.exe] (See NOTE below)
|
||||
|
||||
If the NuttX configuration does not use a GCC compatible toolchain, then
|
||||
it cannot use the dependencies and instead it uses mknulldeps.sh:
|
||||
@@ -287,23 +317,64 @@ mknulldeps.sh
|
||||
|
||||
The mknulldeps.sh is a stub script that does essentially nothing.
|
||||
|
||||
NOTE: The mk*deps.* files are undergoing change. mkdeps.sh is a bash
|
||||
script that produces dependencies well for POSIX style hosts (e..g.,
|
||||
Linux and Cygwin). It does not work well for mixed environments with
|
||||
a Windows toolchain running in a POSIX style environemnt (hence, the
|
||||
mknulldeps.sh script). And, of course, cannot be used in a Windows
|
||||
nativ environment.
|
||||
|
||||
[mkdeps.sh does have an option, --winpath, that purports to convert
|
||||
the dependencies generated by a Windows toolchain to POSIX format.
|
||||
However, that is not being used and mostly likely does not cover
|
||||
all of the conversion cases.]
|
||||
|
||||
mkdeps.bat is a simple port of the bash script to run in a Windows
|
||||
command shell. However, it does not work well either because some
|
||||
of the common CFLAGS use characters like '=' which are transformed
|
||||
by the CMD.exe shell.
|
||||
|
||||
mkdeps.c generates mkdeps (on Linux) or mkdeps.exe (on Windows).
|
||||
However, this verison is still under-development. It works well in
|
||||
the all POSIX environment or in the all Windows environment but also
|
||||
does not work well in mixed POSIX environment with a Windows toolchain.
|
||||
In that case, there are still issues with the conversion of things like
|
||||
'c:\Program Files' to 'c:program files' by bash. Those issues may,
|
||||
eventually be solvable but for now continue to use mknulldeps.sh in
|
||||
that mixed environment.
|
||||
|
||||
define.sh
|
||||
define.bat
|
||||
---------
|
||||
|
||||
Different compilers have different conventions for specifying pre-
|
||||
processor definitions on the compiler command line. This bash
|
||||
script allows the build system to create create command line definitions
|
||||
without concern for the particular compiler in use.
|
||||
|
||||
The define.bat script is a counterpart for use in the native Windows
|
||||
build.
|
||||
|
||||
incdir.sh
|
||||
incdir.bat
|
||||
---------
|
||||
|
||||
Different compilers have different conventions for specifying lists
|
||||
of include file paths on the the compiler command line. This bash
|
||||
script allows the build system to create include file paths without
|
||||
of include file paths on the the compiler command line. This incdir.sh
|
||||
bash script allows the build system to create include file paths without
|
||||
concern for the particular compiler in use.
|
||||
|
||||
The incdir.bat script is a counterpart for use in the native Windows
|
||||
build. However, there is currently only one compiler supported in
|
||||
that context: MinGW-GCC.
|
||||
|
||||
link.sh
|
||||
winlink.sh
|
||||
link.bat
|
||||
copydir.sh
|
||||
copydir.bat
|
||||
unlink.sh
|
||||
unlink.bat
|
||||
----------
|
||||
|
||||
Different file system have different capabilities for symbolic links.
|
||||
Some windows file systems have no native support for symbolic links.
|
||||
@@ -322,30 +393,40 @@ unlink.sh
|
||||
default. link.sh is a bash script that performs a normal, Linux-style
|
||||
symbolic link; unlink.sh is a do-it-all unlinking script.
|
||||
|
||||
But if you are building under cygwin using a Windows native toolchain,
|
||||
then you will need something like the following in you Make.defs file:
|
||||
But if you are building under cygwin using a Windows native toolchain
|
||||
within a POSIX framework (such as Cygwin), then you will need something
|
||||
like the following in you Make.defs file:
|
||||
|
||||
DIRLINK = $(TOPDIR)/tools/winlink.sh
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = (TOPDIR)/tools/unlink.sh
|
||||
|
||||
winlink.sh will copy the whole directory instead of linking it.
|
||||
copydir.sh will copy the whole directory instead of linking it.
|
||||
|
||||
NOTE: I have been told that some NuttX users have been able to build
|
||||
successfully using the GnuWin32 tools and modifying the link.sh
|
||||
script so that it uses the NTFS mklink command. But I have never
|
||||
tried that
|
||||
Finally, if you are running in a pure native Windows environment with
|
||||
a CMD.exe shell, then you will need something like this:
|
||||
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.bat
|
||||
DIRUNLINK = (TOPDIR)/tools/unlink.bat
|
||||
|
||||
Note that this will copy directories. ;ink.bat might also be used in
|
||||
this case. link.bat will attempt to create a symbolic link using the
|
||||
NTFS mklink.exe command instead of copying files. That logic, however,
|
||||
has not been verified as of this writing.
|
||||
|
||||
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
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/****************************************************************************
|
||||
* tools/b16.c
|
||||
*
|
||||
* Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static void show_usage(const char *progname)
|
||||
{
|
||||
fprintf(stderr, "\nUSAGE: %s <b16_t>|<float>\n", progname);
|
||||
fprintf(stderr, "\nWhere:\n");
|
||||
fprintf(stderr, " <b16_t>:\n");
|
||||
fprintf(stderr, " A b16 fixed precision value in hexadecimal form: E.g., 0x00010000\n");
|
||||
fprintf(stderr, " Any value begininning with '0' will assumed by be hexadecimal format\n");
|
||||
fprintf(stderr, " <float>:\n");
|
||||
fprintf(stderr, " A floating value in standard form: E.g., 5.1\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
double fvalue;
|
||||
unsigned long ulvalue;
|
||||
long lvalue;
|
||||
const char *str;
|
||||
char *endptr;
|
||||
|
||||
/* There must be exactly one argument */
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
fprintf(stderr, "\nExpected a single argument\n");
|
||||
show_usage(argv[0]);
|
||||
}
|
||||
str = argv[1];
|
||||
|
||||
/* If the value begins with a zero, we will assume that it is a hexadecimal
|
||||
* representation.
|
||||
*/
|
||||
|
||||
if (str[0] == '0')
|
||||
{
|
||||
endptr = NULL;
|
||||
ulvalue = strtoul(str, &endptr, 16);
|
||||
if (!endptr || *endptr != '\0')
|
||||
{
|
||||
fprintf(stderr, "\nHexadecimal argument not fully converted\n");
|
||||
show_usage(argv[0]);
|
||||
}
|
||||
|
||||
if (ulvalue >= 0x80000000)
|
||||
{
|
||||
lvalue = ~ulvalue + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvalue = ulvalue;
|
||||
}
|
||||
|
||||
fvalue = ((double)lvalue) / 65536.0;
|
||||
printf("0x%08lx -> %10.5f\n", ulvalue, fvalue);
|
||||
}
|
||||
else
|
||||
{
|
||||
endptr = NULL;
|
||||
fvalue = strtod(str, &endptr);
|
||||
if (!endptr || *endptr != '\0')
|
||||
{
|
||||
fprintf(stderr, "\nFloating point argument not fully converted\n");
|
||||
show_usage(argv[0]);
|
||||
}
|
||||
|
||||
lvalue = 65536.0 * fvalue;
|
||||
printf("%10.5f -> 0x%08lx\n", fvalue, lvalue);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* tools/cfgpaser.c
|
||||
*
|
||||
* Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
Executable
+102
@@ -0,0 +1,102 @@
|
||||
@echo off
|
||||
|
||||
rem tools/copydir.bat
|
||||
rem
|
||||
rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
rem Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
rem
|
||||
rem Redistribution and use in source and binary forms, with or without
|
||||
rem modification, are permitted provided that the following conditions
|
||||
rem are met:
|
||||
rem
|
||||
rem 1. Redistributions of source code must retain the above copyright
|
||||
rem notice, this list of conditions and the following disclaimer.
|
||||
rem 2. Redistributions in binary form must reproduce the above copyright
|
||||
rem notice, this list of conditions and the following disclaimer in
|
||||
rem the documentation and/or other materials provided with the
|
||||
rem distribution.
|
||||
rem 3. Neither the name NuttX nor the names of its contributors may be
|
||||
rem used to endorse or promote products derived from this software
|
||||
rem without specific prior written permission.
|
||||
rem
|
||||
rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
rem POSSIBILITY OF SUCH DAMAGE.
|
||||
rem
|
||||
|
||||
rem
|
||||
rem NuttX uses symbolic links to configure platform-specific directories into
|
||||
rem the build system. This works great except for when a Windows native
|
||||
rem toolchain is used in a Cygwin environment. In that case, symbolic
|
||||
rem links do not work correctly when accessed from the Windows native toolchain;
|
||||
rem rather, just look link files with the extension .lnk
|
||||
rem
|
||||
rem In this environment, the build system will work around this using this script
|
||||
rem as a replacement for the 'ln' command. This scrpt will simply copy the
|
||||
rem directory into the expected positiion.
|
||||
rem
|
||||
|
||||
set src=%1
|
||||
set dest=%2
|
||||
|
||||
rem Verify that arguments were provided
|
||||
|
||||
if "%src%"=="" goto :MissingSrc
|
||||
if "%dest%"=="" goto :MissingDest
|
||||
goto CheckSrc
|
||||
|
||||
:MissingSrc
|
||||
|
||||
echo Missing ^<src^> and ^<dest^> arguments
|
||||
goto :ShowUsage
|
||||
|
||||
:MissingDest
|
||||
|
||||
echo Missing ^<dest^> arguments
|
||||
goto :ShowUsage
|
||||
|
||||
rem Verify that a directory exists at the source path
|
||||
|
||||
:CheckSrc
|
||||
|
||||
if exist %src% goto :CheckDest
|
||||
|
||||
echo No directory at %src%
|
||||
goto :ShowUsage
|
||||
|
||||
:CheckDest
|
||||
|
||||
rem If something already exists at the destination path, remove it
|
||||
|
||||
if not exist %dest% goto :CopyDir
|
||||
|
||||
rmdir /q /s %dest%
|
||||
if errorlevel 1 (
|
||||
echo Failed to remove existing object at %dest%
|
||||
goto :ShowUsage
|
||||
)
|
||||
|
||||
rem Copy the directory
|
||||
|
||||
:CopyDir
|
||||
|
||||
xcopy %src% %dest% /c /q /s /e /y /i
|
||||
echo FAKELNK > %dest%\.fakelnk
|
||||
goto :End
|
||||
|
||||
:ShowUsage
|
||||
echo USAGE: %0 ^<src^> ^<dest^>
|
||||
echo Where:
|
||||
echo ^<src^> is the source directory to be copied
|
||||
echo ^<dest^> is the destination directory to be created
|
||||
|
||||
:End
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
############################################################################
|
||||
# tools/winlink.sh
|
||||
# tools/copydir.sh
|
||||
#
|
||||
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
Executable
+165
@@ -0,0 +1,165 @@
|
||||
@echo off
|
||||
|
||||
rem tools/incdir.sh
|
||||
rem
|
||||
rem Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
rem Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
rem
|
||||
rem Redistribution and use in source and binary forms, with or without
|
||||
rem modification, are permitted provided that the following conditions
|
||||
rem are met:
|
||||
rem
|
||||
rem 1. Redistributions of source code must retain the above copyright
|
||||
rem notice, this list of conditions and the following disclaimer.
|
||||
rem 2. Redistributions in binary form must reproduce the above copyright
|
||||
rem notice, this list of conditions and the following disclaimer in
|
||||
rem the documentation and/or other materials provided with the
|
||||
rem distribution.
|
||||
rem 3. Neither the name NuttX nor the names of its contributors may be
|
||||
rem used to endorse or promote products derived from this software
|
||||
rem without specific prior written permission.
|
||||
rem
|
||||
rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
rem POSSIBILITY OF SUCH DAMAGE.
|
||||
rem
|
||||
|
||||
rem Handle command line options
|
||||
|
||||
set progname=%0
|
||||
set pathtype=user
|
||||
|
||||
:ArgLoop
|
||||
|
||||
rem [-d] [-w] [-s] [-h]. [-w] and [-d] Ignored for compatibility with incdir.sh
|
||||
|
||||
if "%1"=="-d" goto :NextArg
|
||||
if "%1"=="-w" goto :NextArg
|
||||
if "%1"=="-h" goto :Usage
|
||||
|
||||
if "%1"=="-s" (
|
||||
set pathtype=system
|
||||
goto :NextArg
|
||||
)
|
||||
|
||||
goto :CheckCompiler
|
||||
|
||||
:NextArg
|
||||
shift
|
||||
goto :ArgLoop
|
||||
|
||||
:CheckCompiler
|
||||
if "%1"=="" (
|
||||
echo ERROR: Missing compiler name
|
||||
goto :Usage
|
||||
)
|
||||
|
||||
set ccpath=%1
|
||||
shift
|
||||
|
||||
set compiler=
|
||||
for /F %%i in ("%ccpath%") do set compiler=%%~ni
|
||||
|
||||
if "%1"=="" (
|
||||
echo ERROR: Missing directory paths
|
||||
goto :Usage
|
||||
)
|
||||
|
||||
rem Check for some well known, non-GCC Windows native tools that require
|
||||
rem a special output format as well as special paths
|
||||
|
||||
:GetFormat
|
||||
set fmt=std
|
||||
if "%compiler%"=="ez8cc" goto :SetZdsFormt
|
||||
if "%compiler%"=="zneocc" goto :SetZdsFormt
|
||||
if "%compiler%"=="ez80cc" goto :SetZdsFormt
|
||||
goto :GeneratePaths
|
||||
|
||||
:SetZdsFormt
|
||||
set fmt=zds
|
||||
|
||||
rem Generate the compiler include path directives.
|
||||
|
||||
:GeneratePaths
|
||||
set response=
|
||||
|
||||
:DirLoop
|
||||
if "%1" == "" (
|
||||
echo %response%
|
||||
goto :End
|
||||
)
|
||||
|
||||
if not exist %1 (
|
||||
echo ERROR: Path %1 does not exist
|
||||
goto :Usage
|
||||
)
|
||||
|
||||
if "%fmt%"=="zds" goto :GenerateZdsPath
|
||||
if "%response%"=="" goto :FirstStdPath
|
||||
if "%pathtype%"=="system" goto :NextStdSystemPath
|
||||
|
||||
set response=%response% -I "%1"
|
||||
goto :EndOfDirLoop
|
||||
|
||||
:NextStdSystemPath
|
||||
|
||||
set response=%response% -isystem "%1"
|
||||
goto :EndOfDirLoop
|
||||
|
||||
:FirstStdPath
|
||||
|
||||
if "%pathtype%"=="system" goto :FirstStdSystemPath
|
||||
set response=-I "%1"
|
||||
goto :EndOfDirLoop
|
||||
|
||||
:FirstStdSystemPath
|
||||
|
||||
set response=-isystem "%1"
|
||||
goto :EndOfDirLoop
|
||||
|
||||
:GenerateZdsPath
|
||||
|
||||
if "%response%"=="" goto :FirstZdsPath
|
||||
set response=%response%;%1
|
||||
goto :EndOfDirLoop
|
||||
|
||||
:FirstZdsPath
|
||||
|
||||
if "%pathtype%"=="system" goto :FirstZdsSystemPath
|
||||
set response=-usrinc:%1
|
||||
goto :EndOfDirLoop
|
||||
|
||||
:FirstZdsSystemPath
|
||||
|
||||
set response=-stdinc:%1
|
||||
|
||||
:EndOfDirLoop
|
||||
shift
|
||||
goto :DirLoop
|
||||
|
||||
:Usage
|
||||
echo %progname% is a tool for flexible generation of include path arguments for a
|
||||
echo variety of different compilers in a variety of compilation environments
|
||||
echo USAGE: %progname% [-w] [-d] [-s] [-h] ^<compiler-path^> ^<dir1^> [^<dir2^> [^<dir3^> ...]]
|
||||
echo Where:
|
||||
echo ^<compiler-path^>
|
||||
echo The full path to your compiler
|
||||
echo ^<dir1^> [^<dir2^> [^<dir3^> ...]]
|
||||
echo A list of include directories
|
||||
echo -w, -d
|
||||
echo For compatibility with incdir.sh (ignored)
|
||||
echo -s
|
||||
echo Generate standard, system header file paths instead of normal user
|
||||
echo header file paths.
|
||||
echo -h
|
||||
echo Shows this help text and exits.
|
||||
:End
|
||||
+30
-7
@@ -36,6 +36,7 @@
|
||||
|
||||
progname=$0
|
||||
wintool=n
|
||||
pathtype=user
|
||||
usage="USAGE: $progname [-w] [-d] [-h] <compiler-path> <dir1> [<dir2> [<dir3> ...]]"
|
||||
advice="Try '$progname -h' for more information"
|
||||
|
||||
@@ -47,6 +48,9 @@ while [ ! -z "$1" ]; do
|
||||
-w )
|
||||
wintool=y
|
||||
;;
|
||||
-s )
|
||||
pathtype=system
|
||||
;;
|
||||
-h )
|
||||
echo "$progname is a tool for flexible generation of include path arguments for a"
|
||||
echo "variety of different compilers in a variety of compilation environments"
|
||||
@@ -61,6 +65,9 @@ while [ ! -z "$1" ]; do
|
||||
echo " -w"
|
||||
echo " The compiler is a Windows native tool and requires Windows"
|
||||
echo " style pathnames like C:\\Program Files"
|
||||
echo " -s"
|
||||
echo " Generate standard, system header file paths instead of normal user"
|
||||
echo " header file paths."
|
||||
echo " -d"
|
||||
echo " Enable script debug"
|
||||
;;
|
||||
@@ -155,11 +162,27 @@ exefile=`basename "$compiler"`
|
||||
# a special output format as well as special paths
|
||||
|
||||
if [ "X$exefile" = "Xez8cc.exe" -o "X$exefile" = "Xzneocc.exe" -o "X$exefile" = "Xez80cc.exe" ]; then
|
||||
fmt=userinc
|
||||
fmt=zds
|
||||
else
|
||||
fmt=std
|
||||
fi
|
||||
|
||||
# Select system or user header file path command line option
|
||||
|
||||
if [ "X$fmt" = "Xzds" ]; then
|
||||
if [ "X$pathtype" = "Xsystem" ]; then
|
||||
cmdarg=-stdinc:
|
||||
else
|
||||
cmdarg=-usrinc:
|
||||
fi
|
||||
else
|
||||
if [ "X$pathtype" = "Xsystem" ]; then
|
||||
cmdarg=-isystem
|
||||
else
|
||||
cmdarg=-I
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now process each directory in the directory list
|
||||
|
||||
unset response
|
||||
@@ -183,26 +206,26 @@ for dir in $dirlist; do
|
||||
|
||||
# Handle the output using the selected format
|
||||
|
||||
if [ "X$fmt" = "Xuserinc" ]; then
|
||||
if [ "X$fmt" = "Xzds" ]; then
|
||||
# Treat the first directory differently
|
||||
|
||||
if [ -z "$response" ]; then
|
||||
response="-usrinc:'"$path
|
||||
response="${cmdarg}'"${path}
|
||||
else
|
||||
response=$response":$path"
|
||||
response=${response}";${path}"
|
||||
fi
|
||||
else
|
||||
# Treat the first directory differently
|
||||
|
||||
if [ -z "$response" ]; then
|
||||
response=-I\"$path\"
|
||||
response="${cmdarg} \"$path\""
|
||||
else
|
||||
response=$response" -I\"$path\""
|
||||
response="${response} ${cmdarg} \"$path\""
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "X$fmt" = "Xuserinc" ]; then
|
||||
if [ "X$fmt" = "Xzds" ]; then
|
||||
response=$response"'"
|
||||
fi
|
||||
|
||||
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
@echo off
|
||||
|
||||
rem tools/link.bat
|
||||
rem
|
||||
rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
rem Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
rem
|
||||
rem Redistribution and use in source and binary forms, with or without
|
||||
rem modification, are permitted provided that the following conditions
|
||||
rem are met:
|
||||
rem
|
||||
rem 1. Redistributions of source code must retain the above copyright
|
||||
rem notice, this list of conditions and the following disclaimer.
|
||||
rem 2. Redistributions in binary form must reproduce the above copyright
|
||||
rem notice, this list of conditions and the following disclaimer in
|
||||
rem the documentation and/or other materials provided with the
|
||||
rem distribution.
|
||||
rem 3. Neither the name NuttX nor the names of its contributors may be
|
||||
rem used to endorse or promote products derived from this software
|
||||
rem without specific prior written permission.
|
||||
rem
|
||||
rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
rem POSSIBILITY OF SUCH DAMAGE.
|
||||
rem
|
||||
|
||||
set src=%1
|
||||
set link=%2
|
||||
|
||||
rem Verify that arguments were provided
|
||||
|
||||
if "%src%"=="" goto :MissingSrc
|
||||
if "%link%"=="" goto :MissingLink
|
||||
goto CheckSrc
|
||||
|
||||
:MissingSrc
|
||||
|
||||
echo Missing ^<src^> and ^<link^> arguments
|
||||
goto :ShowUsage
|
||||
|
||||
:MissingLink
|
||||
|
||||
echo Missing ^<link^> arguments
|
||||
goto :ShowUsage
|
||||
|
||||
rem Verify that a directory exists at the source path
|
||||
|
||||
:CheckSrc
|
||||
|
||||
if exist %src% goto :CheckLink
|
||||
|
||||
echo No directory at %src%
|
||||
goto :ShowUsage
|
||||
|
||||
:CheckLink
|
||||
|
||||
rem If something already exists at the destination path, remove it
|
||||
|
||||
if not exist %link% goto :MkLink
|
||||
|
||||
rmdir /q /s %link%
|
||||
if errorlevel 1 (
|
||||
echo Failed to remove existing object at %link%
|
||||
goto :ShowUsage
|
||||
)
|
||||
|
||||
rem Copy the directory
|
||||
|
||||
:MkLink
|
||||
|
||||
/user:administrator mklink /d %src% %link%
|
||||
goto :End
|
||||
|
||||
:ShowUsage
|
||||
echo USAGE: %0 ^<src^> ^<link^>
|
||||
echo Where:
|
||||
echo ^<src^> is the source directory to be linked
|
||||
echo ^<link^> is the link to be created
|
||||
|
||||
:End
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
@echo off
|
||||
|
||||
rem tools/unlink.bat
|
||||
rem
|
||||
rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
rem Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
rem
|
||||
rem Redistribution and use in source and binary forms, with or without
|
||||
rem modification, are permitted provided that the following conditions
|
||||
rem are met:
|
||||
rem
|
||||
rem 1. Redistributions of source code must retain the above copyright
|
||||
rem notice, this list of conditions and the following disclaimer.
|
||||
rem 2. Redistributions in binary form must reproduce the above copyright
|
||||
rem notice, this list of conditions and the following disclaimer in
|
||||
rem the documentation and/or other materials provided with the
|
||||
rem distribution.
|
||||
rem 3. Neither the name NuttX nor the names of its contributors may be
|
||||
rem used to endorse or promote products derived from this software
|
||||
rem without specific prior written permission.
|
||||
rem
|
||||
rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
rem POSSIBILITY OF SUCH DAMAGE.
|
||||
rem
|
||||
|
||||
rem Verify that arguments were provided
|
||||
|
||||
set link=%1
|
||||
if "%link%"=="" goto :MissingArgument
|
||||
|
||||
rem Check if something already exists at the link path
|
||||
|
||||
if exist "%link%" goto :LinkExists
|
||||
|
||||
echo %link% does not exist
|
||||
goto :ShowUsage
|
||||
|
||||
rem %link% make be a symbolic link or it may be a copied director (with
|
||||
rem a .fakelnk file in it). It really does not matter which: We do the
|
||||
rem same thing in either case
|
||||
|
||||
:LinkExists
|
||||
|
||||
rmdir /q /s %link%
|
||||
if errorlevel 1 (
|
||||
echo Failed to remove existing object at %link%
|
||||
goto :ShowUsage
|
||||
)
|
||||
|
||||
goto :End
|
||||
|
||||
:MissingArgument
|
||||
|
||||
echo Missing Argument
|
||||
|
||||
:ShowUsage
|
||||
echo USAGE: %0 ^<link^>
|
||||
echo Where:
|
||||
echo ^<link^> is the linked (or copied) directory to be removed
|
||||
|
||||
:End
|
||||
Reference in New Issue
Block a user