| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 CRASH_BIN = crash_reporter | 5 CRASH_REPORTER = crash_reporter |
| 6 CRASH_LIB = libcrash.so | 6 REPORTER_BINS = $(CRASH_REPORTER) |
| 7 CRASH_OBJS = system_logging.o user_collector.o | 7 CRASH_OBJS = system_logging.o user_collector.o |
| 8 TEST_OBJS = $(CRASH_OBJS) system_logging_mock.o | 8 TEST_OBJS = $(CRASH_OBJS) system_logging_mock.o |
| 9 TEST_BINS = user_collector_test | 9 TEST_BINS = user_collector_test |
| 10 | 10 |
| 11 LIBS = -lbase -lpthread -lgflags -lrt -lmetrics | 11 COMMON_LIBS = -lbase -lpthread -lgflags -lrt |
| 12 REPORTER_LIBS = $(COMMON_LIBS) -lmetrics |
| 12 | 13 |
| 13 TEST_LIBS = $(LIBS) -lgtest -lgmock | 14 TEST_LIBS = $(LIBS) -lgtest -lgmock |
| 14 INCLUDE_DIRS = -I.. -I$(SYSROOT)/usr/include/google-breakpad | 15 INCLUDE_DIRS = -I.. -I$(SYSROOT)/usr/include/google-breakpad |
| 15 LIB_DIRS = | |
| 16 | 16 |
| 17 # We need -fPIC for linking objects into shared objects. | 17 CXXFLAGS += -Wall -Werror |
| 18 CXXFLAGS += -fPIC -Wall -Werror | |
| 19 | 18 |
| 20 all: | 19 all: $(REPORTER_BINS) |
| 21 » echo "Specify either $(CRASH_BIN) or $(CRASH_LIB)" | |
| 22 | 20 |
| 23 $(CRASH_LIB): crash_dumper.o | 21 $(CRASH_REPORTER): crash_reporter.o $(CRASH_OBJS) |
| 24 » $(CXX) -shared -lbreakpad_client $^ -o $@ | 22 » $(CXX) $(CXXFLAGS) $^ -lcrash $(REPORTER_LIBS) -o $@ |
| 25 | |
| 26 $(CRASH_BIN): crash_reporter.o $(CRASH_OBJS) | |
| 27 » $(CXX) $(CXXFLAGS) $(LIB_DIRS) $^ -lcrash $(LIBS) -o $@ | |
| 28 | 23 |
| 29 tests: $(TEST_BINS) | 24 tests: $(TEST_BINS) |
| 30 | 25 |
| 31 user_collector_test: user_collector_test.o $(TEST_OBJS) | 26 user_collector_test: user_collector_test.o $(TEST_OBJS) |
| 32 $(CXX) $(CXXFLAGS) $(LIB_DIRS) $^ $(TEST_LIBS) -o $@ | 27 $(CXX) $(CXXFLAGS) $(LIB_DIRS) $^ $(TEST_LIBS) -o $@ |
| 33 | 28 |
| 34 .cc.o: | 29 .cc.o: |
| 35 $(CXX) $(CXXFLAGS) $(INCLUDE_DIRS) -c $< -o $@ | 30 $(CXX) $(CXXFLAGS) $(INCLUDE_DIRS) -c $< -o $@ |
| 36 | 31 |
| 37 clean: | 32 clean: |
| 38 » rm -rf *.o $(CRASH_BIN) $(TEST_BINS) $(CRASH_LIB) | 33 » rm -rf *.o $(CRASH_BIN) $(TEST_BINS) |
| OLD | NEW |