From c55dbfd6d80e9536608ad7bbd7947f2d3d0d7138 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 9 Mar 2012 14:06:24 -0500 Subject: [PATCH] clean up makefile and convert to SLOT-ed libbase This includes a couple of fixes: - use the right compiler flag names - execute pkg-config twice total, and not once per compile - build against SLOT-ed libbase BUG=chromium-os:16623 TEST=`emerge-x86-alex crash-reporter` still works TEST=`cros_run_unit_tests --board x86-alex -p crash-reporter` passes Change-Id: I76fdf552de1c0e10367475f3ad22b6b0b33bfa66 Reviewed-on: https://gerrit.chromium.org/gerrit/17709 Reviewed-by: Ben Chan Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger Reviewed-by: Kees Cook --- crash_reporter/Makefile | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/crash_reporter/Makefile b/crash_reporter/Makefile index 05cea91b8..9a25a8839 100644 --- a/crash_reporter/Makefile +++ b/crash_reporter/Makefile @@ -2,6 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +BASE_VER = 85268 +PKG_CONFIG ?= pkg-config + CRASH_REPORTER = crash_reporter LIST_PROXIES_BIN = list_proxies REPORTER_BINS = $(CRASH_REPORTER) $(LIST_PROXIES_BIN) @@ -19,37 +22,35 @@ TEST_BINS = \ unclean_shutdown_collector_test \ user_collector_test -LDCONFIG = $(shell $(PKG_CONFIG) --libs libpcrecpp) +PC_DEPS = glib-2.0 $(LIST_PROXIES_PKGS) libpcrecpp \ + libchrome-$(BASE_VER) libchromeos-$(BASE_VER) +PC_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PC_DEPS)) +PC_LIBS := $(shell $(PKG_CONFIG) --libs $(PC_DEPS)) -PC_DEPS = glib-2.0 libchromeos $(LIST_PROXIES_PKGS) - -# -lglib-2.0 is needed by libbase.a now. -COMMON_LIBS = -lbase -lgflags $(LDCONFIG) \ - $(shell $(PKG_CONFIG) --libs $(PC_DEPS)) +COMMON_LIBS = -lgflags $(PC_LIBS) REPORTER_LIBS = $(COMMON_LIBS) -lmetrics LIST_PROXIES_LIBS = $(COMMON_LIBS) TEST_LIBS = $(COMMON_LIBS) -lgtest -lgmock -INCLUDE_DIRS = -I.. -I$(SYSROOT)/usr/include/google-breakpad \ - $(shell $(PKG_CONFIG) --cflags $(PC_DEPS)) +CPPFLAGS += -I.. -I$(SYSROOT)/usr/include/google-breakpad $(PC_CFLAGS) CXXFLAGS += -Wall -Werror all: $(REPORTER_BINS) $(CRASH_REPORTER): crash_reporter.o $(CRASH_OBJS) - $(CXX) $(CXXFLAGS) $^ $(REPORTER_LIBS) -o $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(REPORTER_LIBS) -o $@ $(LIST_PROXIES_BIN): $(LIST_PROXIES_OBJS) - $(CXX) $(CXXFLAGS) $^ $(LIST_PROXIES_LIBS) -o $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(LIST_PROXIES_LIBS) -o $@ tests: $(TEST_BINS) %_test: %_test.o $(TEST_OBJS) - $(CXX) $(CXXFLAGS) $(LIB_DIRS) $^ $(TEST_LIBS) -o $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(TEST_LIBS) -o $@ .cc.o: - $(CXX) $(CXXFLAGS) $(INCLUDE_DIRS) -c $< -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ clean: rm -rf *.o $(CRASH_BIN) $(LIST_PROXIES_BIN) $(TEST_BINS)