From 8dfa980cbad9d5f9cf9a9dc8da511d0ec0bf01e2 Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Fri, 27 May 2016 17:25:02 -0700 Subject: [PATCH] Add statically-linked library for tools/benchmarks Summary: Currently all the tools are included in librocksdb.a (db_bench is not). With this separate library, we can access db_bench functionality from our internal repo and eventually move tools out of librocksdb.a. Test Plan: built a simple binary against this library that invokes db_bench_tool(). Reviewers: IslamAbdelRahman, sdong Reviewed By: sdong Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D58977 --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9770fc710..b2749957d 100644 --- a/Makefile +++ b/Makefile @@ -407,6 +407,7 @@ else endif endif LIBRARY = ${LIBNAME}.a +TOOLS_LIBRARY = ${LIBNAME}_tools.a ROCKSDB_MAJOR = $(shell egrep "ROCKSDB_MAJOR.[0-9]" include/rocksdb/version.h | cut -d ' ' -f 3) ROCKSDB_MINOR = $(shell egrep "ROCKSDB_MINOR.[0-9]" include/rocksdb/version.h | cut -d ' ' -f 3) @@ -458,10 +459,10 @@ endif # PLATFORM_SHARED_EXT .PHONY: blackbox_crash_test check clean coverage crash_test ldb_tests package \ release tags valgrind_check whitebox_crash_test format static_lib shared_lib all \ dbg rocksdbjavastatic rocksdbjava install install-static install-shared uninstall \ - analyze tools + analyze tools tools_lib -all: $(LIBRARY) $(BENCHMARKS) tools $(TESTS) +all: $(LIBRARY) $(BENCHMARKS) tools tools_lib $(TESTS) static_lib: $(LIBRARY) @@ -469,6 +470,8 @@ shared_lib: $(SHARED) tools: $(TOOLS) +tools_lib: $(TOOLS_LIBRARY) + dbg: $(LIBRARY) $(BENCHMARKS) tools $(TESTS) # creates static library and programs @@ -798,6 +801,10 @@ $(LIBRARY): $(LIBOBJECTS) $(AM_V_AR)rm -f $@ $(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIBOBJECTS) +$(TOOLS_LIBRARY): $(BENCH_SOURCES:.cc=.o) $(TOOL_SOURCES:.cc=.o) $(LIB_SOURCES:.cc=.o) $(TESTUTIL) + $(AM_V_AR)rm -f $@ + $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ + db_bench: tools/db_bench.o $(BENCHTOOLOBJECTS) $(AM_LINK)