aboutsummaryrefslogtreecommitdiff
path: root/examples/redis-unstable/modules/vector-sets/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'examples/redis-unstable/modules/vector-sets/Makefile')
-rw-r--r--examples/redis-unstable/modules/vector-sets/Makefile87
1 files changed, 0 insertions, 87 deletions
diff --git a/examples/redis-unstable/modules/vector-sets/Makefile b/examples/redis-unstable/modules/vector-sets/Makefile
deleted file mode 100644
index f8c05c9..0000000
--- a/examples/redis-unstable/modules/vector-sets/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
1# Compiler settings
2CC = cc
3
4ifdef SANITIZER
5ifeq ($(SANITIZER),address)
6 SAN=-fsanitize=address
7else
8ifeq ($(SANITIZER),undefined)
9 SAN=-fsanitize=undefined
10else
11ifeq ($(SANITIZER),thread)
12 SAN=-fsanitize=thread
13else
14 $(error "unknown sanitizer=${SANITIZER}")
15endif
16endif
17endif
18endif
19
20CFLAGS = -O2 -Wall -Wextra -g $(SAN) -std=c11
21LDFLAGS = -lm $(SAN)
22
23# Detect OS
24uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
25uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
26
27# Shared library compile flags for linux / osx
28ifeq ($(uname_S),Linux)
29 SHOBJ_CFLAGS ?= -W -Wall -fno-common -g -ggdb -std=c11 -O2
30 SHOBJ_LDFLAGS ?= -shared
31ifneq (,$(findstring armv,$(uname_M)))
32 SHOBJ_LDFLAGS += -latomic
33endif
34ifneq (,$(findstring aarch64,$(uname_M)))
35 SHOBJ_LDFLAGS += -latomic
36endif
37else
38 SHOBJ_CFLAGS ?= -W -Wall -dynamic -fno-common -g -ggdb -std=c11 -O3
39 SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
40endif
41
42# OS X 11.x doesn't have /usr/lib/libSystem.dylib and needs an explicit setting.
43ifeq ($(uname_S),Darwin)
44ifeq ("$(wildcard /usr/lib/libSystem.dylib)","")
45LIBS = -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lsystem
46endif
47endif
48
49.SUFFIXES: .c .so .xo .o
50
51all: vset.so
52
53.c.xo:
54 $(CC) -I. $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@
55
56vset.xo: ../../src/redismodule.h expr.c
57
58vset.so: vset.xo hnsw.xo vset_config.xo
59 $(CC) -o $@ $^ $(SHOBJ_LDFLAGS) $(LIBS) $(SAN) -lc
60
61# Example sources / objects
62SRCS = hnsw.c w2v.c vset_config.c
63OBJS = $(SRCS:.c=.o)
64
65TARGET = w2v
66MODULE = vset.so
67
68# Default target
69all: $(TARGET) $(MODULE)
70
71# Example linking rule
72$(TARGET): $(OBJS)
73 $(CC) $(OBJS) $(LDFLAGS) -o $(TARGET)
74
75# Compilation rule for object files
76%.o: %.c
77 $(CC) $(CFLAGS) -c $< -o $@
78
79expr-test: expr.c fastjson.c fastjson_test.c
80 $(CC) $(CFLAGS) expr.c -o expr-test -DTEST_MAIN -lm
81
82# Clean rule
83clean:
84 rm -f $(TARGET) $(OBJS) *.xo *.so
85
86# Declare phony targets
87.PHONY: all clean