-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (33 loc) · 962 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Build for linux
ARCH ?= x86_64
CC := $(ARCH)-linux-musl-gcc
CFLAGS :=
LDFLAGS := -static -no-pie
redis-version := 7.0.12
redis-dir := $(CURDIR)/redis-$(redis-version)
redis-objs := $(redis-dir)/src/redis-server.o
redis-bin := redis-server
redis-build-args := \
CC=$(CC) \
CFLAGS="$(CFLAGS)" \
USE_JEMALLOC=no \
-j
ifneq ($(V),)
redis-build-args += V=$(V)
endif
all: build
$(redis-dir):
@echo "Download redis source code"
wget https://github.com/redis/redis/archive/$(redis-version).tar.gz -P $(APP)
tar -zxvf $(APP)/$(redis-version).tar.gz -C $(APP) && rm -f $(APP)/$(redis-version).tar.gz
cd $(redis-dir) && git init && git add .
patch -p1 -N -d $(redis-dir) --no-backup-if-mismatch -r - < $(APP)/redis.patch
build: $(redis-dir)
cd $(redis-dir) && $(MAKE) $(redis-build-args)
$(CC) $(LDFLAGS) -o $(redis-bin) $(redis-objs)
run:
./$(redis-bin)
clean:
$(MAKE) -C $(redis-dir) distclean
rm -f $(redis-bin)
.PHONY: all build clean