This is the mail archive of the cygwin@cygwin.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]
Other format: [Raw text]

RE: RE: MAKE - problem with small/capital letters in filenames


On Thu, 31 Oct 2002, Harig, Mark A. wrote:

> try:
>
> %.D: %.C
>
> or
>
> %.d: %.C
>
> > -----Original Message-----
> > From: Graff_Zoltan [mailto:zotyo@z1.fszek.hu]
> > Sent: Thursday, October 31, 2002 5:24 AM
> > To: Harig, Mark A.
> > Subject: Re: RE: MAKE - problem with small/capital letters in
> > filenames
> >
> > > $ ls makefile hello.c
> > > hello.c  makefile
> > Yes, it works if hello.c exists. But not work when HELLO.C exist.
> > My files are on the netware file server, and I see all files with
> > upper case letters under WinXp.
> > Under DOS and Linux the makefile works only with lower case letters.
> >
> > If I change the '%.d: %.c'
> > line to 'hello.d: hello.c' (with lower case letters)
> > it works well.
> >
> > %.c isn't good, but hello.c is?
> > Are the upper and lower case letters equal in file names, or not?
> > If yes, '%.d: %.c' should work.
> > If not, 'hello.d: hello.c' should not work.
> >
> > Thanks
> > Zoltan Graff

Please keep replies on-list.  Thanks.

Zoltan,

In the Windows filesystem, there is indeed no difference between lowercase
and uppercase letters in filenames (unless the Posix option is turned on
under NT, but it probably isn't in your case).

Cygwin has an option (in the CYGWIN environment variable) that controls
whether it recognizes wrong-case filenames.  The option is
"check_case:<mode>", where <mode> is one of "strict", "relaxed", and
"adjust".  You can read up more on this in the User's Guide.  From the
information you provided, it seems you have it set to either "relaxed" or
"adjust" (or unset, which defaults to "relaxed", IIRC).

The check_case option, however, will only have effect if you try *opening*
the file.  The "%.d" construct in Makefiles performs another action on
filenames, called "globbing".  The globbing (same as the shell's "*.d") is
not performed by Cygwin, but rather by the shell (or, in your case, make
itself).  Since the Cygwin ports of shells and make use stock Unix code as
their base, there is no provision for globbing files with the wrong case
(unless one was specifically put in, which I doubt).  There may be options
to control this, however, of which I'm not aware, so do read the man and
info pages.

This explains why "hello.d" works, but "%.d" doesn't: when the target is
"hello.d", make tries to open (or stat) the file using Cygwin's system
calls, and thus ignores the case (provided check_case is set
appropriately).  When the target is "%.d", make tries to glob all
filenames that end in ".d" (not ignoring case), and thus doesn't find your
HELLO.D.  You can test this using "ls" in a shell (bash, in this case):

$ export CYGWIN="$CYGWIN check_case:relaxed"
$ ls
hello.c
$ ls Hello.C
Hello.C
$ ls *.C
/bin/ls: *.C: No such file or directory
$

If the options to allow case-insensitive globbing are present, all you
have to do is turn them on (using the MAKEFLAGS environment variable
for make, and the appropriate .*rc file for the shell, IIRC).

If these options are not available, there are still a few ways to fix
this.  One is modifying your makefile to include both "%.d" and "%.D" as
targets *every time* you need globbing.  Another is keeping files on a
local drive and using either rsync or cvs to synchronize it with the
network drive (you'd have to set up a repository on the network drive for
cvs, of course).  And the third way, if you're feeling adventurous, is
fixing the Cygwin ports of your favorite shell and make to allow
case-insensitive globbing, and contributing the patches through this list
to benefit the whole comminity and immortalizing your name in the archives
as the guy who made globbing case-insensitive. :-D
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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