Index: src/Makefile
--- src/Makefile.orig	2018-07-07 18:07:42.000000000 +0200
+++ src/Makefile	2018-07-07 18:10:03.207367000 +0200
@@ -5,13 +5,13 @@
 export CC
 
 # if DEBUG env var is set, we compile with "debug" cflags
-DEBUGFLAGS = -g -ggdb -O3
+DEBUGFLAGS = -O2
 ifeq ($(DEBUG), 1)
-	DEBUGFLAGS = -g -ggdb3 -O0
+	DEBUGFLAGS =
 endif
 
 # Default CFLAGS
-CFLAGS = -Wall -Wno-unused-function -Wno-unused-variable -Wno-unused-result -fPIC \
+CFLAGS = -Wno-unused-function -Wno-unused-variable -Wno-unused-result -fPIC \
  	-D_GNU_SOURCE -std=gnu99 -I"$(shell pwd)" -DREDIS_MODULE_TARGET \
 	-DREDISMODULE_EXPERIMENTAL_API
 CFLAGS += $(DEBUGFLAGS)
@@ -20,9 +20,14 @@
 ifeq ($(uname_S),Linux)
 	SHOBJ_LDFLAGS ?= -shared -Bsymbolic -Bsymbolic-functions -ldl -lpthread
 else
+ifeq ($(uname_S),FreeBSD)
+	LD=$(CC)
+	SHOBJ_LDFLAGS ?= -shared -Bsymbolic -Bsymbolic-functions -pthread
+else
 	CFLAGS += -mmacosx-version-min=10.6
 	SHOBJ_LDFLAGS ?= -macosx_version_min 10.6 -exported_symbol _RedisModule_OnLoad -bundle -undefined dynamic_lookup -ldl -lpthread
 endif
+endif
 export CFLAGS
 
 # Sources
Index: src/parser/token.h
--- src/parser/token.h.orig	2018-07-07 18:07:42.000000000 +0200
+++ src/parser/token.h	2018-07-07 18:09:27.589836000 +0200
@@ -1,5 +1,6 @@
 #ifndef __TOKEN_H__
 #define __TOKEN_H__
+#include <sys/types.h>
 #include <stdlib.h>
 
 typedef struct {
@@ -12,4 +13,4 @@
 
 extern Token tok;
 
-#endif
\ No newline at end of file
+#endif
Index: src/value.h
--- src/value.h.orig	2018-07-07 18:07:42.000000000 +0200
+++ src/value.h	2018-07-07 18:09:27.589951000 +0200
@@ -1,5 +1,6 @@
 #ifndef __SECONDARY_VALUE_H__
 #define __SECONDARY_VALUE_H__
+#include <sys/types.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
