forked from antirez/neural-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (29 loc) · 903 Bytes
/
Makefile
File metadata and controls
39 lines (29 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# find the OS
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
# Compile flags for linux / osx
ifeq ($(uname_S),Linux)
SHOBJ_CFLAGS ?= -Wall -W -O3 -fno-common -g -ggdb -std=c99
SHOBJ_LDFLAGS ?= -shared
else
SHOBJ_CFLAGS ?= -Wall -W -O3 -dynamic -fno-common -g -ggdb -std=c99
SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
endif
.SUFFIXES: .c .so .xo .o
all:
@echo ""
@echo "Make avx -- Faster if you have a modern CPU."
@echo "Make generic -- Works everywhere."
@echo ""
@echo "The avx code uses AVX2, it requires Haswell (Q2 2013) or better."
@echo ""
generic: neuralredis.so
avx:
make neuralredis.so CFLAGS=-DUSE_AVX AVX="-mavx2 -mfma"
.c.xo:
$(CC) -I. $(CFLAGS) $(SHOBJ_CFLAGS) $(AVX) -fPIC -c $< -o $@
nn.c: nn.h
neuralredis.xo: redismodule.h
neuralredis.so: neuralredis.xo nn.xo
$(LD) -o $@ $< nn.xo $(SHOBJ_LDFLAGS) $(LIBS) -lc
clean:
rm -rf *.xo *.so