blob: fa0ff646ffd56f835d5d0205da30b355f18c80ba [file] [log] [blame]
The upstream AutoFDO assumes to build on a system that doesn't have protobuf,
and build it with local source. However, the script to build protobuf is not
compatible with Chrome OS. Since Chrome OS has a system protobuf library,
there's no need to build protobuf again. This patch skips building protobuf,
and pointing the tool to link against the system library.
(Will try to upstream this fix, but upstream requires more than this patch,
we need to support both systems with and without protobuf installed.)
diff --git a/Makefile.am b/Makefile.am
index a6b8e0f..e24f89f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,17 +1,7 @@
## Process this file with automake to produce Makefile.in
-PROTOBUF = third_party/protobuf
-PROTOBUF_DEP = $(PROTOBUF)/src/.libs/libprotobuf.a
-PROTOC = ./$(PROTOBUF)/src/protoc
-$(PROTOBUF)/configure:
- echo "[AUTOGEN] Preparing protobuf"
- (cd $(PROTOBUF) ; autoreconf -f -i -Wall,no-obsolete)
-
-$(PROTOC) $(PROTOBUF)/src/.libs/libprotobuf.a: $(PROTOBUF)/configure
- echo "[MAKE] Building protobuf"
- (cd third_party/protobuf/; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g $(PROTOBUF_LDFLAGS_EXTRA)" CPPFLAGS="$(PIC_CPPFLAGS) $(CPPFLAGS_$(CONFIG)) -g $(PROTOBUF_CPPFLAGS_EXTRA)" ./configure --disable-shared --enable-static $(PROTOBUF_CONFIG_OPTS))
- make -C $(PROTOBUF)
+PROTOC = /usr/bin/protoc
protoc_inputs = \
third_party/perf_data_converter/src/quipper/perf_data.proto \
@@ -23,13 +13,13 @@ protoc_outputs = \
third_party/perf_data_converter/src/quipper/perf_stat.pb.cc \
third_party/perf_data_converter/src/quipper/perf_stat.pb.h
-$(protoc_outputs): $(protoc_inputs) $(PROTOC)
+$(protoc_outputs): $(protoc_inputs)
$(PROTOC) --cpp_out=`dirname $<` -I`dirname $<` $(protoc_inputs)
ACLOCAL_AMFLAGS = -I m4
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/glog/src -I$(top_srcdir)/third_party/perf_data_converter/src/quipper -I./$(PROTOBUF)/src
-AM_CXXFLAGS = -std=gnu++11 -I./$(PROTOBUF)/src
-LIBS += -lpthread
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/glog/src -I$(top_srcdir)/third_party/perf_data_converter/src/quipper
+AM_CXXFLAGS = -std=gnu++11
+LIBS += -lpthread -lprotobuf
LIBELF = -lelf
COMMON_PROFILE_CREATOR_FILES = addr2line.cc gcov.cc instruction_map.cc \
@@ -40,7 +30,7 @@ COMMON_PROFILE_CREATOR_FILES = addr2line.cc gcov.cc instruction_map.cc \
bin_PROGRAMS = create_gcov
create_gcov_SOURCES = $(COMMON_PROFILE_CREATOR_FILES) create_gcov.cc
-create_gcov_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF) $(PROTOBUF_DEP)
+create_gcov_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF)
nodist_create_gcov_SOURCES = $(protoc_outputs)
$(am_create_gcov_OBJECTS): $(protoc_outputs)
@@ -51,28 +41,28 @@ dump_gcov_LDADD = libglog.a libgflags.a libsymbolize.a
bin_PROGRAMS += sample_merger
sample_merger_SOURCES = $(COMMON_PROFILE_CREATOR_FILES) sample_merger.cc
-sample_merger_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF) $(PROTOBUF_DEP)
+sample_merger_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF)
nodist_sample_merger_SOURCES = $(protoc_outputs)
$(am_sample_merger_OBJECTS): $(protoc_outputs)
bin_PROGRAMS += profile_merger
profile_merger_SOURCES = $(COMMON_PROFILE_CREATOR_FILES) profile_reader.cc \
profile_merger.cc
-profile_merger_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF) $(PROTOBUF_DEP)
+profile_merger_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF)
nodist_profile_merger_SOURCES = $(protoc_outputs)
$(am_profile_merger_OBJECTS): $(protoc_outputs)
bin_PROGRAMS += profile_diff
profile_diff_SOURCES = $(COMMON_PROFILE_CREATOR_FILES) profile_reader.cc \
profile_diff.cc
-profile_diff_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF) $(PROTOBUF_DEP)
+profile_diff_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF)
nodist_profile_diff_SOURCES = $(protoc_outputs)
$(am_profile_diff_OBJECTS): $(protoc_outputs)
bin_PROGRAMS += profile_update
profile_update_SOURCES = $(COMMON_PROFILE_CREATOR_FILES) profile_reader.cc \
profile_update.cc
-profile_update_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF) $(PROTOBUF_DEP)
+profile_update_LDADD = libquipper.a libglog.a libsymbolize.a libgflags.a $(LIBELF)
nodist_profile_update_SOURCES = $(protoc_outputs)
$(am_profile_update_OBJECTS): $(protoc_outputs)
@@ -80,7 +70,7 @@ bin_PROGRAMS += create_llvm_prof
create_llvm_prof_SOURCES = $(COMMON_PROFILE_CREATOR_FILES) \
llvm_profile_writer.cc create_llvm_prof.cc
create_llvm_prof_LDADD = $(LLVM_LDFLAGS) $(LLVM_LIBS) libquipper.a libglog.a \
- libsymbolize.a libgflags.a $(LIBELF) $(PROTOBUF_DEP)
+ libsymbolize.a libgflags.a $(LIBELF)
create_llvm_prof_CXXFLAGS = $(LLVM_CXXFLAGS) -DCREATE_LLVM_PROF
nodist_create_llvm_prof_SOURCES = $(protoc_outputs)
$(am_create_llvm_prof_OBJECTS): $(protoc_outputs)