Skip to content

Commit 02232ad

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4f4fa9c commit 02232ad

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ all::
194194
#
195195
# Define USE_NED_ALLOCATOR if you want to replace the platforms default
196196
# 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.
197199

198200
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
199201
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -884,9 +886,10 @@ ifneq (,$(findstring MINGW,$(uname_S)))
884886
USE_NED_ALLOCATOR = YesPlease
885887
UNRELIABLE_FSTAT = UnfortunatelyYes
886888
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
888891
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
890893
EXTLIBS += -lws2_32
891894
X = .exe
892895
ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
@@ -1200,6 +1203,10 @@ endif
12001203
ifdef UNRELIABLE_FSTAT
12011204
BASIC_CFLAGS += -DUNRELIABLE_FSTAT
12021205
endif
1206+
ifdef NO_REGEX
1207+
COMPAT_CFLAGS += -Icompat/regex
1208+
COMPAT_OBJS += compat/regex/regex.o
1209+
endif
12031210

12041211
ifdef USE_NED_ALLOCATOR
12051212
COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc

0 commit comments

Comments
 (0)