make-w32
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: FW: Win32 File Name Compares and Normalization


From: Matthew Von-Maszewski
Subject: RE: FW: Win32 File Name Compares and Normalization
Date: Mon, 10 Sep 2001 14:09:35 -0400

99% pure ...

Ok, but I still have exception conditions based upon what is probably an
unorthodox usage ... but necessary.  So I would still appreciate some
consideration for this patch as part of the HAVE_CASE_INSENSITIVITY_FS
conditional.

Goal 1:  Have Microsoft C build a lib or an .exe using one invocation of the
C compiler.

Reason 1:  .pdb/.idb/.pch files only allow single processor access.  Turn on
the gnumake -j2 flag and everything falls apart using traditional .c to .obj
to .exe constructions.

Reason 2:  Microsoft C is much faster when it only has to load the
precompiled header once for several files.

Goal 2:  Have Microsoft build as fast or faster from command line than from
Visual Studio to ensure programmer adoption.

I achieve both goals by using the filename to construct a variable name,
e.g. f:/bob/fred.c becomes $(f:/bob/fred.c.DEPS).  This happens because I
want the build environment (gnumake and a template) to do all the thinking,
not the programmer.  I must apply all of the prerequisites of a potential
.obj directly against the .exe to ensure the compiler is invoked only when
necessary.

This is extremely possible when the file names are predictable.  My source
for the file names and dependencies is not case predictable:  Microsoft /P
output.  So I must create a normalized form.  This means normalizing
$(CURDIR) as well as $(wildcard) outputs.

Then the written HAVE_CASE_INSENSITIVE_FS code covers some bases that I do
not relating to potential programmer typing errors.  I was not concerned
here since my makefile setup is to run on Linux too using the same files
pulled from CVS.  Here, the case problems would cause the compile to not run
on Linux and send the programmer back for fixups.


Ok, by now you may think I am nuts ... and there is truth to that thought.
Just to keep the thought on firm footing, I have provided a sample .d file,
the makefile template (mevmake.mk) and the underlying include make file that
has all the good stuff (basemake.mk).  Some more notes in progress are
located at www.matthewv.org/make.html

Thanks,
Matthew


