Fix a problem that was causing tools/incdir.sh to generate inappropriate paths for Cygwin tools

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1941 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2009-06-24 20:57:34 +00:00
parent 6e759adf9e
commit 2cf61be243
8 changed files with 119 additions and 29 deletions
+5
View File
@@ -791,6 +791,11 @@
and probably breaks many builds. and probably breaks many builds.
* examples/lib: Added qsort() * examples/lib: Added qsort()
* examples/nxflat: Added support for symbol tables * examples/nxflat: Added support for symbol tables
* Correct logic that creates compiler include paths. On Cygwin, the
include paths for Cygwin-based GCC were being converted to windows
native paths. That causes many problems -- breaking dependencies
for one.
+4
View File
@@ -1483,6 +1483,10 @@ nuttx-0.4.9 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
and probably breaks many builds. and probably breaks many builds.
* examples/lib: Added qsort() * examples/lib: Added qsort()
* examples/nxflat: Added support for symbol tables * examples/nxflat: Added support for symbol tables
* Correct logic that creates compiler include paths. On Cygwin, the
include paths for Cygwin-based GCC were being converted to windows
native paths. That causes many problems -- breaking dependencies
for one.
pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
+5 -2
View File
@@ -35,7 +35,10 @@
-include $(TOPDIR)/Make.defs -include $(TOPDIR)/Make.defs
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/sched} ifeq ($(WINTOOL),y)
INCDIROPT = -w
endif
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/sched}
ifeq ($(CONFIG_NXFLAT),y) ifeq ($(CONFIG_NXFLAT),y)
include libnxflat/Make.defs include libnxflat/Make.defs
@@ -81,7 +84,7 @@ $(BIN): $(OBJS)
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) --dep-path . --dep-path libnxflat \ @$(MKDEP) --dep-path . --dep-path libnxflat \
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
+8 -4
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# drivers/Makefile # drivers/Makefile
# #
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. # Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,10 @@
-include $(TOPDIR)/Make.defs -include $(TOPDIR)/Make.defs
ifeq ($(WINTOOL),y)
INCDIROPT = -w
endif
ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET),y)
include net/Make.defs include net/Make.defs
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@@ -45,20 +49,20 @@ ifeq ($(CONFIG_USBDEV),y)
include usbdev/Make.defs include usbdev/Make.defs
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
USBDEVDEPPATH = --dep-path usbdev USBDEVDEPPATH = --dep-path usbdev
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/drivers/usbdev} CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/usbdev}
endif endif
include mmcsd/Make.defs include mmcsd/Make.defs
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
MMCSDDEPPATH = --dep-path mmcsd MMCSDDEPPATH = --dep-path mmcsd
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/drivers/mmcsd} CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/mmcsd}
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
include bch/Make.defs include bch/Make.defs
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
BCHDEPPATH = --dep-path bch BCHDEPPATH = --dep-path bch
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/drivers/bch} CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/bch}
endif endif
endif endif
+4 -6
View File
@@ -1,5 +1,5 @@
############################################################################ ############################################################################
# examples/hello/Makefile # examples/nxflat/Makefile
# #
# Copyright (C) 2008 Gregory Nutt. All rights reserved. # Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@@ -63,17 +63,15 @@ $(BIN): headers $(OBJS)
$(call ARCHIVE, $@, $${obj}); \ $(call ARCHIVE, $@, $${obj}); \
done ; ) done ; )
.depend: Makefile $(SRCS) # We can't make dependencies in this directory because the required
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep # header files may not yet exist.
@touch $@
depend: .depend depend:
clean: clean:
@rm -f $(BIN) *~ .*.swp @rm -f $(BIN) *~ .*.swp
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
@rm -f Make.dep .depend
-include Make.dep -include Make.dep
+6 -2
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# examples/pashello/Makefile # examples/pashello/Makefile
# #
# Copyright (C) 2008 Gregory Nutt. All rights reserved. # Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -36,8 +36,12 @@
-include $(TOPDIR)/.config -include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs -include $(TOPDIR)/Make.defs
ifeq ($(WINTOOL),y)
INCDIROPT = -w
endif
COMPILER = ${shell basename $(CC)} COMPILER = ${shell basename $(CC)}
USRINCLUDES = ${shell $(TOPDIR)/tools/incdir.sh "$CC" $(TOPDIR)/pcode/include $(TOPDIR)/pcode/insn/include} USRINCLUDES = ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$CC" $(TOPDIR)/pcode/include $(TOPDIR)/pcode/insn/include}
ifneq ($(ARCHSTDINCLUDES),) ifneq ($(ARCHSTDINCLUDES),)
INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES) INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
else else
+11 -7
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# graphics/Makefile # graphics/Makefile
# #
# Copyright (C) 2008 Gregory Nutt. All rights reserved. # Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -38,31 +38,35 @@
DEPPATH = --dep-path . DEPPATH = --dep-path .
ifeq ($(WINTOOL),y)
INCDIROPT = -w
endif
include nxglib/Make.defs include nxglib/Make.defs
DEPPATH += --dep-path nxglib DEPPATH += --dep-path nxglib
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/graphics/nxglib} CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxglib}
include nxbe/Make.defs include nxbe/Make.defs
DEPPATH += --dep-path nxbe DEPPATH += --dep-path nxbe
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/graphics/nxbe} CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxbe}
ifeq ($(CONFIG_NX_MULTIUSER),y) ifeq ($(CONFIG_NX_MULTIUSER),y)
include nxmu/Make.defs include nxmu/Make.defs
DEPPATH += --dep-path nxmu DEPPATH += --dep-path nxmu
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/graphics/nxmu} CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxmu}
else else
include nxsu/Make.defs include nxsu/Make.defs
DEPPATH += --dep-path nxsu DEPPATH += --dep-path nxsu
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/graphics/nxsu} CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxsu}
endif endif
include nxtk/Make.defs include nxtk/Make.defs
DEPPATH += --dep-path nxtk DEPPATH += --dep-path nxtk
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/graphics/nxtk} CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxtk}
include nxfonts/Make.defs include nxfonts/Make.defs
DEPPATH += --dep-path nxfonts DEPPATH += --dep-path nxfonts
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh "$(CC)" $(TOPDIR)/graphics/nxfonts} CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxfonts}
ASRCS = $(NXGLIB_ASRCS) $(NXBE_ASRCS) $(NX_ASRCS) $(NXTK_ASRCS) $(NXFONTS_ASRCS) ASRCS = $(NXGLIB_ASRCS) $(NXBE_ASRCS) $(NX_ASRCS) $(NXTK_ASRCS) $(NXFONTS_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT)) AOBJS = $(ASRCS:.S=$(OBJEXT))
+76 -8
View File
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# tools/incdir.sh # tools/incdir.sh
# #
# Copyright (C) 2008 Gregory Nutt. All rights reserved. # Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -32,25 +32,60 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
# #
# Input parameters: # Handle command line options
# $1 : Compiler name as it appears in config/*/*/Make.defs
# $2, $3, ...: Include file paths progname=$0
wintool=n
usage="USAGE: $progname [-w] [-d] [-l] [-h] <compiler-path> <dir1> [<dir2> [<dir3> ...]]"
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 generate of include path arguments for a"
echo "variety of diffent compilers in a variety of compilation environments"
echo ""
echo $usage
echo ""
echo "Where:"
echo " <compiler-path>"
echo " The full path to your compiler"
echo " <dir1> [<dir2> [<dir3> ...]]"
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 " -d"
echo " Enable script debug"
;;
* )
break;
;;
esac
shift
done
ccpath=$1 ccpath=$1
shift shift
dirlist=$@ dirlist=$@
usage="USAGE: $0 <compiler-path> <dir1> [<dir2> [<dir3> ...]]"
if [ -z "$ccpath" ]; then if [ -z "$ccpath" ]; then
echo "Missing compiler path" echo "Missing compiler path"
echo $usage echo $usage
echo $advice
exit 1 exit 1
fi fi
if [ -z "$dirlist" ]; then if [ -z "$dirlist" ]; then
echo "Missing include directory list" echo "Missing include directory list"
echo $usage echo $usage
echo $advice
exit 1 exit 1
fi fi
@@ -75,15 +110,48 @@ fi
# files. # files.
os=`uname -o` os=`uname -o`
# 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 if [ "X$os" = "XCygwin" ]; then
windows=yes # We can treat Cygwin native toolchains just like Linux native
compiler=`cygpath -u "$ccpath"` # 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
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 else
# Otherwise, we must be in a Linux environment where there are
# only Linux native toolchains
windows=no windows=no
compiler="$ccpath" compiler="$ccpath"
fi fi
exefile=`basename "$compiler"` 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 if [ "X$exefile" = "Xez8cc.exe" -o "X$exefile" = "Xzneocc.exe" -o "X$exefile" = "Xez80cc.exe" ]; then
fmt=userinc fmt=userinc
else else