xref: /f-stack/app/redis-5.0.5/src/modules/Makefile (revision 572c4311)
1
2# find the OS
3uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
4
5# Compile flags for linux / osx
6ifeq ($(uname_S),Linux)
7	SHOBJ_CFLAGS ?= -W -Wall -fno-common -g -ggdb -std=c99 -O2
8	SHOBJ_LDFLAGS ?= -shared
9else
10	SHOBJ_CFLAGS ?= -W -Wall -dynamic -fno-common -g -ggdb -std=c99 -O2
11	SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
12endif
13
14.SUFFIXES: .c .so .xo .o
15
16all: helloworld.so hellotype.so helloblock.so testmodule.so hellocluster.so hellotimer.so hellodict.so
17
18.c.xo:
19	$(CC) -I. $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@
20
21helloworld.xo: ../redismodule.h
22
23helloworld.so: helloworld.xo
24	$(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc
25
26hellotype.xo: ../redismodule.h
27
28hellotype.so: hellotype.xo
29	$(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc
30
31helloblock.xo: ../redismodule.h
32
33helloblock.so: helloblock.xo
34	$(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lpthread -lc
35
36hellocluster.xo: ../redismodule.h
37
38hellocluster.so: hellocluster.xo
39	$(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc
40
41hellotimer.xo: ../redismodule.h
42
43hellotimer.so: hellotimer.xo
44	$(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc
45
46hellodict.xo: ../redismodule.h
47
48hellodict.so: hellodict.xo
49
50testmodule.xo: ../redismodule.h
51
52testmodule.so: testmodule.xo
53	$(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc
54
55clean:
56	rm -rf *.xo *.so
57