Skip to content

Commit 2dcd5ee

Browse files
committed
fix compilation and linking on mac
1 parent 0c84275 commit 2dcd5ee

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

deps/RedisModuleSDK/rmutil/Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ ifndef RM_INCLUDE_DIR
33
RM_INCLUDE_DIR=../
44
endif
55

6-
CFLAGS = -g -fPIC -lc -lm -O3 -std=gnu99 -I$(RM_INCLUDE_DIR) -Wall -Wno-unused-function
7-
CC=gcc
6+
CFLAGS ?= -g -fPIC -lc -lm -O3 -std=gnu99 -I$(RM_INCLUDE_DIR) -Wall -Wno-unused-function
7+
ifneq ($(uname_S),Linux)
8+
CFLAGS += -mmacosx-version-min=10.6
9+
endif
10+
11+
CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc')
812

913
OBJS=util.o strings.o sds.o vector.o heap.o priority_queue.o alloc.o
1014

src/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif
1717
# Find the OS
1818
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
1919
INCLUDE_DIRS = -I"$(RM_INCLUDE_DIR)" -I"$(DEPS_DIR)/jsonsl" -I"$(DEPS_DIR)/RedisModuleSDK/rmutil"
20-
CFLAGS = $(INCLUDE_DIRS) -Wall $(DEBUGFLAGS) -fPIC -std=gnu99 -D_GNU_SOURCE
20+
CFLAGS = $(INCLUDE_DIRS) -Wall $(DEBUGFLAGS) -fPIC -std=gnu99 -D_GNU_SOURCE
2121
CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc')
2222

2323
# Compile flags for linux / osx
@@ -35,7 +35,7 @@ export DEBUGFLAGS
3535
SOURCEDIR=$(shell pwd -P)
3636
CC_SOURCES = $(wildcard $(SOURCEDIR)/*.c) $(wildcard $(SOURCEDIR)/dep/*.c)
3737
CC_OBJECTS = $(patsubst $(SOURCEDIR)/%.c, $(SOURCEDIR)/%.o, $(CC_SOURCES))
38-
LIBS = $(DEPS_DIR)/jsonsl/libjsonsl.a $(DEPS_DIR)/RedisModuleSDK/rmutil/librmutil.a
38+
LIBS = $(DEPS_DIR)/jsonsl/jsonsl.o $(DEPS_DIR)/RedisModuleSDK/rmutil/librmutil.a
3939

4040
all: rejson.so librejson.a
4141

test/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif
1717
# find the OS
1818
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
1919
INCLUDE_DIRS = -I"$(RM_INCLUDE_DIR)" -I"$(DEPS_DIR)/jsonsl" -I"$(DEPS_DIR)/RedisModuleSDK/rmutil"
20-
CFLAGS = $(INCLUDE_DIRS) -Wall $(DEBUGFLAGS) -fPIC -std=gnu99 -D_GNU_SOURCE
20+
CFLAGS = $(INCLUDE_DIRS) -Wall $(DEBUGFLAGS) -std=gnu99 -D_GNU_SOURCE
2121
CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc')
2222

2323
# Compile flags for linux / osx
@@ -50,7 +50,7 @@ test_json_validator: json_validator
5050

5151
# Build test_object
5252
object:
53-
$(CC) $(CFLAGS) -o test_$@.out test_$@.c $(LIBS)
53+
$(CC) $(CFLAGS) -o test_$@.out test_$@.c $(LIBS)
5454

5555
# Run test_object
5656
test_object: object

0 commit comments

Comments
 (0)