init project

This commit is contained in:
LingZhaoHui 2022-05-08 20:20:16 +08:00
parent 4591f54873
commit 7568057b36
5 changed files with 1596 additions and 0 deletions

2
.gitignore vendored
View File

@ -107,3 +107,5 @@ dkms.conf
*.out *.out
*.app *.app
*.xo
*.so

11
Makefile Normal file
View File

@ -0,0 +1,11 @@
default: all
.DEFAULT:
cd src && $(MAKE) $@
install:
cd src && $(MAKE) $@
.PHONY: install

28
src/Makefile Normal file
View File

@ -0,0 +1,28 @@
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
# Compile flags for linux / osx
ifeq ($(uname_S),Linux)
SHOBJ_CFLAGS ?= -W -Wall -fno-common -g -ggdb -std=c99 -O2
SHOBJ_LDFLAGS ?= -shared
else
SHOBJ_CFLAGS ?= -W -Wall -dynamic -fno-common -g -ggdb -std=c99 -O2
SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
endif
.SUFFIXES: .c .so .xo .o
.c.xo:
$(CC) -I. $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@
all: redis-acl.so
redis-acl.xo: ./redismodule.h
redis-acl.so: redis-acl.xo
$(LD) -o $@ $^ $(SHOBJ_LDFLAGS) $(LIBS) -lc
clean:
rm -rf *.xo *.so

7
src/redis-acl.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
#include "redismodule.h"
int main(){
printf("Hello world\n");
return 0;
}

1548
src/redismodule.h Normal file

File diff suppressed because it is too large Load Diff