diff --git a/Make.defs b/Make.defs index c3eb1e6ba..ebb5b5ed5 100644 --- a/Make.defs +++ b/Make.defs @@ -61,59 +61,48 @@ endef endif # Tools -# -# In a normal build, tools will reside in the nuttx/tools sub-directory and -# TOPDIR will refer to that nuttx/ directory. This, however, is not the -# case when building apps/ with a NuttX export directory; there is no -# apps/import/tools directory. In that case copies of the NuttX tools in -# the apps/tools directory are used. DELIM ?= $(strip /) -ifneq (,$(wildcard $(TOPDIR)$(DELIM)tools)) - TOOLDIR = $(TOPDIR)$(DELIM)tools -else - TOOLDIR = $(APPDIR)$(DELIM)tools -endif ifeq ($(DIRLINK),) ifeq ($(CONFIG_WINDOWS_NATIVE),y) - DIRLINK = $(TOOLDIR)$(DELIM)link.bat - DIRUNLINK = $(TOOLDIR)$(DELIM)unlink.bat + DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.bat + DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.bat else ifeq ($(CONFIG_WINDOWS_MSYS),y) - DIRLINK = $(TOOLDIR)$(DELIM)copydir.sh - DIRUNLINK = $(TOOLDIR)$(DELIM)unlink.sh + DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh + DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh else - DIRUNLINK = $(TOOLDIR)$(DELIM)unlink.sh + DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh ifeq ($(WINTOOL),y) - DIRLINK = $(TOOLDIR)$(DELIM)copydir.sh + DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh else - DIRLINK = $(TOOLDIR)$(DELIM)link.sh + DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh endif endif endif +ifeq ($(INCDIR),) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + INCDIR = $(TOPDIR)$(DELIM)tools$(DELIM)incdir.bat +else + INCDIR = $(TOPDIR)$(DELIM)tools$(DELIM)incdir.sh +endif +endif + +ifeq ($(DEFINE),) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + DEFINE = $(TOPDIR)$(DELIM)tools$(DELIM)define.bat +else + DEFINE = $(TOPDIR)$(DELIM)tools$(DELIM)define.sh +endif +endif + ifeq ($(CONFIG_WINDOWS_NATIVE),y) MKKCONFIG = $(APPDIR)$(DELIM)tools$(DELIM)mkkconfig.bat else MKKCONFIG = $(APPDIR)$(DELIM)tools$(DELIM)mkkconfig.sh endif -ifeq ($(INCDIR),) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - INCDIR = $(TOOLDIR)$(DELIM)incdir.bat -else - INCDIR = $(TOOLDIR)$(DELIM)incdir.sh -endif -endif - -ifeq ($(DEFINE),) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - DEFINE = $(APPDIR)$(DELIM)tools$(DELIM)define.bat -else - DEFINE = $(APPDIR)$(DELIM)tools$(DELIM)define.sh -endif -endif - ifeq ($(WINTOOL),y) INCDIROPT = -w endif diff --git a/import/.gitignore b/import/.gitignore index df2e109a3..2cc99aa17 100644 --- a/import/.gitignore +++ b/import/.gitignore @@ -5,11 +5,12 @@ /System.map /User.map /arch -/build /libs /include +/scripts /startup /tmp +/tools /*.asm /*.obj /*.rel diff --git a/import/Make.defs b/import/Make.defs index 24438bf83..ae52f3dac 100644 --- a/import/Make.defs +++ b/import/Make.defs @@ -34,7 +34,7 @@ ############################################################################ include $(TOPDIR)/.config -include $(TOPDIR)/build/Make.defs +include $(TOPDIR)/scripts/Make.defs # Control build verbosity # diff --git a/import/Makefile b/import/Makefile index 7faaf2c7d..4cb23c6e6 100644 --- a/import/Makefile +++ b/import/Makefile @@ -38,7 +38,7 @@ # Sub-directories from the NuttX export package -SUBDIRS = arch build include libs startup tmp +SUBDIRS = arch include libs scripts startup tmp tools FILES = .config System.map User.map all: diff --git a/import/scripts/gnu-elf.ld b/import/scripts/gnu-elf.ld deleted file mode 100644 index bb3d82b9a..000000000 --- a/import/scripts/gnu-elf.ld +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** - * apps/import/scripts/gnu-elf.ld - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -SECTIONS -{ - .text 0x00000000 : - { - _stext = . ; - *(.text) - *(.text.*) - *(.gnu.warning) - *(.stub) - *(.glue_7) - *(.glue_7t) - *(.jcr) - - /* C++ support: The .init and .fini sections contain specific logic - * to manage static constructors and destructors. - */ - - *(.gnu.linkonce.t.*) - *(.init) /* Old ABI */ - *(.fini) /* Old ABI */ - _etext = . ; - } - - .rodata : - { - _srodata = . ; - *(.rodata) - *(.rodata1) - *(.rodata.*) - *(.gnu.linkonce.r*) - _erodata = . ; - } - - .data : - { - _sdata = . ; - *(.data) - *(.data1) - *(.data.*) - *(.gnu.linkonce.d*) - _edata = . ; - } - - /* C++ support. For each global and static local C++ object, - * GCC creates a small subroutine to construct the object. Pointers - * to these routines (not the routines themselves) are stored as - * simple, linear arrays in the .ctors section of the object file. - * Similarly, pointers to global/static destructor routines are - * stored in .dtors. - */ - - .ctors : - { - _sctors = . ; - *(.ctors) /* Old ABI: Unallocated */ - *(.init_array) /* New ABI: Allocated */ - _edtors = . ; - } - - .dtors : - { - _sdtors = . ; - *(.dtors) /* Old ABI: Unallocated */ - *(.fini_array) /* New ABI: Allocated */ - _edtors = . ; - } - - .bss : - { - _sbss = . ; - *(.bss) - *(.bss.*) - *(.sbss) - *(.sbss.*) - *(.gnu.linkonce.b*) - *(COMMON) - _ebss = . ; - } - - /* Stabs debugging sections. */ - - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_info 0 : { *(.debug_info) } - .debug_line 0 : { *(.debug_line) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_aranges 0 : { *(.debug_aranges) } -} diff --git a/tools/define.bat b/tools/define.bat deleted file mode 100755 index 7e61e77df..000000000 --- a/tools/define.bat +++ /dev/null @@ -1,178 +0,0 @@ -@echo off - -rem apps/tools/define.bat -rem -rem Copyright (C) 2018 Gregory Nutt. All rights reserved. -rem Author: Gregory Nutt -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 Handle command line options -rem [-h] [-val ] [ [-val ] [ [-val ] ...]] -rem [-w] [-d] ignored for compatibility with define.sh - -set progname=%0 - -:ArgLoop -if "%1"=="-d" goto :NextArg -if "%1"=="-w" goto :NextArg -if "%1"=="-h" goto :ShowUsage - -goto :CheckCompilerPath - -:NextArg -shift -goto :ArgLoop - -:CheckCompilerPath - -if "%1"=="" ( - echo Missing compiler path - goto :ShowUsage -) - -set ccpath=%1 -shift - -set compiler= -for /F %%i in ("%ccpath%") do set compiler=%%~ni - -if "%1"=="" ( - echo Missing definition list - goto :ShowUsage -) - -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 :ProcessDefinitions - -:SetZdsFormt -set fmt=zds - -rem Now process each directory in the directory list - -:ProcessDefinitions -set response= - -:DefinitionLoop -if "%1"=="" goto :Done - -set varname=%1 -shift - -rem Handle the output depending on if there is a value for the variable or not - -if "%1"=="-val" goto :GetValue - -rem Handle the output using the selected format - -:NoValue -if "%fmt%"=="zds" goto :NoValueZDS - -:NoValueStandard -rem Treat the first definition differently - -if "%response%"=="" ( - set response=-D%varname% - goto :DefinitionLoop -) - -set response=%response% -D%varname% -goto :DefinitionLoop - -:NoValueZDS -rem Treat the first definition differently - -if "%response%"=="" ( - set response=-define:%varname% - goto :DefinitionLoop -) - -set response=%response% -define:%varname% -goto :DefinitionLoop - -rem Get value following the variable name - -:GetValue -shift -set varvalue=%1 -shift - -rem Handle the output using the selected format - -if "%fmt%"=="zds" goto :ValueZDS - -:ValueStandard -rem Treat the first definition differently - -if "%response%"=="" ( - set response=-D%varname%=%varvalue% - goto :DefinitionLoop -) - -set response=%response% -D%varname%=%varvalue% -goto :DefinitionLoop - -:ValueZds -rem Treat the first definition differently - -if "%response%"=="" ( - set response=-define:%varname%=%varvalue% - goto :DefinitionLoop -) - -set response=%response% -define:%varname%=%varvalue% -goto :DefinitionLoop - -:Done -echo %response% -goto :End - -:ShowUsage -echo %progname% is a tool for flexible generation of command line pre-processor -echo definitions arguments for a variety of diffent ccpaths in a variety of -echo compilation environments" -echo USAGE:%progname% [-h] ^ [-val ^<^val1^>] [^ [-val ^] [^ [-val ^] ...]] -echo Where:" -echo ^ -echo The full path to your ccpath -echo ^ ^ ^ ... -echo A list of pre-preprocesser variable names to be defined. -echo [-val ^] [-val ^] [-val ^] ... -echo optional values to be assigned to each pre-processor variable. -echo If not supplied, the variable will be defined with no explicit value. -echo -h -echo Show this text and exit - -:End diff --git a/tools/define.sh b/tools/define.sh deleted file mode 100755 index a4b37d388..000000000 --- a/tools/define.sh +++ /dev/null @@ -1,228 +0,0 @@ -#!/usr/bin/env bash -# apps/tools/define.sh -# -# Copyright (C) 2018 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# - -# -# Handle command line options -# - -progname=$0 -wintool=n -usage="USAGE: $progname [-w] [-d] [-h] [=val1] [[=val2] [[=val3] ...]]" -advice="Try '$progname -h' for more information" - -while [ ! -z "$1" ]; do - case $1 in - -d ) - set -x - ;; - -w ) - wintool=y - ;; - -h ) - echo "$progname is a tool for flexible generation of command line pre-processor" - echo "definitions arguments for a variety of diffent compilers in a variety of" - echo "compilation environments" - echo "" - echo $usage - echo "" - echo "Where:" - echo " " - echo " The full path to your compiler" - echo " [ ..." - echo " A list of pre-preprocesser variable names to be defined." - echo " [=val1] [=val2] [=val3]" - echo " optional values to be assigned to each pre-processor variable." - echo " If not supplied, the variable will be defined with no explicit value." - echo " -w" - echo " The compiler is a Windows native tool and requires Windows" - echo " style pathnames like C:\\Program Files" - echo " -d" - echo " Enable script debug" - ;; - * ) - break; - ;; - esac - shift -done - -ccpath=$1 -shift -varlist=$@ - -if [ -z "$ccpath" ]; then - echo "Missing compiler path" - echo $usage - echo $advice - exit 1 -fi - -if [ -z "$varlist" ]; then - echo "Missing definition list" - echo $usage - echo $advice - exit 1 -fi - -# -# Most compilers support CFLAG options like '-D' to add pre-processor -# variable defintions. Some (like the Zilog tools), do not. This script -# makes the selection of pre-processor definitions compiler independent. -# -# Below are all known compiler names (as found in the config/*/*/Make.defs -# files). If a new compiler is used that has some unusual syntax, then -# additional logic needs to be added to this file. -# -# NAME Syntax -# $(CROSSDEV)gcc -D -D -D ... -# sdcc -D -D -D ... -# $(ZDSBINDIR)/ez8cc.exe -define: -define: -define: ... -# $(ZDSBINDIR)/zneocc.exe -define: -define: -define: ... -# $(ZDSBINDIR)/ez80cc.exe -define: -define: -define: ... -# -os=`uname -o 2>/dev/null || echo "Other"` - -# -# Let's assume that all GCC compiler paths contain the string gcc and -# no non-GCC compiler pathes include this substring -# -gcc=`echo $ccpath | grep gcc` -sdcc=`echo $ccpath | grep sdcc` - -if [ "X$os" = "XCygwin" ]; then - # - # We can treat Cygwin native toolchains just like Linux native - # toolchains in the Linux. Let's assume: - # 1. GCC or SDCC are the only possible Cygwin native compilers - # 2. If this is a Window native GCC version, then -w provided - # on the command line (wintool=y) - - if [ -z "$gcc" -a -z "$sdcc" ]; then - # - # Not GCC or SDCC, must be Windows native - # - compiler=`cygpath -u "$ccpath"` - else - if [ "X$wintool" == "Xy" ]; then - # - # It is a native GCC or SDCC compiler - # - compiler=`cygpath -u "$ccpath"` - else - # - # GCC or SDCC and not for Windows - # - compiler="$ccpath" - fi - fi -else - # - # Otherwise, we must be in a Linux environment where there are - # only Linux native toolchains - # - compiler="$ccpath" -fi -exefile=`basename "$compiler"` - -# Check for some well known, non-GCC Windows native tools that require -# 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=define -else - fmt=std -fi - -# Now process each definition in the definition list - -unset response -for vardef in $varlist; do - - varname=`echo $vardef | cut -d'=' -f1` - if [ "X$varname" != "X$vardef" ]; then - varvalue=`echo $vardef | cut -d'=' -f2` - else - unset varvalue - fi - - # Handle the output depending on if there is a value for the variable or not - - if [ -z "$varvalue" ]; then - - # Handle the output using the selected format - - if [ "X$fmt" = "Xdefine" ]; then - # Treat the first definition differently - - if [ -z "$response" ]; then - response="-define:"$varname - else - response=$response" -define:$varname" - fi - else - # Treat the first definition differently - - if [ -z "$response" ]; then - response=-D$varname - else - response=$response" -D$varname" - fi - fi - else - - # Handle the output using the selected format - - if [ "X$fmt" = "Xdefine" ]; then - # Treat the first definition differently - - if [ -z "$response" ]; then - response="-define:"$varname=$varvalue - else - response=$response" -define:$varname=$varvalue" - fi - else - # Treat the first definition differently - - if [ -z "$response" ]; then - response=-D$varname=$varvalue - else - response=$response" -D$varname=$varvalue" - fi - fi - fi -done - -echo $response - - diff --git a/tools/incdir.sh b/tools/incdir.sh deleted file mode 100755 index f3b937a78..000000000 --- a/tools/incdir.sh +++ /dev/null @@ -1,237 +0,0 @@ -#!/usr/bin/env bash -# apps/tools/incdir.sh -# -# Copyright (C) 2018 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# - -# Handle command line options - -progname=$0 -wintool=n -pathtype=user -usage="USAGE: $progname [-w] [-d] [-h] [ [ ...]]" -advice="Try '$progname -h' for more information" - -while [ ! -z "$1" ]; do - case $1 in - -d ) - set -x - ;; - -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" - echo "" - echo $usage - echo "" - echo "Where:" - echo " " - echo " The full path to your compiler" - echo " [ [ ...]]" - echo " A list of include directories" - 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" - echo " -h" - echo " Shows this help text and exits." - exit 0 - ;; - * ) - break; - ;; - esac - shift -done - -ccpath=$1 -shift -dirlist=$@ - -if [ -z "$ccpath" ]; then - echo "Missing compiler path" - echo $usage - echo $advice - exit 1 -fi - -if [ -z "$dirlist" ]; then - echo "Missing include directory list" - echo $usage - echo $advice - exit 1 -fi - -# -# Most compilers support CFLAG options like '-I' to add include -# file header paths. Some (like the Zilog tools), do not. This script -# makes the selection of header file paths compiler independent. -# -# Below are all known compiler names (as found in the config/*/*/Make.defs -# files). If a new compiler is used that has some unusual syntax, then -# additional logic needs to be added to this file. -# -# NAME Syntax -# $(CROSSDEV)gcc -I -I -I ... -# sdcc -I -I -I ... -# $(ZDSBINDIR)/ez8cc.exe -usrinc:':::...` -# $(ZDSBINDIR)/zneocc.exe -usrinc:':::...` -# $(ZDSBINDIR)/ez80cc.exe -usrinc:':::...` -# -# Furthermore, just to make matters more difficult, with Windows based -# toolchains, we have to use the full windows-style paths to the header -# files. - -os=`uname -o 2>/dev/null || echo "Other"` - -# Let's assume that all GCC compiler paths contain the string gcc or -# g++ and no non-GCC compiler pathes include these substrings - -gcc=`echo $ccpath | grep gcc` -if [ -z "${gcc}" ]; then - gcc=`echo $ccpath | grep g++` -fi - -sdcc=`echo $ccpath | grep sdcc` - -if [ "X$os" = "XCygwin" ]; then - # We can treat Cygwin native toolchains just like Linux native - # toolchains in the Linux. Let's assume: - # 1. GCC or SDCC are the only possible Cygwin native compilers - # 2. If this is a Window native GCC version, then -w must be - # provided on the command line (wintool=y) - - if [ -z "$gcc" -a -z "$sdcc" ]; then - # Not GCC or SDCC, must be Windows native - windows=yes - compiler=`cygpath -u "$ccpath"` - else - if [ "X$wintool" == "Xy" ]; then - # It is a native GCC or SDCC compiler - windows=yes - compiler=`cygpath -u "$ccpath"` - else - # GCC or SDCC and not for Windows - windows=no - compiler="$ccpath" - fi - fi -else - # Otherwise, we must be in a Linux environment where there are - # only Linux native toolchains - windows=no - compiler="$ccpath" -fi -exefile=`basename "$compiler"` - -# Check for some well known, non-GCC Windows native tools that require -# 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=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 -for dir in $dirlist; do - - # Verify that the include directory exists - - if [ ! -d $dir ]; then - echo "Include path '$dir' does not exist" - echo $showusage - exit 1 - fi - - # Check if the path needs to be extended for Windows-based tools under Cygwin - - if [ "X$windows" = "Xyes" ]; then - path=`cygpath -w $dir` - else - path=$dir - fi - - # Handle the output using the selected format - - if [ "X$fmt" = "Xzds" ]; then - # Treat the first directory differently - - if [ -z "$response" ]; then - response="${cmdarg}'"${path} - else - response=${response}";${path}" - fi - else - # Treat the first directory differently - - if [ -z "$response" ]; then - response="${cmdarg} \"$path\"" - else - response="${response} ${cmdarg} \"$path\"" - fi - fi -done - -if [ "X$fmt" = "Xzds" ]; then - response=$response"'" -fi - -echo $response - - diff --git a/tools/mkimport.sh b/tools/mkimport.sh index 79d6d1ccd..be1972fb4 100755 --- a/tools/mkimport.sh +++ b/tools/mkimport.sh @@ -96,12 +96,13 @@ fi WD=${PWD} IMPORTDIR=${WD}/import DARCHDIR=${IMPORTDIR}/arch -DBUILDDIR=${IMPORTDIR}/build DINCDIR=${IMPORTDIR}/include DLIBDIR=${IMPORTDIR}/libs +DSCRIPTSDIR=${IMPORTDIR}/scripts DSTARTDIR=${IMPORTDIR}/startup +DTOOLSDIR=${IMPORTDIR}/tools TMPDIR=${IMPORTDIR}/tmp -DALLDIRS="${DARCHDIR} ${DBUILDDIR} ${DINCDIR} ${DLIBDIR} ${DSTARTDIR} ${TMPDIR}" +DALLDIRS="${DARCHDIR} ${DINCDIR} ${DLIBDIR} ${DSCRIPTSDIR} ${DSTARTDIR} ${DTOOLSDIR} ${TMPDIR}" # Remove any old import directories @@ -138,27 +139,31 @@ if [ ! -d "${EXPORTDIR}" ]; then fi SARCHDIR=${EXPORTDIR}/arch -SBUILDDIR=${EXPORTDIR}/build SINCDIR=${EXPORTDIR}/include SLIBDIR=${EXPORTDIR}/libs +SSCRIPTSDIR=${EXPORTDIR}/scripts SSTARTDIR=${EXPORTDIR}/startup +STOOLSDIR=${EXPORTDIR}/tools unset SALLDIRS if [ -d ${SARCHDIR} ]; then SALLDIRS="${SALLDIRS} ${SARCHDIR}" fi -if [ -d ${SBUILDDIR} ]; then - SALLDIRS="${SALLDIRS} ${SBUILDDIR}" -fi if [ -d ${SINCDIR} ]; then SALLDIRS="${SALLDIRS} ${SINCDIR}" fi if [ -d ${SLIBDIR} ]; then SALLDIRS="${SALLDIRS} ${SLIBDIR}" fi -if [ -d ${SLIBDIR} ]; then +if [ -d ${SSCRIPTSDIR} ]; then + SALLDIRS="${SALLDIRS} ${SSCRIPTSDIR}" +fi +if [ -d ${SSTARTDIR} ]; then SALLDIRS="${SALLDIRS} ${SSTARTDIR}" fi +if [ -d ${STOOLSDIR} ]; then + SALLDIRS="${SALLDIRS} ${STOOLSDIR}" +fi # Move all of the exported directories in place in the import directory