-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
38 lines (33 loc) · 968 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
### Constants: g++
CXX=g++ -std=c++11
CXX_OPT=-Werror -Wextra -Wall -Wfatal-errors -pedantic
INC=-I.
### 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/const_pool.o\
test/singleton.o
### Top-level commands
submodule:
git submodule init
git submodule update
all: check
check: ${GTEST_TARGET}
${GTEST_TARGET}
clean:
rm -rf ${GTEST_BUILD_DIR} ${GTEST_TARGET} ${TEST_OBJ}
### Build rules
%.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}
${CXX} ${CXX_OPT} -o $@ ${TEST_OBJ} ${GTEST_LIB} ${GTEST_MAIN} ${LIB} -lpthread