1*572c4311Sfengbojiang 2*572c4311Sfengbojiang# find the OS 3*572c4311Sfengbojianguname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') 4*572c4311Sfengbojiang 5*572c4311Sfengbojiang# Compile flags for linux / osx 6*572c4311Sfengbojiangifeq ($(uname_S),Linux) 7*572c4311Sfengbojiang SHOBJ_CFLAGS ?= -W -Wall -fno-common -g -ggdb -std=c99 -O2 8*572c4311Sfengbojiang SHOBJ_LDFLAGS ?= -shared 9*572c4311Sfengbojiangelse 10*572c4311Sfengbojiang SHOBJ_CFLAGS ?= -W -Wall -dynamic -fno-common -g -ggdb -std=c99 -O2 11*572c4311Sfengbojiang SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup 12*572c4311Sfengbojiangendif 13*572c4311Sfengbojiang 14*572c4311Sfengbojiang.SUFFIXES: .c .so .xo .o 15*572c4311Sfengbojiang 16*572c4311Sfengbojiangall: commandfilter.so 17*572c4311Sfengbojiang 18*572c4311Sfengbojiang.c.xo: 19*572c4311Sfengbojiang $(CC) -I../../src $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@ 20*572c4311Sfengbojiang 21*572c4311Sfengbojiangcommandfilter.xo: ../../src/redismodule.h 22*572c4311Sfengbojiang 23*572c4311Sfengbojiangcommandfilter.so: commandfilter.xo 24*572c4311Sfengbojiang $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc 25