1--- src/Makefile.orig	2025-05-02 11:15:06 UTC
2+++ src/Makefile
3@@ -67,7 +67,7 @@ endif
4 	STD+=-std=c99
5 endif
6
7-PREFIX?=/usr/local
8+PREFIX:=$(PREFIX)
9 INSTALL_BIN=$(PREFIX)/bin
10 INSTALL=install
11 PKG_CONFIG?=pkg-config
12@@ -131,7 +131,6 @@ FINAL_LIBS=-lm -lstdc++
13 FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(REDIS_CFLAGS)
14 FINAL_LDFLAGS=$(LDFLAGS) $(OPT) $(REDIS_LDFLAGS) $(DEBUG)
15 FINAL_LIBS=-lm -lstdc++
16-DEBUG=-g -ggdb
17
18 # Linux ARM32 needs -latomic at linking time
19 ifneq (,$(findstring armv,$(uname_M)))
20@@ -170,6 +169,11 @@ else
21 	OPENSSL_PREFIX?=/usr/local/opt/openssl
22 endif
23 else
24+ifeq ($(uname_S),MidnightBSD)
25+        # FreeBSD
26+        FINAL_CFLAGS?= $(CFLAGS) $(REDIS_CFLAGS) -I${PREFIX}/include
27+        FINAL_LDFLAGS= $(LDFLAGS) -pthread
28+else
29 ifeq ($(uname_S),AIX)
30         # AIX
31         FINAL_LDFLAGS+= -Wl,-bexpall
32@@ -219,6 +223,7 @@ else
33 	# All the other OSes (notably Linux)
34 	FINAL_LDFLAGS+= -rdynamic
35 	FINAL_LIBS+=-ldl -pthread -lrt
36+endif
37 endif
38 endif
39 endif
40