-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
39 lines (35 loc) · 1.32 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
CXX=g++
# -march=i686
OPTS=-O0 -fexceptions -g
LD=-L/usr/local/lib -lboost_thread -lpthread
PATH_MSGPACK_RPC=../msgpack-rpc/cpp/src/msgpack/rpc
TEST_LD= -lpthread $(LD)
CCLOG_LD=../msgpack-rpc/cpp/src/cclog/*.o
GTEST_INC= -I$(GTEST_DIR)/include -I$(GTEST_DIR)
GTEST_DIR=/opt/google/gtest-1.5.0
GMOCK_DIR=/opt/google/gmock-1.5.0
WARNS= -W -Wall -Wextra -Wformat=2 -Wstrict-aliasing=4 -Wcast-qual -Wcast-align \
-Wwrite-strings -Wfloat-equal -Wpointer-arith -Wswitch-enum
NOTIFY=&& notify-send Test success! -i ~/themes/ok_icon.png || notify-send Test failed... -i ~/themes/ng_icon.png
SRCS=$(HEADS) $(BODYS)
MSGPACK_RPC_OBJS=$(PATH_MSGPACK_RPC)/*.o
target:test
test:test.o gtest_main.a
$(CXX) $^ -o $@ $(OPTS) $(WARNS) $(GTEST_INC) $(LD)
# ./test $(NOTIFY)
test.o:test.cc lfmalloc.hpp
$(CXX) -c $< -o $@ $(OPTS) $(WARNS) $(GTEST_INC)
# gtest
gtest_main.o:
$(CXX) $(GTEST_INC) -c $(OPTS) $(GTEST_DIR)/src/gtest_main.cc -o $@
gtest-all.o:
$(CXX) $(GTEST_INC) -c $(OPTS) $(GTEST_DIR)/src/gtest-all.cc -o $@
gtest_main.a:gtest-all.o gtest_main.o
ar -r $@ $^
libgmock.a:
g++ ${GTEST_INC} -I${GTEST_DIR} -I${GMOCK_DIR}/include -I${GMOCK_DIR} -c ${GTEST_DIR}/src/gtest-all.cc
g++ ${GTEST_INC} -I${GTEST_DIR} -I${GMOCK_DIR}/include -I${GMOCK_DIR} -c ${GMOCK_DIR}/src/gmock-all.cc
ar -rv libgmock.a gtest-all.o gmock-all.o
clean:
rm -f *.o
rm -f *~