This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to avoid GNU make case sensitivity?


The following script works under sh, ksh, and bash.  One caution, it
doesn't deal with spaces in filenames.

:
# llcase, lucase, lxcase, ulcase, uucase, uxcase, xlcase, xucase, xxcase
# Convert file name case
# The first  character of the script name indicates the base name change
# The second character indicates the extension name change
#    u = force to upper case
#    l = force to lower case
#    [^ul] = leave alone

upper_name=0
lower_name=0
upper_type=0
lower_type=0
base=`basename $0`
case $base in
   u?*) upper_name=1 ;;
   l?*) lower_name=1 ;;
esac
case $base in
   ?u*) upper_type=1 ;;
   ?l*) lower_type=1 ;;
esac

for file in $*
do
   [ ! -f $file ] && continue      # skip non-files
   filepath=`dirname  $file`
   filename=`basename $file`
   basename=$filename
   filetype=`echo $filename | sed -ne 's/^.*\(\.[^\.]*\)$/\1/p'`
   filename=`echo $filename | sed -e  's/^\(.*\)\.[^.]*$/\1/'`
   [ $upper_name = 1 ] && filename=`echo $filename | tr '[a-z]' '[A-Z]'`
   [ $lower_name = 1 ] && filename=`echo $filename | tr '[A-Z]' '[a-z]'`
   [ $upper_type = 1 ] && filetype=`echo $filetype | tr '[a-z]' '[A-Z]'`
   [ $lower_type = 1 ] && filetype=`echo $filetype | tr '[A-Z]' '[a-z]'`
   [ "X$basename" != "X${filename}${filetype}" ] && \
      mv $file ${filepath}/${filename}${filetype}  # skip if name won't
change
done
-----Original Message-----
From: Richard Stanton <stanton@haas.berkeley.edu>
To: gnu-win32@cygnus.com <gnu-win32@cygnus.com>
Date: Friday, August 15, 1997 01:08
Subject: How to avoid GNU make case sensitivity?



>I have lots of C files on a FAT (DOS style) formatted disk. Now I'm
>running NT, and when I try to use GNU make to compile stuff, it
>doesn't recognize the files' existence, since NT thinks all the
>filenames are upper case. For example, if I type
>
>make test.o
>
>I get an error message about not having a rule to make test.o, when a
>directory listing shows the file TEST.C existing on the
>drive. Renaming it manually to test.c allows me to compile it OK, but
>I'd rather avoid manually renaming every .C file on my system one at a
>time.


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]