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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
CXX=g++
CC=gcc
CXXFLAGS=-gstabs+ -I../../ -I../../testing/gtest/include -I../../testing -I../../third_party/linux/include -I../../testing/include -I../../testing/gtest -D_REENTRANT -Wall
CFLAGS=$(CXXFLAGS)
LDFLAGS=-lpthread
OBJ_DIR=.
BIN_DIR=.
# Source vars for components
# Google Test (meant to be included in each test source list)
GOOGLETEST_CC_SRC=../../testing/gtest/src/gtest_main.cc \
../../testing/gtest/src/gtest-all.cc \
../../testing/src/gmock-all.cc
# Google Logging
GOOGLELOG_LIB=../../third_party/glog/glog/src/glog/libglog.a
# Google Flags lib
GOOGLEFLAGS_LIB=../../third_party/linux/lib/gflags/libgflags.a
# Client exception handling & minidump writing library
LIB_CC_SRC= \
crash_generation/crash_generation_client.cc \
crash_generation/crash_generation_server.cc \
handler/exception_handler.cc \
minidump_writer/linux_dumper.cc \
minidump_writer/minidump_writer.cc \
../minidump_file_writer.cc \
../../common/linux/file_id.cc \
../../common/linux/guid_creator.cc \
../../common/string_conversion.cc
LIB_C_SRC = ../../common/convert_UTF.c
LIB_CC_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(LIB_CC_SRC))
LIB_C_OBJ=$(patsubst %.c, $(OBJ_DIR)/%.o, $(LIB_C_SRC))
DUMPER_HELPER_TEST_C_SRC=minidump_writer/linux_dumper_unittest_helper.cc
DUMPER_HELPER_TEST_C_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o, \
$(DUMPER_HELPER_TEST_C_SRC))
# Unit tests for client library
TEST_CC_SRC=handler/exception_handler_unittest.cc \
minidump_writer/directory_reader_unittest.cc \
minidump_writer/line_reader_unittest.cc \
minidump_writer/linux_dumper_unittest.cc \
minidump_writer/minidump_writer_unittest.cc \
$(GOOGLETEST_CC_SRC)
TEST_CC_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(TEST_CC_SRC))
# Library for crash dump uploader
SENDER_LIBRARY_SRC=../../common/linux/google_crashdump_uploader.cc ../../common/linux/libcurl_wrapper.cc
SENDER_LIBRARY_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(SENDER_LIBRARY_SRC))
SENDER_LDFLAGS=-ldl
# Unit test for crash dump uploader
SENDER_TEST_SRC=../../common/linux/google_crashdump_uploader_test.cc \
$(GOOGLETEST_CC_SRC)
SENDER_TEST_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(SENDER_TEST_SRC))
# CLI tool for crash dump uploaer
SENDER_TOOL_SRC=sender/google_crash_report_sender.cc
SENDER_TOOL_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(SENDER_TOOL_SRC))
# Vars for binary targets
BREAKPAD_LIBRARY=$(BIN_DIR)/libbreakpad.a
SENDER_LIBRARY=$(BIN_DIR)/libcrash_sender.a
# Client unit test binary
UNITTEST_BIN=$(BIN_DIR)/linux_client_test
# Uploader unit test binary
SENDER_UNITTEST_BIN=$(BIN_DIR)/google_crashdump_uploader_test
# Sender CLI tool binary
SENDER_CLI_TOOL_BIN=$(BIN_DIR)/google_crashdump_uploader
DUMPER_HELPER_TEST_BIN=$(BIN_DIR)/linux_dumper_unittest_helper
.PHONY:all clean
all:$(BREAKPAD_LIBRARY) $(UNITTEST_BIN) #$(SENDER_LIBRARY) $(SENDER_UNITTEST_BIN) $(SENDER_CLI_TOOL_BIN)
check:$(UNITTEST_BIN) $(SENDER_UNITTEST_BIN)
$(UNITTEST_BIN)
$(SENDER_UNITTEST_BIN)
$(BIN_DIR)/libbreakpad.a:$(LIB_CC_OBJ) $(LIB_C_OBJ)
$(AR) rcs $@ $^
$(BIN_DIR)/linux_dumper_unittest_helper:$(DUMPER_HELPER_TEST_C_OBJ)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@
$(BIN_DIR)/linux_client_test:$(TEST_CC_OBJ) $(BREAKPAD_LIBRARY) $(DUMPER_HELPER_TEST_BIN)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TEST_CC_OBJ) $(BREAKPAD_LIBRARY) -o $@
$(BIN_DIR)/libcrash_sender.a:$(SENDER_LIBRARY_OBJ)
$(AR) rcs $@ $^
$(BIN_DIR)/google_crashdump_uploader_test:$(SENDER_TEST_OBJ) $(SENDER_LIBRARY) \
$(GOOGLELOG_LIB)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SENDER_LDFLAGS) $^ -o $@
$(BIN_DIR)/google_crashdump_uploader:$(SENDER_TOOL_OBJ) $(SENDER_LIBRARY) \
$(GOOGLELOG_LIB) $(GOOGLEFLAGS_LIB)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SENDER_LDFLAGS) $^ -o $@
clean:
rm -f $(UNITTEST_BIN) $(BREAKPAD_LIBRARY) $(LIB_CC_OBJ) $(LIB_C_OBJ) \
$(TEST_CC_OBJ) $(SENDER_LIBRARY_OBJ) $(SENDER_LIBRARY) \
$(SENDER_TOOL_OBJ) $(SENDER_CLI_TOOL_BIN) $(SENDER_UNITTEST_BIN) \
$(DUMPER_HELPER_TEST_BIN) core
|