-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (39 loc) · 1.08 KB
/
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
### Constants: g++
CXX=g++ -std=c++11
CXX_OPT=-Werror -Wextra -Wall -Wfatal-errors -pedantic -O3
INC=-I.
LIB=-lhiredis
### Constants: gtest
GTEST_ROOT_DIR=ext/googletest/googletest
GTEST_BUILD_DIR=${GTEST_ROOT_DIR}/build
GTEST_INC_DIR=${GTEST_ROOT_DIR}/include
GTEST_MAIN=${GTEST_BUILD_DIR}/libgtest_main.a
GTEST_INC=-I${GTEST_INC_DIR}
GTEST_LIB=${GTEST_BUILD_DIR}/libgtest.a
GTEST_TARGET=bin/gtest
### Test binaries
TEST_OBJ=\
test/adapter.o\
test/cache.o\
test/integration.o\
test/redis.o\
test/store.o
### Top-level commands
all: check
check: ${GTEST_TARGET}
${GTEST_TARGET}
clean:
rm -rf ${GTEST_BUILD_DIR} ${GTEST_TARGET} ${TEST_OBJ}
### Build rules
submodule:
git submodule init
git submodule update
bin/%: tools/%.cc include/*.h
${CXX} ${CXX_FLAGS} ${INC} $< -o $@ ${LIB}
%.o: %.cc include/*.h
${CXX} ${CXX_FLAGS} ${GTEST_INC} ${INC} -c $< -o $@
${GTEST_LIB}: submodule
mkdir -p ${GTEST_BUILD_DIR}
cd ${GTEST_BUILD_DIR} && cmake .. && make
${GTEST_TARGET}: ${GTEST_LIB} ${GTEST_MAIN} ${TEST_OBJ} test/*.h
${CXX} ${CXX_OPT} -o $@ ${TEST_OBJ} ${GTEST_LIB} ${GTEST_MAIN} ${LIB} -lpthread