Makefile: refactor regex compat support
There was no tweakable knob to use the regex compat code; it was embedded in the mingw build. Since other platforms may want to use it, let's factor it out in the usual way for build configuration knobs. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jun 16, 2009 at 15:07 UTC
02232adfd8bdc692bbe408ead7332ebfe416e83d
1 file changed
+9
-2
Makefile
+9
-2
@@ -194,6 +194,8 @@ all::
194
#
195
# Define USE_NED_ALLOCATOR if you want to replace the platforms default
196
# memory allocators with the nedmalloc allocator written by Niall Douglas.
197
+#
198
+# Define NO_REGEX if you have no or inferior regex support in your C library.
199
200
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
201
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -884,9 +886,10 @@ ifneq (,$(findstring MINGW,$(uname_S)))
886
USE_NED_ALLOCATOR = YesPlease
887
UNRELIABLE_FSTAT = UnfortunatelyYes
888
OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
887
- COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
889
+ NO_REGEX = YesPlease
890
+ COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch
891
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
889
- COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o
892
+ COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o
893
EXTLIBS += -lws2_32
894
X = .exe
895
ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
@@ -1200,6 +1203,10 @@ endif
1203
ifdef UNRELIABLE_FSTAT
1204
BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1205
endif
1206
+ifdef NO_REGEX
1207
+ COMPAT_CFLAGS += -Icompat/regex
1208
+ COMPAT_OBJS += compat/regex/regex.o
1209
+endif
1210
1211
ifdef USE_NED_ALLOCATOR
1212
COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc