-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (27 loc) · 920 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
ifeq ($(release),1)
CFLG := -Wall -Werror -std=c99
FLG := -O3 -Werror -fPIC -D_LINUX_SYS -std=c++11
else
CFLG := -g3 -Wall -Werror -std=c99
FLG := -O0 -Werror -g3 -fPIC -D_LINUX_SYS -std=c++11
endif
PRG := ./amof-redis
SOURCEALL :=$(shell find ./ -maxdepth 1 -iname "*.c" -o -iname "*.cpp" -o -iname "*.cc" -o -iname "*.h")
#SRC := $(wildcard src/*.cpp)
OBJCXX := $(patsubst %.cpp,%.o,$(filter %.cpp, $(SOURCEALL)))
OBJC := $(patsubst %.c,%.o,$(filter %.c, $(SOURCEALL)))
CXX := g++
GCC := gcc
INC := -I./
LIB := -L./hiredis -Wl,-Bstatic -lhiredis \
-Wl,-Bdynamic -lrt -lz -lc -lpthread
.PHONY: clean
$(PRG): $(OBJCXX) $(OBJC)
$(CXX) -static-libstdc++ -static-libgcc -o $@ $^ $(LIB)
%.o: %.cpp
$(CXX) $(FLG) -o $@ -c $< $(INC)
%.o: %.c
$(GCC) $(CFLG) -o $@ -c $<
clean:
rm -f $(OBJCXX) $(OBJC) $(PRG)
#yum install glibc-static libstdc++-static