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
This commit is contained in:
Andrew Kryczka 2016-05-27 17:25:02 -07:00
parent f62fbd2c85
commit 8dfa980cba

View File

@ -407,6 +407,7 @@ else
endif endif
endif endif
LIBRARY = ${LIBNAME}.a 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_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) 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 \ .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 \ release tags valgrind_check whitebox_crash_test format static_lib shared_lib all \
dbg rocksdbjavastatic rocksdbjava install install-static install-shared uninstall \ 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) static_lib: $(LIBRARY)
@ -469,6 +470,8 @@ shared_lib: $(SHARED)
tools: $(TOOLS) tools: $(TOOLS)
tools_lib: $(TOOLS_LIBRARY)
dbg: $(LIBRARY) $(BENCHMARKS) tools $(TESTS) dbg: $(LIBRARY) $(BENCHMARKS) tools $(TESTS)
# creates static library and programs # creates static library and programs
@ -798,6 +801,10 @@ $(LIBRARY): $(LIBOBJECTS)
$(AM_V_AR)rm -f $@ $(AM_V_AR)rm -f $@
$(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIBOBJECTS) $(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) db_bench: tools/db_bench.o $(BENCHTOOLOBJECTS)
$(AM_LINK) $(AM_LINK)