Index: deps/RedisModuleSDK/rmutil/Makefile
--- deps/RedisModuleSDK/rmutil/Makefile.orig	2017-12-28 14:11:59.000000000 +0100
+++ deps/RedisModuleSDK/rmutil/Makefile	2018-03-18 10:34:54.562093000 +0100
@@ -5,7 +5,7 @@
 
 CFLAGS ?= -g -fPIC -lc -lm -O3 -std=gnu99 -I$(RM_INCLUDE_DIR) -Wall -Wno-unused-function
 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
-ifneq ($(uname_S),Linux)
+ifeq ($(uname_S),Darwin)
 	CFLAGS += -mmacosx-version-min=10.6
 endif
 export CFLAGS
Index: src/Makefile
--- src/Makefile.orig	2017-12-28 14:11:59.000000000 +0100
+++ src/Makefile	2018-03-18 10:34:29.397372000 +0100
@@ -9,7 +9,7 @@
 ifndef DEBUG
 	DEBUG = 0
 endif
-DEBUGFLAGS = -g -ggdb -O2
+DEBUGFLAGS =
 ifeq ($(DEBUG), 1)
 	DEBUGFLAGS = -g -ggdb -O0
 endif
@@ -17,18 +17,24 @@
 # Find the OS
 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
 INCLUDE_DIRS = -I"$(RM_INCLUDE_DIR)" -I"$(DEPS_DIR)/jsonsl"  -I"$(DEPS_DIR)/RedisModuleSDK/rmutil"
-CFLAGS = $(INCLUDE_DIRS) -Wall $(DEBUGFLAGS) -fPIC -std=gnu99  -D_GNU_SOURCE
+CFLAGS += $(INCLUDE_DIRS) -Wall $(DEBUGFLAGS) -fPIC -std=gnu99  -D_GNU_SOURCE
 CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc')
 
 # Compile flags for linux / osx
 ifeq ($(uname_S),Linux)
-	SHOBJ_CFLAGS ?=  -fno-common -g -ggdb
+	SHOBJ_CFLAGS ?= -fno-common
+	SHOBJ_LDFLAGS ?= -shared -Bsymbolic -Bsymbolic-functions
+else
+ifeq ($(uname_S),FreeBSD)
+	LD=$(CC)
+	SHOBJ_CFLAGS ?= -fno-common
 	SHOBJ_LDFLAGS ?= -shared -Bsymbolic -Bsymbolic-functions
 else
 	CFLAGS += -mmacosx-version-min=10.6
 	SHOBJ_CFLAGS ?= -dynamic -fno-common -g -ggdb
 	SHOBJ_LDFLAGS ?= -dylib -exported_symbol _RedisModule_OnLoad -macosx_version_min 10.6
 endif
+endif
 export CFLAGS
 export DEBUGFLAGS
 
