Skip to content

Commit

Permalink
move sorce code to src dir
Browse files Browse the repository at this point in the history
  • Loading branch information
daTokenizer committed Nov 23, 2016
1 parent 6497eb2 commit 3ca80e7
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ language: c
compiler: gcc
sudo: required
install: make clean && make
before_script:
before_script:
- git clone https://github.com/antirez/redis.git
- cd redis
- make
- sudo pip install redis
- cd ..
- ./redis/src/redis-server --loadmodule ./module.so &
script: ./test.py --noload
script: ./tests/test.py --noload
25 changes: 5 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,15 @@ ifndef RMUTIL_LIBDIR
RMUTIL_LIBDIR=rmutil
endif

# find the OS
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
all: module.so

# Compile flags for linux / osx
ifeq ($(uname_S),Linux)
SHOBJ_CFLAGS ?= -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -shared -Bsymbolic
else
SHOBJ_CFLAGS ?= -dynamic -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
endif
CFLAGS = -I$(RM_INCLUDE_DIR) -Wall -g -fPIC -lc -lm -O3 -std=gnu99
CC=gcc

all: rmutil module.so

rmutil: FORCE
$(MAKE) -C $(RMUTIL_LIBDIR)

module.so: module.o
$(LD) -o $@ module.o $(SHOBJ_LDFLAGS) $(LIBS) -L$(RMUTIL_LIBDIR) -lrmutil -lc
module.so:
$(MAKE) -C ./src
cp ./src/module.so .

clean: FORCE
rm -rf *.xo *.so *.o
rm -rf ./src/*.xo ./src/*.so ./src/*.o
rm -rf ./$(RMUTIL_LIBDIR)/*.so ./$(RMUTIL_LIBDIR)/*.o ./$(RMUTIL_LIBDIR)/*.a

FORCE:
35 changes: 35 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#set environment variable RM_INCLUDE_DIR to the location of redismodule.h
ifndef RM_INCLUDE_DIR
RM_INCLUDE_DIR=../
endif

ifndef RMUTIL_LIBDIR
RMUTIL_LIBDIR=../rmutil
endif

# 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 ?= -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -shared -Bsymbolic
else
SHOBJ_CFLAGS ?= -dynamic -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
endif
CFLAGS = -I$(RM_INCLUDE_DIR) -Wall -g -fPIC -lc -lm -O3 -std=gnu99
CC=gcc

all: rmutil module.so

rmutil: FORCE
$(MAKE) -C $(RMUTIL_LIBDIR)

module.so: module.o
$(LD) -o $@ module.o $(SHOBJ_LDFLAGS) $(LIBS) -L$(RMUTIL_LIBDIR) -lrmutil -lc

clean: FORCE
rm -rf *.xo *.so *.o

FORCE:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3ca80e7

Please sign in to comment.