Merge pull request #14 from daTokenizer/master

add Makefile in root dir that builds everything
master
Dvir Volk 8 years ago committed by GitHub
commit 17405f6272

@ -0,0 +1,26 @@
#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
ifndef SRC_DIR
SRC_DIR=example
endif
all: module.so
module.so:
$(MAKE) -C ./$(SRC_DIR)
cp ./$(SRC_DIR)/module.so .
clean: FORCE
rm -rf *.xo *.so *.o
rm -rf ./$(SRC_DIR)/*.xo ./$(SRC_DIR)/*.so ./$(SRC_DIR)/*.o
rm -rf ./$(RMUTIL_LIBDIR)/*.so ./$(RMUTIL_LIBDIR)/*.o ./$(RMUTIL_LIBDIR)/*.a
FORCE:

@ -52,9 +52,8 @@ copied from the Redis repo.
Here's what you need to do to build your first module: Here's what you need to do to build your first module:
0. Build Redis in a build supporting modules. 0. Build Redis in a build supporting modules.
1. Build librmutil: `cd rmutil && make` 1. Build librmutil and the module by running `make`. (you can also build them seperatly by running `make` in their respective dirs)
2. Build the example module: `cd example && make` 2. Run redis loading the module: `/path/to/redis-server --loadmodule ./module.so`
3. Run redis loading the module: `/path/to/redis-server --loadmodule ./example/module.so`
Now run `redis-cli` and try the commands: Now run `redis-cli` and try the commands:

@ -21,7 +21,10 @@ endif
CFLAGS = -I$(RM_INCLUDE_DIR) -Wall -g -fPIC -lc -lm -Og -std=gnu99 CFLAGS = -I$(RM_INCLUDE_DIR) -Wall -g -fPIC -lc -lm -Og -std=gnu99
CC=gcc CC=gcc
all: module.so all: rmutil module.so
rmutil: FORCE
$(MAKE) -C $(RMUTIL_LIBDIR)
module.so: module.o module.so: module.o
$(LD) -o $@ module.o $(SHOBJ_LDFLAGS) $(LIBS) -L$(RMUTIL_LIBDIR) -lrmutil -lc $(LD) -o $@ module.o $(SHOBJ_LDFLAGS) $(LIBS) -L$(RMUTIL_LIBDIR) -lrmutil -lc
@ -29,3 +32,4 @@ module.so: module.o
clean: clean:
rm -rf *.xo *.so *.o rm -rf *.xo *.so *.o
FORCE:

Loading…
Cancel
Save