From d583be70629e9ba609fe7106c9c1f6d6e9450ff0 Mon Sep 17 00:00:00 2001 From: patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> Date: Sun, 10 Jun 2007 00:18:40 +0000 Subject: [PATCH] Fixed a problem with arch/arm/src dependencies git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@282 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 4 +- Documentation/NuttX.html | 2 + TODO | 3 -- arch/arm/src/Makefile | 2 +- tools/mkdeps.sh | 91 ++++++++++++++++++++++++++++++++++------ 5 files changed, 85 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b0af7911e..064a40dce2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -169,7 +169,7 @@ * Restructured some Makefiles to better handle enabling and disabling NuttX features without having so much conditional compilation in the source files. - * tools/mkconfig.c: No long depends on asprintf() and _GNU_SOURCE and + * tools/mkconfig.c: No longer depends on asprintf() and _GNU_SOURCE and so should now build in non-GNU, non-GLIBC environments. * include/nuttx/compiler.h: Fix for using SDCC with the Z80. * include/assert.h & arch/pjrc-8051/src/up_assert.c: SDCC does support @@ -178,5 +178,7 @@ disabled. 0.2.8 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> + * tools/Makefile.mkconfig: Under Cygwin, executable has a different name + * tools/mkdeps.sh & arch/arm/src/Makefile: Corrected a problem makeing dependencies * Started m68322 diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 20cd2db963..34bad5d7db 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -613,6 +613,8 @@ Other memory: 0.2.8 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> + * tools/Makefile.mkconfig: Under Cygwin, executable has a different name + * tools/mkdeps.sh & arch/arm/src/Makefile: Corrected a problem makeing dependencies * Started m68322 </pre></ul> diff --git a/TODO b/TODO index aaa68683cb..c05ec796b5 100644 --- a/TODO +++ b/TODO @@ -51,9 +51,6 @@ o Build system - Some names under arch are still incorrect. These should be processor architecture names: pjrc-8051 should be 805x - configs/pjrc-8051 should be configs/pjrc-87c52 -- 0.2.4 changes to create the arch/arm directory breaks dependency target in arch/arm/src. - Probably need to add the path to the chip or common subdirectorys when - running tools/mkdeps.sh o Applications & Tests diff --git a/arch/arm/src/Makefile b/arch/arm/src/Makefile index b02c4c9ec7..22d45a9129 100644 --- a/arch/arm/src/Makefile +++ b/arch/arm/src/Makefile @@ -103,7 +103,7 @@ endif @if [ -e board/Makefile ]; then \ $(MAKE) -C board TOPDIR=$(TOPDIR) depend ; \ fi - $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + $(MKDEP) --dep-debug --dep-path chip --dep-path common $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend diff --git a/tools/mkdeps.sh b/tools/mkdeps.sh index c2b81ec2e0..29c98e63e1 100755 --- a/tools/mkdeps.sh +++ b/tools/mkdeps.sh @@ -36,45 +36,112 @@ function show_usage () { - echo "$0 CC -- CFLAGS -- files" + echo "" + echo "$progname [OPTIONS] CC -- CFLAGS -- file [file [file...]]" + echo "" + echo "Where:" + echo " CC" + echo " A variable number of arguments that define how to execute the compiler" + echo " CFLAGS" + echo " The compiler compilation flags" + echo " file" + echo " One or more C files whose dependencies will be checked. Each file is expected" + echo " to reside in the current directory unless --dep-path is provided on the command line" + echo "" + echo "And [OPTIONS] include:" + echo " --dep-debug" + echo " Enable script debug" + echo " --dep-path <path>" + echo " Do not look in the current directory for the file. Instead, look in <path> to see" + echo " if the file resides there. --dep-path may be used multiple times to specifid" + echo " multiple alternative location" + echo " --help" + echo " Shows this message and exits" exit 1 } -cc= -cflags= -files= -args= +function dodep () +{ + unset fullpath + if [ -z "$altpath" ]; then + if [ -r $1 ]; then + fullpath=$1 + else + echo "# ERROR: No readable file at $1" + show_usage + fi + else + for path in $altpath; do + tmppath=$path/$1 + if [ -r $tmppath ]; then + fullpath=$tmppath + break; + fi + done + if [ -z "$fullpath" ]; then + echo "# ERROR: No readable file for $1 found at any location" + show_usage + fi + fi + + $cc -M $cflags $fullpath || \ + { echo "# ERROR: $cc -M $cflags $fullpath FAILED" ; exit 4 ; } +} + +unset cc +unset cflags +unset files +unset args +unset altpath # Accumulate CFLAGS up to "--" -for i in $* ; do - case $i in +progname=$0 +while [ ! -z "$1" ]; do + case $1 in -- ) cc=$cflags cflags=$args args= ;; --dep-debug ) - set -x + if [ -z "$args" ]; then + set -x + else + args="$args $1" + fi + ;; + --dep-path ) + if [ -z "$args" ]; then + shift + altpath="$altpath $1" + else + args="$args $1" + fi + ;; + --help ) + show_usage ;; *) - args="$args $i" + args="$args $1" ;; esac + shift done files=$args if [ -z "$cc" ]; then - echo "No compiler specified" + echo "ERROR: No compiler specified" + show_usage exit 1 fi if [ -z "$files" ]; then echo "No files specified" + show_usage exit 2 fi for file in $files ; do - $cc -M $cflags $file || \ - { echo "# $cc -M $cflags $file FAILED" ; exit 3 ; } + dodep $file done -- GitLab