-----Original Message-----
From: Rob Tulloh [mailto:address@hidden
Sent: Monday, September 10, 2001 1:02 PM
To: Matthew Von-Maszewski
Cc: address@hidden
Subject: Re: FW: Win32 File Name Compares and Normalization



>From the README.W32 that is my distribution:


> Pathnames and Case insensitivity:
>
>     Unlike Unix, Windows 95/NT systems are case insensitive but case
>     preserving.  For example if you tell the file system to create a
>     file named "Target", it will preserve the case.  Subsequent access to
>     the file with other case permutations will succeed (i.e. opening a
>     file named "target" or "TARGET" will open the file "Target").
>
>     By default, GNU make retains its case sensitivity when comparing
target
>     names and existing files or directories.  It can be configured,
however,
>     into a case preserving and case insensitive mode by adding a define
>     for HAVE_CASE_INSENSITIVE_FS to config.h.W32.
>
>     For example, the following makefile will create a file named Target
>     in the directory subdir which will subsequently be used to satisfy
>     the dependency of SUBDIR/DepTarget on SubDir/TARGET.  Without
>     HAVE_CASE_INSENSITIVE_FS configured, the dependency link will not be
made:
>
>     subdir/Target:
>         touch $@
>
>     SUBDIR/DepTarget: SubDir/TARGET
>         cp $^ $@
>
>     Reliance on this behavior also eliminates the ability of gmake to use
>     case in comparison of matching rules.  For example, it is not possible
>     to set up a C++ rule using %.C : that is different than a C rule using
>     %.c :.  GNU make will consider these to be the same rule and will
issue
>     a warning.
>

I hope this is still in the README.W32 file we ship with GNU make!

Rob

Matthew Von-Maszewski wrote:

> ... argh!  last line of the config.h, missed it.  I will recompile and
> respond this afternoon ...
>
> -----Original Message-----
> From: Rob Tulloh [mailto:address@hidden
> Sent: Monday, September 10, 2001 12:37 PM
> To: Matthew Von-Maszewski
> Cc: address@hidden
> Subject: Re: FW: Win32 File Name Compares and Normalization
>
> I thought GNU make already had a compile-time feature to
> enable case insensitivity. Did you try this and find it didn't work
> for you?
>
> There are users on both sides of the fence so any
> work to enable this should be put under a feature test macro
> that can be turned on or off.
>
> My $.02,
>
> Rob
>
> Matthew Von-Maszewski wrote:
>
> > Per Paul Smith, I am forwarding this email to this group for comments
...
> >
> > -----Original Message-----
> > From: Matthew Von-Maszewski [mailto:address@hidden
> > Sent: Monday, September 10, 2001 12:05 PM
> > To: address@hidden
> > Subject: Win32 File Name Compares and Normalization
> >
> > Greetings,
> >
> > I have been doing extensive work with GNU make and Microsoft's compiler.
> > This includes creating a dependency generator similar the gcc's .d
files.
> > It has become obvious that a couple of the make's functions need to
become
> > case insensitive when on a Win 32 platform.  Microsoft's file names are
> > internally considered to be case insensitive for its file operations and
> > matching.
> >
> > I have listed the changes below that I found sufficient to create
> normalized
> > filenames (all lowercase) and to remove case sensitive compares (this
> needs
> > a cleaner implementation).
> >
> > [My dependency generator depends upon a preprocessor dump from
Microsoft's
> > compiler.  Depending upon the command line options, sometimes the
> > preprocessor normalizes all file names to lower case (e.g. /ZI option).
> > Other times case is left as found in the file system.  Lovely.]
> >
> > All changes are against the version 3.79.1 download.
> >
> > Would you please consider this change request?
> >
> > Thank you,
> > Matthew
> >
> > Index: glob/fnmatch.c
> > ===================================================================
> > RCS file: /home/cvsroot/gnumake/glob/fnmatch.c,v
> > retrieving revision 1.1.1.1
> > retrieving revision 1.2
> > diff -c -r1.1.1.1 -r1.2
> > *** glob/fnmatch.c      2001/09/10 15:33:48     1.1.1.1
> > --- glob/fnmatch.c      2001/09/10 15:37:35     1.2
> > ***************
> > *** 168,174 ****
> >   # ifdef _LIBC
> >   #  define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
> >   # else
> > ! #  define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c)
:
> > (c))
> >   # endif
> >
> >     while ((c = *p++) != '\0')
> > --- 168,176 ----
> >   # ifdef _LIBC
> >   #  define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
> >   # else
> > ! /*#  define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower
(c)
> :
> > (c)
> > )*/
> > ! /* mev */
> > ! #  define FOLD(c) ( ISUPPER (c) ? tolower (c) : (c))
> >   # endif
> >
> > Index: w32/pathstuff.c
> > ===================================================================
> > RCS file: /home/cvsroot/gnumake/w32/pathstuff.c,v
> > retrieving revision 1.1.1.1
> > retrieving revision 1.2
> > diff -c -r1.1.1.1 -r1.2
> > *** w32/pathstuff.c     2001/09/10 15:33:48     1.1.1.1
> > --- w32/pathstuff.c     2001/09/10 15:37:36     1.2
> > ***************
> > *** 80,85 ****
> > --- 80,87 ----
> >           if (*p == '\\')
> >               *p = '/';
> >
> > + /* mev */
> > +     strlwr(w32_path);
> >       return w32_path;
> >   }
> >
> > cvs server: Diffing w32/compat
> > Index: w32/compat/dirent.c
> > ===================================================================
> > RCS file: /home/cvsroot/gnumake/w32/compat/dirent.c,v
> > retrieving revision 1.1.1.1
> > retrieving revision 1.2
> > diff -c -r1.1.1.1 -r1.2
> > *** w32/compat/dirent.c 2001/09/10 15:33:48     1.1.1.1
> > --- w32/compat/dirent.c 2001/09/10 15:37:36     1.2
> > ***************
> > *** 116,122 ****
> >         /* fill in struct dirent values */
> >         pDir->dir_sdReturn.d_ino = -1;
> >         strcpy(pDir->dir_sdReturn.d_name, wfdFindData.cFileName);
> > !
> >         return &pDir->dir_sdReturn;
> >   }
> >
> > --- 116,123 ----
> >         /* fill in struct dirent values */
> >         pDir->dir_sdReturn.d_ino = -1;
> >         strcpy(pDir->dir_sdReturn.d_name, wfdFindData.cFileName);
> > ! /* mev */
> > !         strlwr(pDir->dir_sdReturn.d_name);
> >         return &pDir->dir_sdReturn;
> >   }
> >
> > ======================
> > Matthew Von-Maszewski
> >  address@hidden
> >  508-870-0118
> >
> > _______________________________________________
> > Make-w32 mailing list
> > address@hidden
> > http://mail.gnu.org/mailman/listinfo/make-w32

Attachment: basemake.mk
Description: Binary data

Attachment: mevmake.mk
Description: Binary data

Attachment: xmldb.d
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]