make-w32
[Top][All Lists]
Advanced

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

Insensitive wildcard matching


From: Alessandro Vesely
Subject: Insensitive wildcard matching
Date: Sat, 24 Jul 2004 19:44:16 +0200

I would use the wildcard function to configure include directories
(a job that would pertain to a configure script, in Unix.)
E.g. assume you are looking for a specific include file, then

   APKGDIR := c:/candidata/path
   APKGCHECK := $(wildcard $(APKGDIR)/include/custx.h)
   ifeq "$(APKGCHECK)" ""
      APKGDIR := d:/other/candidate/path
      APKGCHECK := $(wildcard $(APKGDIR)/include/custx.h)
   endif
   ifeq "$(APKGCHECK)" ""
      APKGDIR := e:/yet/another/candidate/path
      APKGCHECK := $(wildcard $(APKGDIR)/include/custx.h)
   endif
   ...
   CFLAGS = -I$(APKGDIR)/include
   LDFLAGS = -L$(APKGDIR)/lib
   ...

The above is horribly redundant and error prone. Even worst, it doesn't work!
Why? Because that file could have been named custx.H or CuStX.h or whatever.
I compiled gmake with `#define HAVE_CASE_INSENSITIVE_FS 1' in config.h, but that
is not enough. So I also patched the glob/glob.c as detailed below.

I'd say it looks as if the HAVE_CASE_INSENSITIVE_FS define were not
available at the time the AMIGA/VMS alternative was coded, but then
I'm not much into GNU make history... What do you think?

And, if anybody knows a better way to code the above search...

TIA
Ale

----8<--- one-liner patch for glob/glob.c begins -----

--- glob.c      2000-01-22 06:43:03.000000000 +0100
+++ glob.c      2004-07-24 19:08:57.470526000 +0200
@@ -1303,7 +1303,7 @@
            {
              int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
                               | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
-#if defined _AMIGA || defined VMS
+#if defined _AMIGA || defined VMS || defined HAVE_CASE_INSENSITIVE_FS
                                   | FNM_CASEFOLD
 #endif
                                   );

----8<--- one-liner patch for glob/glob.c ends -----




reply via email to

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