2016-03-31 09:17:33 -04:00
|
|
|
|
|
|
|
# find the OS
|
|
|
|
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
|
|
|
|
|
|
|
# Compile flags for linux / osx
|
|
|
|
ifeq ($(uname_S),Linux)
|
2016-10-02 05:01:36 -04:00
|
|
|
SHOBJ_CFLAGS ?= -fno-common -g -ggdb -std=c99 -O2
|
2016-03-31 09:17:33 -04:00
|
|
|
SHOBJ_LDFLAGS ?= -shared
|
|
|
|
else
|
2016-10-02 05:01:36 -04:00
|
|
|
SHOBJ_CFLAGS ?= -dynamic -fno-common -g -ggdb -std=c99 -O2
|
2016-03-31 09:17:33 -04:00
|
|
|
SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
|
|
|
|
endif
|
2016-03-06 07:44:24 -05:00
|
|
|
|
|
|
|
.SUFFIXES: .c .so .xo .o
|
|
|
|
|
2016-08-02 09:29:04 -04:00
|
|
|
all: helloworld.so hellotype.so testmodule.so
|
2016-03-06 07:44:24 -05:00
|
|
|
|
|
|
|
.c.xo:
|
|
|
|
$(CC) -I. $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@
|
|
|
|
|
|
|
|
helloworld.xo: ../redismodule.h
|
|
|
|
|
|
|
|
helloworld.so: helloworld.xo
|
|
|
|
$(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc
|
|
|
|
|
2016-05-18 05:45:40 -04:00
|
|
|
hellotype.xo: ../redismodule.h
|
|
|
|
|
|
|
|
hellotype.so: hellotype.xo
|
|
|
|
$(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc
|
|
|
|
|
2016-08-02 09:29:04 -04:00
|
|
|
testmodule.xo: ../redismodule.h
|
|
|
|
|
|
|
|
testmodule.so: testmodule.xo
|
|
|
|
$(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc
|
|
|
|
|
2016-03-06 07:44:24 -05:00
|
|
|
clean:
|
|
|
|
rm -rf *.xo *.so
|