From 80f71b5863495b7c924805377779a3c01a6acf21 Mon Sep 17 00:00:00 2001 From: mrambacher Date: Tue, 30 Jun 2020 19:31:57 -0700 Subject: [PATCH] Use Libraries in the RocksDB Makefile Build (#6660) Summary: Change the linking of tests/tools to be against a library rather than a list of objects. This change substantially reduces the size of the objects produced. peterd clean repo size: 264M Before this change, with make all: 40G After this change, with make all: 28G With make LIB_MODE=shared all: 7.0G The list of TESTS was changed from being hard-coded to generated from the test sources variable. Note that there are some test sources that are not built as tests (though the set of tests is identical to the previous version). Added OBJ_DIR option to Makefile to allow objects to be placed in an alternative location. By default, OBJ_DIR is the same as before ("./"). This change is a precursor to being able to build/run the tests/tools linked against static libraries. Additionally, it should be possible to clean up and merge some of the rules for building tests and the like if so desired. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6660 Reviewed By: riversand963 Differential Revision: D22244463 Pulled By: pdillinger fbshipit-source-id: db9c6341d81ed62c2270374f4ede02fb9604c754 --- Makefile | 930 ++++++++++++------------------ buckifier/buckify_rocksdb.py | 67 +-- build_tools/build_detect_platform | 36 +- db/external_sst_file_test.cc | 4 +- db_stress_tool/db_stress_tool.cc | 3 +- src.mk | 88 +-- 6 files changed, 485 insertions(+), 643 deletions(-) diff --git a/Makefile b/Makefile index f14d8a383..b58b64e2b 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,13 @@ quoted_perl_command = $(subst ','\'',$(perl_command)) # Set the default DEBUG_LEVEL to 1 DEBUG_LEVEL?=1 +# LIB_MODE says whether or not to use/build "shared" or "static" libraries. +# Mode "static" means to link against static libraries (.a) +# Mode "shared" means to link against shared libraries (.so, .sl, .dylib, etc) +# +# Set the default LIB_MODE to static +LIB_MODE?=static + ifeq ($(MAKECMDGOALS),dbg) DEBUG_LEVEL=2 endif @@ -59,47 +66,50 @@ ifeq ($(MAKECMDGOALS),release) endif ifeq ($(MAKECMDGOALS),shared_lib) + LIB_MODE=shared DEBUG_LEVEL=0 endif ifeq ($(MAKECMDGOALS),install-shared) + LIB_MODE=shared DEBUG_LEVEL=0 endif ifeq ($(MAKECMDGOALS),static_lib) DEBUG_LEVEL=0 + LIB_MODE=static endif ifeq ($(MAKECMDGOALS),install-static) DEBUG_LEVEL=0 + LIB_MODE=static endif ifeq ($(MAKECMDGOALS),install) DEBUG_LEVEL=0 endif -ifeq ($(MAKECMDGOALS),rocksdbjavastatic) - ifneq ($(DEBUG_LEVEL),2) - DEBUG_LEVEL=0 - endif + +ifneq ($(findstring jtest, $(MAKECMDGOALS)),) + OBJ_DIR=jl + LIB_MODE=shared endif -ifeq ($(MAKECMDGOALS),rocksdbjavastaticrelease) - ifneq ($(DEBUG_LEVEL),2) - DEBUG_LEVEL=0 +ifneq ($(findstring rocksdbjava, $(MAKECMDGOALS)),) + LIB_MODE=shared + ifneq ($(findstring rocksdbjavastatic, $(MAKECMDGOALS)),) + OBJ_DIR=jls + ifneq ($(DEBUG_LEVEL),2) + DEBUG_LEVEL=0 + endif + ifeq ($(MAKECMDGOALS),rocksdbjavastaticpublish) + DEBUG_LEVEL=0 + endif + else + OBJ_DIR=jl endif endif -ifeq ($(MAKECMDGOALS),rocksdbjavastaticreleasedocker) - ifneq ($(DEBUG_LEVEL),2) - DEBUG_LEVEL=0 - endif -endif - -ifeq ($(MAKECMDGOALS),rocksdbjavastaticpublish) - DEBUG_LEVEL=0 -endif - $(info $$DEBUG_LEVEL is ${DEBUG_LEVEL}) # Lite build flag. @@ -152,6 +162,12 @@ CFLAGS += -march=armv8-a+crc+crypto ARMCRC_SOURCE=1 endif +# if we're compiling for shared libraries, add the shared flags +ifeq ($(LIB_MODE),shared) +CXXFLAGS += $(PLATFORM_SHARED_CFLAGS) -DROCKSDB_DLL +CFLAGS += $(PLATFORM_SHARED_CFLAGS) -DROCKSDB_DLL +endif + # if we're compiling for release, compile without debug code (-DNDEBUG) ifeq ($(DEBUG_LEVEL),0) OPT += -DNDEBUG @@ -180,7 +196,7 @@ endif #----------------------------------------------- include src.mk -AM_DEFAULT_VERBOSITY = 0 +AM_DEFAULT_VERBOSITY ?= 0 AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) @@ -215,7 +231,8 @@ LIB_SOURCES += utilities/env_librados.cc LDFLAGS += -lrados endif -AM_LINK = $(AM_V_CCLD)$(CXX) $^ $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS) +AM_LINK = $(AM_V_CCLD)$(CXX) $(patsubst lib%.a, -l%, $(patsubst lib%.$(PLATFORM_SHARED_EXT), -l%, $^)) $(EXEC_LDFLAGS) -o $@ -L. $(LDFLAGS) $(COVERAGEFLAGS) +AM_SHARE = $(AM_V_CCLD) $(CXX) $(PLATFORM_SHARED_LDFLAGS)$@ $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) -L. $(patsubst lib%.$(PLATFORM_SHARED_EXT), -l%, $^) $(LDFLAGS) -o $@ # Detect what platform we're building on. # Export some common variables that might have been passed as Make variables @@ -229,6 +246,7 @@ dummy := $(shell (export ROCKSDB_ROOT="$(CURDIR)"; \ export USE_CLANG="$(USE_CLANG)"; \ "$(CURDIR)/build_tools/build_detect_platform" "$(CURDIR)/make_config.mk")) # this file is generated by the previous line to set build flags and sources + include make_config.mk export JAVAC_ARGS CLEAN_FILES += make_config.mk @@ -268,6 +286,11 @@ ifneq ($(filter -DROCKSDB_LITE,$(OPT)),) LUA_PATH = endif +ifeq ($(LIB_MODE),shared) +# So that binaries are executable from build location, in addition to install location +EXEC_LDFLAGS += -Wl,-rpath='$$ORIGIN' +endif + # ASAN doesn't work well with jemalloc. If we're compiling with ASAN, we should use regular malloc. ifdef COMPILE_WITH_ASAN DISABLE_JEMALLOC=1 @@ -436,212 +459,43 @@ util/build_version.cc: FORCE else mv -f $@-t $@; fi endif -LIBOBJECTS = $(LIB_SOURCES:.cc=.o) +OBJ_DIR?=. +LIB_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(LIB_SOURCES)) ifeq ($(HAVE_POWER8),1) -LIB_CC_OBJECTS = $(LIB_SOURCES:.cc=.o) -LIBOBJECTS += $(LIB_SOURCES_C:.c=.o) -LIBOBJECTS += $(LIB_SOURCES_ASM:.S=.o) -else -LIB_CC_OBJECTS = $(LIB_SOURCES:.cc=.o) +LIB_OBJECTS += $(patsubst %.c, $(OBJ_DIR)/%.o, $(LIB_SOURCES_C)) +LIB_OBJECTS += $(patsubst %.S, $(OBJ_DIR)/%.o, $(LIB_SOURCES_ASM)) endif -LIBOBJECTS += $(TOOL_LIB_SOURCES:.cc=.o) -MOCKOBJECTS = $(MOCK_LIB_SOURCES:.cc=.o) ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1) - FOLLYOBJECTS = $(FOLLY_SOURCES:.cpp=.o) + LIB_OBJECTS += $(patsubst %.cpp, $(OBJ_DIR)/%.o, $(FOLLY_SOURCES)) endif -GTEST = $(GTEST_DIR)/gtest/gtest-all.o -TESTUTIL = ./test_util/testutil.o -TESTHARNESS = ./test_util/testharness.o $(TESTUTIL) $(MOCKOBJECTS) $(GTEST) +GTEST = $(OBJ_DIR)/$(GTEST_DIR)/gtest/gtest-all.o +TESTUTIL = $(OBJ_DIR)/test_util/testutil.o +TESTHARNESS = $(OBJ_DIR)/test_util/testharness.o $(TESTUTIL) $(GTEST) VALGRIND_ERROR = 2 VALGRIND_VER := $(join $(VALGRIND_VER),valgrind) VALGRIND_OPTS = --error-exitcode=$(VALGRIND_ERROR) --leak-check=full -BENCHTOOLOBJECTS = $(BENCH_LIB_SOURCES:.cc=.o) $(LIBOBJECTS) $(TESTUTIL) +TEST_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(TEST_LIB_SOURCES) $(MOCK_LIB_SOURCES)) $(GTEST) +BENCH_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(BENCH_LIB_SOURCES)) +TOOL_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(TOOL_LIB_SOURCES)) +ANALYZE_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(ANALYZER_LIB_SOURCES)) +STRESS_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(STRESS_LIB_SOURCES)) -ANALYZETOOLOBJECTS = $(ANALYZER_LIB_SOURCES:.cc=.o) +ALL_SOURCES = $(LIB_SOURCES) $(TEST_LIB_SOURCES) $(MOCK_LIB_SOURCES) $(GTEST_DIR)/gtest/gtest-all.cc +ALL_SOURCES += $(TOOL_LIB_SOURCES) $(BENCH_LIB_SOURCES) $(ANALYZER_LIB_SOURCES) $(STRESS_LIB_SOURCES) +ALL_SOURCES += $(TEST_MAIN_SOURCES) $(TOOL_MAIN_SOURCES) $(BENCH_MAIN_SOURCES) -ifeq ($(DEBUG_LEVEL),0) -STRESSTOOLOBJECTS = $(STRESS_LIB_SOURCES:.cc=.o) $(LIBOBJECTS) $(TESTUTIL) -else -STRESSTOOLOBJECTS = $(STRESS_LIB_SOURCES:.cc=.o) $(LIBOBJECTS) $(TESTUTIL) \ - $(TESTHARNESS) +TESTS = $(patsubst %.cc, %, $(notdir $(TEST_MAIN_SOURCES))) +TESTS += $(patsubst %.c, %, $(notdir $(TEST_MAIN_SOURCES_C))) + +ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1) + TESTS += folly_synchronization_distributed_mutex_test + ALL_SOURCES += third-party/folly/folly/synchronization/test/DistributedMutexTest.cc endif -EXPOBJECTS = $(LIBOBJECTS) $(TESTUTIL) - -TESTS = \ - db_basic_test \ - db_with_timestamp_basic_test \ - db_encryption_test \ - db_test2 \ - external_sst_file_basic_test \ - auto_roll_logger_test \ - bloom_test \ - dynamic_bloom_test \ - c_test \ - checkpoint_test \ - crc32c_test \ - coding_test \ - inlineskiplist_test \ - env_basic_test \ - env_test \ - env_logger_test \ - io_posix_test \ - hash_test \ - random_test \ - thread_local_test \ - work_queue_test \ - rate_limiter_test \ - perf_context_test \ - iostats_context_test \ - db_wal_test \ - db_block_cache_test \ - db_test \ - db_logical_block_size_cache_test \ - db_blob_index_test \ - db_iter_test \ - db_iter_stress_test \ - db_log_iter_test \ - db_bloom_filter_test \ - db_compaction_filter_test \ - db_compaction_test \ - db_dynamic_level_test \ - db_flush_test \ - db_inplace_update_test \ - db_iterator_test \ - db_memtable_test \ - db_merge_operator_test \ - db_merge_operand_test \ - db_options_test \ - db_range_del_test \ - db_secondary_test \ - db_sst_test \ - db_tailing_iter_test \ - db_io_failure_test \ - db_properties_test \ - db_table_properties_test \ - db_statistics_test \ - db_write_test \ - error_handler_fs_test \ - autovector_test \ - blob_db_test \ - cleanable_test \ - column_family_test \ - table_properties_collector_test \ - arena_test \ - memkind_kmem_allocator_test \ - block_test \ - data_block_hash_index_test \ - cache_test \ - corruption_test \ - slice_test \ - slice_transform_test \ - dbformat_test \ - fault_injection_test \ - filelock_test \ - filename_test \ - random_access_file_reader_test \ - file_reader_writer_test \ - block_based_filter_block_test \ - block_based_table_reader_test \ - full_filter_block_test \ - partitioned_filter_block_test \ - hash_table_test \ - histogram_test \ - log_test \ - manual_compaction_test \ - mock_env_test \ - memtable_list_test \ - merge_helper_test \ - memory_test \ - merge_test \ - merger_test \ - util_merge_operators_test \ - options_file_test \ - reduce_levels_test \ - plain_table_db_test \ - comparator_db_test \ - external_sst_file_test \ - import_column_family_test \ - prefix_test \ - skiplist_test \ - write_buffer_manager_test \ - stringappend_test \ - cassandra_format_test \ - cassandra_functional_test \ - cassandra_row_merge_test \ - cassandra_serialize_test \ - ttl_test \ - backupable_db_test \ - cache_simulator_test \ - sim_cache_test \ - version_edit_test \ - version_set_test \ - compaction_picker_test \ - version_builder_test \ - file_indexer_test \ - write_batch_test \ - write_batch_with_index_test \ - write_controller_test\ - deletefile_test \ - obsolete_files_test \ - table_test \ - block_fetcher_test \ - delete_scheduler_test \ - options_test \ - options_settable_test \ - options_util_test \ - event_logger_test \ - timer_queue_test \ - cuckoo_table_builder_test \ - cuckoo_table_reader_test \ - cuckoo_table_db_test \ - flush_job_test \ - wal_manager_test \ - listener_test \ - compaction_iterator_test \ - compaction_job_test \ - thread_list_test \ - sst_dump_test \ - compact_files_test \ - optimistic_transaction_test \ - write_callback_test \ - heap_test \ - compact_on_deletion_collector_test \ - compaction_job_stats_test \ - option_change_migration_test \ - transaction_test \ - transaction_lock_mgr_test \ - ldb_cmd_test \ - persistent_cache_test \ - statistics_test \ - stats_history_test \ - lru_cache_test \ - object_registry_test \ - repair_test \ - env_timed_test \ - write_prepared_transaction_test \ - write_unprepared_transaction_test \ - db_universal_compaction_test \ - trace_analyzer_test \ - repeatable_thread_test \ - range_tombstone_fragmenter_test \ - range_del_aggregator_test \ - sst_file_reader_test \ - db_secondary_test \ - block_cache_tracer_test \ - block_cache_trace_analyzer_test \ - defer_test \ - blob_file_addition_test \ - blob_file_garbage_test \ - timer_test \ - db_with_timestamp_compaction_test \ - testutil_test \ - io_tracer_test \ - PARALLEL_TEST = \ backupable_db_test \ db_bloom_filter_test \ @@ -675,8 +529,8 @@ ifdef COMPILE_WITH_UBSAN TESTS := $(shell echo $(TESTS) | sed 's/\boptions_settable_test\b//g') endif ifdef ASSERT_STATUS_CHECKED - # This is a new check for which we will add support incrementally. This - # list can be removed once support is fully added. +# This is a new check for which we will add support incrementally. This +# list can be removed once support is fully added. TESTS_PASSING_ASC = \ arena_test \ autovector_test \ @@ -735,37 +589,48 @@ ifdef ROCKSDBTESTS_END SUBSET := $(shell echo $(SUBSET) | sed 's/$(ROCKSDBTESTS_END).*//') endif -TOOLS = \ - sst_dump \ - db_sanity_test \ - db_stress \ - write_stress \ - ldb \ - db_repl_stress \ - rocksdb_dump \ - rocksdb_undump \ - blob_dump \ - trace_analyzer \ - block_cache_trace_analyzer \ +# bench_tool_analyer main is in bench_tool_analyzer_tool, or this would be simpler... +TOOLS = $(patsubst %.cc, %, $(notdir $(patsubst %_tool.cc, %.cc, $(TOOLS_MAIN_SOURCES)))) TEST_LIBS = \ librocksdb_env_basic_test.a # TODO: add back forward_iterator_bench, after making it build in all environemnts. -BENCHMARKS = db_bench table_reader_bench cache_bench memtablerep_bench filter_bench persistent_cache_bench range_del_aggregator_bench +BENCHMARKS = $(patsubst %.cc, %, $(notdir $(BENCH_MAIN_SOURCES))) # if user didn't config LIBNAME, set the default ifeq ($(LIBNAME),) + LIBNAME=librocksdb # we should only run rocksdb in production with DEBUG_LEVEL 0 -ifeq ($(DEBUG_LEVEL),0) - LIBNAME=librocksdb +ifneq ($(DEBUG_LEVEL),0) + LIBDEBUG=_debug +endif +endif +STATIC_LIBRARY = ${LIBNAME}$(LIBDEBUG).a +STATIC_TEST_LIBRARY = ${LIBNAME}_test$(LIBDEBUG).a +STATIC_TOOLS_LIBRARY = ${LIBNAME}_tools$(LIBDEBUG).a +STATIC_STRESS_LIBRARY = ${LIBNAME}_stress$(LIBDEBUG).a + +ALL_STATIC_LIBS = $(STATIC_LIBRARY) $(STATIC_TEST_LIBRARY) $(STATIC_TOOLS_LIBRARY) $(STATIC_STRESS_LIBRARY) + +SHARED_TEST_LIBRARY = ${LIBNAME}_test$(LIBDEBUG).$(PLATFORM_SHARED_EXT) +SHARED_TOOLS_LIBRARY = ${LIBNAME}_tools$(LIBDEBUG).$(PLATFORM_SHARED_EXT) +SHARED_STRESS_LIBRARY = ${LIBNAME}_stress$(LIBDEBUG).$(PLATFORM_SHARED_EXT) + +ALL_SHARED_LIBS = $(SHARED1) $(SHARED2) $(SHARED3) $(SHARED4) $(SHARED_TEST_LIBRARY) $(SHARED_TOOLS_LIBRARY) $(SHARED_STRESS_LIBRARY) + +ifeq ($(LIB_MODE),shared) +LIBRARY=$(SHARED1) +TEST_LIBRARY=$(SHARED_TEST_LIBRARY) +TOOLS_LIBRARY=$(SHARED_TOOLS_LIBRARY) +STRESS_LIBRARY=$(SHARED_STRESS_LIBRARY) +CLOUD_LIBRARY=$(SHARED_CLOUD_LIBRARY) else - LIBNAME=librocksdb_debug +LIBRARY=$(STATIC_LIBRARY) +TEST_LIBRARY=$(STATIC_TEST_LIBRARY) +TOOLS_LIBRARY=$(STATIC_TOOLS_LIBRARY) +STRESS_LIBRARY=$(STATIC_STRESS_LIBRARY) endif -endif -LIBRARY = ${LIBNAME}.a -TOOLS_LIBRARY = ${LIBNAME}_tools.a -STRESS_LIBRARY = ${LIBNAME}_stress.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) @@ -779,7 +644,7 @@ default: all ifneq ($(PLATFORM_SHARED_EXT),) ifneq ($(PLATFORM_SHARED_VERSIONED),true) -SHARED1 = ${LIBNAME}.$(PLATFORM_SHARED_EXT) +SHARED1 = ${LIBNAME}$(LIBDEBUG).$(PLATFORM_SHARED_EXT) SHARED2 = $(SHARED1) SHARED3 = $(SHARED1) SHARED4 = $(SHARED1) @@ -790,7 +655,7 @@ SHARED_MINOR = $(ROCKSDB_MINOR) SHARED_PATCH = $(ROCKSDB_PATCH) SHARED1 = ${LIBNAME}.$(PLATFORM_SHARED_EXT) ifeq ($(PLATFORM), OS_MACOSX) -SHARED_OSX = $(LIBNAME).$(SHARED_MAJOR) +SHARED_OSX = $(LIBNAME)$(LIBDEBUG).$(SHARED_MAJOR) SHARED2 = $(SHARED_OSX).$(PLATFORM_SHARED_EXT) SHARED3 = $(SHARED_OSX).$(SHARED_MINOR).$(PLATFORM_SHARED_EXT) SHARED4 = $(SHARED_OSX).$(SHARED_MINOR).$(SHARED_PATCH).$(PLATFORM_SHARED_EXT) @@ -798,46 +663,18 @@ else SHARED2 = $(SHARED1).$(SHARED_MAJOR) SHARED3 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR) SHARED4 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR).$(SHARED_PATCH) -endif +endif # MACOSX SHARED = $(SHARED1) $(SHARED2) $(SHARED3) $(SHARED4) -$(SHARED1): $(SHARED4) +$(SHARED1): $(SHARED4) $(SHARED2) ln -fs $(SHARED4) $(SHARED1) -$(SHARED2): $(SHARED4) +$(SHARED2): $(SHARED4) $(SHARED3) ln -fs $(SHARED4) $(SHARED2) $(SHARED3): $(SHARED4) ln -fs $(SHARED4) $(SHARED3) -endif -ifeq ($(HAVE_POWER8),1) -SHARED_C_OBJECTS = $(LIB_SOURCES_C:.c=.o) -SHARED_ASM_OBJECTS = $(LIB_SOURCES_ASM:.S=.o) -SHARED_C_LIBOBJECTS = $(patsubst %.o,shared-objects/%.o,$(SHARED_C_OBJECTS)) -SHARED_ASM_LIBOBJECTS = $(patsubst %.o,shared-objects/%.o,$(SHARED_ASM_OBJECTS)) -shared_libobjects = $(patsubst %,shared-objects/%,$(LIB_CC_OBJECTS)) -else -shared_libobjects = $(patsubst %,shared-objects/%,$(LIBOBJECTS)) -endif - -CLEAN_FILES += shared-objects -shared_all_libobjects = $(shared_libobjects) - -ifeq ($(HAVE_POWER8),1) -shared-ppc-objects = $(SHARED_C_LIBOBJECTS) $(SHARED_ASM_LIBOBJECTS) - -shared-objects/util/crc32c_ppc.o: util/crc32c_ppc.c - $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ - -shared-objects/util/crc32c_ppc_asm.o: util/crc32c_ppc_asm.S - $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ -endif -$(shared_libobjects): shared-objects/%.o: %.cc - $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) -c $< -o $@ - -ifeq ($(HAVE_POWER8),1) -shared_all_libobjects = $(shared_libobjects) $(shared-ppc-objects) -endif -$(SHARED4): $(shared_all_libobjects) - $(CXX) $(PLATFORM_SHARED_LDFLAGS)$(SHARED3) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(shared_all_libobjects) $(LDFLAGS) -o $@ +endif # PLATFORM_SHARED_VERSIONED +$(SHARED4): $(LIB_OBJECTS) + $(AM_V_CCLD) $(CXX) $(PLATFORM_SHARED_LDFLAGS)$(SHARED3) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(LIB_OBJECTS) $(LDFLAGS) -o $@ endif # PLATFORM_SHARED_EXT .PHONY: blackbox_crash_test check clean coverage crash_test ldb_tests package \ @@ -853,7 +690,7 @@ all: $(LIBRARY) $(BENCHMARKS) tools tools_lib test_libs $(TESTS) all_but_some_tests: $(LIBRARY) $(BENCHMARKS) tools tools_lib test_libs $(SUBSET) -static_lib: $(LIBRARY) +static_lib: $(STATIC_LIBRARY) shared_lib: $(SHARED) @@ -865,12 +702,14 @@ tools_lib: $(TOOLS_LIBRARY) test_libs: $(TEST_LIBS) +benchmarks: $(BENCHMARKS) + dbg: $(LIBRARY) $(BENCHMARKS) tools $(TESTS) # creates static library and programs release: $(MAKE) clean - DEBUG_LEVEL=0 $(MAKE) static_lib tools db_bench + LIB_MODE=$(LIB_MODE) DEBUG_LEVEL=0 $(MAKE) tools db_bench coverage: $(MAKE) clean @@ -1248,14 +1087,13 @@ unity.cc: Makefile chmod a=r $@-t mv $@-t $@ -unity.a: unity.o +unity.a: $(OBJ_DIR)/unity.o $(AM_V_AR)rm -f $@ - $(AM_V_at)$(AR) $(ARFLAGS) $@ unity.o + $(AM_V_at)$(AR) $(ARFLAGS) $@ $(OBJ_DIR)/unity.o -TOOLLIBOBJECTS = $(TOOL_LIB_SOURCES:.cc=.o) # try compiling db_test with unity -unity_test: db/db_basic_test.o db/db_test_util.o $(TESTHARNESS) $(TOOLLIBOBJECTS) unity.a +unity_test: $(OBJ_DIR)/db/db_basic_test.o $(OBJ_DIR)/db/db_test_util.o $(TEST_OBJECTS) $(TOOL_OBJECTS) unity.a $(AM_LINK) ./unity_test @@ -1267,12 +1105,15 @@ clean: clean-ext-libraries-all clean-rocks clean-rocksjava clean-not-downloaded: clean-ext-libraries-bin clean-rocks clean-not-downloaded-rocksjava clean-rocks: - rm -f $(BENCHMARKS) $(TOOLS) $(TESTS) $(PARALLEL_TEST) $(LIBRARY) $(SHARED) + echo shared=$(ALL_SHARED_LIBS) + echo static=$(ALL_STATIC_LIBS) + rm -f $(BENCHMARKS) $(TOOLS) $(TESTS) $(PARALLEL_TEST) $(ALL_STATIC_LIBS) $(ALL_SHARED_LIBS) rm -rf $(CLEAN_FILES) ios-x86 ios-arm scan_build_report $(FIND) . -name "*.[oda]" -exec rm -f {} \; $(FIND) . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \; clean-rocksjava: + rm -rf jl jls cd java && $(MAKE) clean clean-not-downloaded-rocksjava: @@ -1311,593 +1152,614 @@ package: # --------------------------------------------------------------------------- # Unit tests and tools # --------------------------------------------------------------------------- -$(LIBRARY): $(LIBOBJECTS) - $(AM_V_AR)rm -f $@ - $(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIBOBJECTS) +$(STATIC_LIBRARY): $(LIB_OBJECTS) + $(AM_V_AR)rm -f $@ $(SHARED1) $(SHARED2) $(SHARED3) $(SHARED4) + $(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIB_OBJECTS) -$(TOOLS_LIBRARY): $(BENCH_LIB_SOURCES:.cc=.o) $(TOOL_LIB_SOURCES:.cc=.o) $(LIB_SOURCES:.cc=.o) $(TESTUTIL) $(ANALYZER_LIB_SOURCES:.cc=.o) +$(STATIC_TEST_LIBRARY): $(TEST_OBJECTS) + $(AM_V_AR)rm -f $@ $(SHARED_TEST_LIBRARY) + $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ + +$(STATIC_TOOLS_LIBRARY): $(BENCH_OBJECTS) $(TOOL_OBJECTS) $(TESTUTIL) + $(AM_V_AR)rm -f $@ $(SHARED_TOOLS_LIBRARY) + $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ + +$(STATIC_STRESS_LIBRARY): $(TESTUTIL) $(ANALYZE_OBJECTS) $(STRESS_OBJECTS) + $(AM_V_AR)rm -f $@ $(SHARED_STRESS_LIBRARY) + $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ + +$(SHARED_TEST_LIBRARY): $(TEST_OBJECTS) $(SHARED1) + $(AM_V_AR)rm -f $@ $(STATIC_TEST_LIBRARY) + $(AM_SHARE) + +$(SHARED_TOOLS_LIBRARY): $(TOOL_OBJECTS) $(TESTUTIL) $(SHARED1) + $(AM_V_AR)rm -f $@ $(STATIC_TOOLS_LIBRARY) + $(AM_SHARE) + +$(SHARED_STRESS_LIBRARY): $(TESTUTIL) $(ANALYZE_OBJECTS) $(STRESS_OBJECTS) $(SHARED1) + $(AM_V_AR)rm -f $@ $(STATIC_STRESS_LIBRARY) + $(AM_SHARE) + +librocksdb_env_basic_test.a: $(OBJ_DIR)/env/env_basic_test.o $(LIB_OBJECTS) $(TESTHARNESS) $(AM_V_AR)rm -f $@ $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ -$(STRESS_LIBRARY): $(LIB_SOURCES:.cc=.o) $(TESTUTIL) $(ANALYZER_LIB_SOURCES:.cc=.o) $(STRESS_LIB_SOURCES:.cc=.o) - $(AM_V_AR)rm -f $@ - $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ - -librocksdb_env_basic_test.a: env/env_basic_test.o $(LIBOBJECTS) $(TESTHARNESS) - $(AM_V_AR)rm -f $@ - $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ - -db_bench: tools/db_bench.o $(BENCHTOOLOBJECTS) +db_bench: $(OBJ_DIR)/tools/db_bench.o $(BENCH_OBJECTS) $(TESTUTIL) $(LIBRARY) $(AM_LINK) -trace_analyzer: tools/trace_analyzer.o $(ANALYZETOOLOBJECTS) $(LIBOBJECTS) +trace_analyzer: $(OBJ_DIR)/tools/trace_analyzer.o $(ANALYZE_OBJECTS) $(TOOLS_LIBRARY) $(LIBRARY) $(AM_LINK) -block_cache_trace_analyzer: tools/block_cache_analyzer/block_cache_trace_analyzer_tool.o $(ANALYZETOOLOBJECTS) $(LIBOBJECTS) +block_cache_trace_analyzer: $(OBJ_DIR)/tools/block_cache_analyzer/block_cache_trace_analyzer_tool.o $(ANALYZE_OBJECTS) $(TOOLS_LIBRARY) $(LIBRARY) $(AM_LINK) ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1) -folly_synchronization_distributed_mutex_test: $(LIBOBJECTS) $(TESTHARNESS) $(FOLLYOBJECTS) third-party/folly/folly/synchronization/test/DistributedMutexTest.o +folly_synchronization_distributed_mutex_test: $(OBJ_DIR)/third-party/folly/folly/synchronization/test/DistributedMutexTest.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) endif -cache_bench: cache/cache_bench.o $(LIBOBJECTS) $(TESTUTIL) +cache_bench: $(OBJ_DIR)/cache/cache_bench.o $(LIBRARY) $(AM_LINK) -persistent_cache_bench: utilities/persistent_cache/persistent_cache_bench.o $(LIBOBJECTS) $(TESTUTIL) +persistent_cache_bench: $(OBJ_DIR)/utilities/persistent_cache/persistent_cache_bench.o $(LIBRARY) $(AM_LINK) -memtablerep_bench: memtable/memtablerep_bench.o $(LIBOBJECTS) $(TESTUTIL) +memtablerep_bench: $(OBJ_DIR)/memtable/memtablerep_bench.o $(TESTUTIL) $(LIBRARY) $(AM_LINK) -filter_bench: util/filter_bench.o $(LIBOBJECTS) $(TESTUTIL) +filter_bench: $(OBJ_DIR)/util/filter_bench.o $(LIBRARY) $(AM_LINK) -db_stress: db_stress_tool/db_stress.o $(STRESSTOOLOBJECTS) +ifeq ($(DEBUG_LEVEL),0) +db_stress: $(OBJ_DIR)/db_stress_tool/db_stress.o $(STRESS_OBJECTS) $(LIBRARY) $(AM_LINK) - -write_stress: tools/write_stress.o $(LIBOBJECTS) $(TESTUTIL) +else +db_stress: $(OBJ_DIR)/db_stress_tool/db_stress.o $(STRESS_OBJECTS) $(TEST_LIBRARY) $(LIBRARY) + $(AM_LINK) +endif +write_stress: $(OBJ_DIR)/tools/write_stress.o $(LIBRARY) $(AM_LINK) -db_sanity_test: tools/db_sanity_test.o $(LIBOBJECTS) $(TESTUTIL) +db_sanity_test: $(OBJ_DIR)/tools/db_sanity_test.o $(LIBRARY) $(AM_LINK) -db_repl_stress: tools/db_repl_stress.o $(LIBOBJECTS) $(TESTUTIL) +db_repl_stress: $(OBJ_DIR)/tools/db_repl_stress.o $(TESTUTIL) $(LIBRARY) $(AM_LINK) -arena_test: memory/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) +arena_test: $(OBJ_DIR)/memory/arena_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -memkind_kmem_allocator_test: memory/memkind_kmem_allocator_test.o $(LIBOBJECTS) $(TESTHARNESS) +memkind_kmem_allocator_test: memory/memkind_kmem_allocator_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -autovector_test: util/autovector_test.o $(LIBOBJECTS) $(TESTHARNESS) +autovector_test: $(OBJ_DIR)/util/autovector_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -column_family_test: db/column_family_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +column_family_test: $(OBJ_DIR)/db/column_family_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -table_properties_collector_test: db/table_properties_collector_test.o $(LIBOBJECTS) $(TESTHARNESS) +table_properties_collector_test: $(OBJ_DIR)/db/table_properties_collector_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -bloom_test: util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) +bloom_test: $(OBJ_DIR)/util/bloom_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -dynamic_bloom_test: util/dynamic_bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) +dynamic_bloom_test: $(OBJ_DIR)/util/dynamic_bloom_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) +c_test: $(OBJ_DIR)/db/c_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cache_test: cache/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) +cache_test: $(OBJ_DIR)/cache/cache_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) +coding_test: $(OBJ_DIR)/util/coding_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -hash_test: util/hash_test.o $(LIBOBJECTS) $(TESTHARNESS) +hash_test: $(OBJ_DIR)/util/hash_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -random_test: util/random_test.o $(LIBOBJECTS) $(TESTHARNESS) +random_test: $(OBJ_DIR)/util/random_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -option_change_migration_test: utilities/option_change_migration/option_change_migration_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +option_change_migration_test: $(OBJ_DIR)/utilities/option_change_migration/option_change_migration_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -stringappend_test: utilities/merge_operators/string_append/stringappend_test.o $(LIBOBJECTS) $(TESTHARNESS) +stringappend_test: $(OBJ_DIR)/utilities/merge_operators/string_append/stringappend_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cassandra_format_test: utilities/cassandra/cassandra_format_test.o utilities/cassandra/test_utils.o $(LIBOBJECTS) $(TESTHARNESS) +cassandra_format_test: $(OBJ_DIR)/utilities/cassandra/cassandra_format_test.o $(OBJ_DIR)/utilities/cassandra/test_utils.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cassandra_functional_test: utilities/cassandra/cassandra_functional_test.o utilities/cassandra/test_utils.o $(LIBOBJECTS) $(TESTHARNESS) +cassandra_functional_test: $(OBJ_DIR)/utilities/cassandra/cassandra_functional_test.o $(OBJ_DIR)/utilities/cassandra/test_utils.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cassandra_row_merge_test: utilities/cassandra/cassandra_row_merge_test.o utilities/cassandra/test_utils.o $(LIBOBJECTS) $(TESTHARNESS) +cassandra_row_merge_test: $(OBJ_DIR)/utilities/cassandra/cassandra_row_merge_test.o $(OBJ_DIR)/utilities/cassandra/test_utils.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cassandra_serialize_test: utilities/cassandra/cassandra_serialize_test.o $(LIBOBJECTS) $(TESTHARNESS) +cassandra_serialize_test: $(OBJ_DIR)/utilities/cassandra/cassandra_serialize_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -hash_table_test: utilities/persistent_cache/hash_table_test.o $(LIBOBJECTS) $(TESTHARNESS) +hash_table_test: $(OBJ_DIR)/utilities/persistent_cache/hash_table_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -histogram_test: monitoring/histogram_test.o $(LIBOBJECTS) $(TESTHARNESS) +histogram_test: $(OBJ_DIR)/monitoring/histogram_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -thread_local_test: util/thread_local_test.o $(LIBOBJECTS) $(TESTHARNESS) +thread_local_test: $(OBJ_DIR)/util/thread_local_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -work_queue_test: util/work_queue_test.o $(LIBOBJECTS) $(TESTHARNESS) +work_queue_test: $(OBJ_DIR)/util/work_queue_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -corruption_test: db/corruption_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +corruption_test: $(OBJ_DIR)/db/corruption_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) +crc32c_test: $(OBJ_DIR)/util/crc32c_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -slice_test: util/slice_test.o $(LIBOBJECTS) $(TESTHARNESS) +slice_test: $(OBJ_DIR)/util/slice_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -slice_transform_test: util/slice_transform_test.o $(LIBOBJECTS) $(TESTHARNESS) +slice_transform_test: $(OBJ_DIR)/util/slice_transform_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_basic_test: db/db_basic_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_basic_test: $(OBJ_DIR)/db/db_basic_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_with_timestamp_basic_test: db/db_with_timestamp_basic_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_with_timestamp_basic_test: $(OBJ_DIR)/db/db_with_timestamp_basic_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_with_timestamp_compaction_test: db/db_with_timestamp_compaction_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_with_timestamp_compaction_test: db/db_with_timestamp_compaction_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_encryption_test: db/db_encryption_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_encryption_test: $(OBJ_DIR)/db/db_encryption_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_test: db/db_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_test: $(OBJ_DIR)/db/db_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_test2: db/db_test2.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_test2: $(OBJ_DIR)/db/db_test2.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_logical_block_size_cache_test: db/db_logical_block_size_cache_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_logical_block_size_cache_test: $(OBJ_DIR)/db/db_logical_block_size_cache_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_blob_index_test: db/blob/db_blob_index_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_blob_index_test: $(OBJ_DIR)/db/blob/db_blob_index_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_block_cache_test: db/db_block_cache_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_block_cache_test: $(OBJ_DIR)/db/db_block_cache_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_bloom_filter_test: db/db_bloom_filter_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_bloom_filter_test: $(OBJ_DIR)/db/db_bloom_filter_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_log_iter_test: db/db_log_iter_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_log_iter_test: $(OBJ_DIR)/db/db_log_iter_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_compaction_filter_test: db/db_compaction_filter_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_compaction_filter_test: $(OBJ_DIR)/db/db_compaction_filter_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_compaction_test: db/db_compaction_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_compaction_test: $(OBJ_DIR)/db/db_compaction_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_dynamic_level_test: db/db_dynamic_level_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_dynamic_level_test: $(OBJ_DIR)/db/db_dynamic_level_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_flush_test: db/db_flush_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_flush_test: $(OBJ_DIR)/db/db_flush_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_inplace_update_test: db/db_inplace_update_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_inplace_update_test: $(OBJ_DIR)/db/db_inplace_update_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_iterator_test: db/db_iterator_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_iterator_test: $(OBJ_DIR)/db/db_iterator_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_memtable_test: db/db_memtable_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_memtable_test: $(OBJ_DIR)/db/db_memtable_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_merge_operator_test: db/db_merge_operator_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_merge_operator_test: $(OBJ_DIR)/db/db_merge_operator_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_merge_operand_test: db/db_merge_operand_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_merge_operand_test: $(OBJ_DIR)/db/db_merge_operand_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_options_test: db/db_options_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_options_test: $(OBJ_DIR)/db/db_options_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_range_del_test: db/db_range_del_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_range_del_test: $(OBJ_DIR)/db/db_range_del_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_sst_test: db/db_sst_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_sst_test: $(OBJ_DIR)/db/db_sst_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_statistics_test: db/db_statistics_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_statistics_test: $(OBJ_DIR)/db/db_statistics_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_write_test: db/db_write_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_write_test: $(OBJ_DIR)/db/db_write_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -error_handler_fs_test: db/error_handler_fs_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +error_handler_fs_test: $(OBJ_DIR)/db/error_handler_fs_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -external_sst_file_basic_test: db/external_sst_file_basic_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +external_sst_file_basic_test: $(OBJ_DIR)/db/external_sst_file_basic_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -external_sst_file_test: db/external_sst_file_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +external_sst_file_test: $(OBJ_DIR)/db/external_sst_file_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -import_column_family_test: db/import_column_family_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +import_column_family_test: $(OBJ_DIR)/db/import_column_family_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_tailing_iter_test: db/db_tailing_iter_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_tailing_iter_test: $(OBJ_DIR)/db/db_tailing_iter_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_iter_test: db/db_iter_test.o $(LIBOBJECTS) $(TESTHARNESS) +db_iter_test: $(OBJ_DIR)/db/db_iter_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_iter_stress_test: db/db_iter_stress_test.o $(LIBOBJECTS) $(TESTHARNESS) +db_iter_stress_test: $(OBJ_DIR)/db/db_iter_stress_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_universal_compaction_test: db/db_universal_compaction_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_universal_compaction_test: $(OBJ_DIR)/db/db_universal_compaction_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_wal_test: db/db_wal_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_wal_test: $(OBJ_DIR)/db/db_wal_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_io_failure_test: db/db_io_failure_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_io_failure_test: $(OBJ_DIR)/db/db_io_failure_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_properties_test: db/db_properties_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_properties_test: $(OBJ_DIR)/db/db_properties_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_table_properties_test: db/db_table_properties_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_table_properties_test: $(OBJ_DIR)/db/db_table_properties_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -log_write_bench: util/log_write_bench.o $(LIBOBJECTS) $(TESTHARNESS) +log_write_bench: $(OBJ_DIR)/util/log_write_bench.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) $(PROFILING_FLAGS) -plain_table_db_test: db/plain_table_db_test.o $(LIBOBJECTS) $(TESTHARNESS) +plain_table_db_test: $(OBJ_DIR)/db/plain_table_db_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -comparator_db_test: db/comparator_db_test.o $(LIBOBJECTS) $(TESTHARNESS) +comparator_db_test: $(OBJ_DIR)/db/comparator_db_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -table_reader_bench: table/table_reader_bench.o $(LIBOBJECTS) $(TESTHARNESS) +table_reader_bench: $(OBJ_DIR)/table/table_reader_bench.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) $(PROFILING_FLAGS) -perf_context_test: db/perf_context_test.o $(LIBOBJECTS) $(TESTHARNESS) - $(AM_V_CCLD)$(CXX) $^ $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) - -prefix_test: db/prefix_test.o $(LIBOBJECTS) $(TESTHARNESS) - $(AM_V_CCLD)$(CXX) $^ $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) - -backupable_db_test: utilities/backupable/backupable_db_test.o $(LIBOBJECTS) $(TESTHARNESS) +perf_context_test: $(OBJ_DIR)/db/perf_context_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -checkpoint_test: utilities/checkpoint/checkpoint_test.o $(LIBOBJECTS) $(TESTHARNESS) +prefix_test: $(OBJ_DIR)/db/prefix_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cache_simulator_test: utilities/simulator_cache/cache_simulator_test.o $(LIBOBJECTS) $(TESTHARNESS) +backupable_db_test: $(OBJ_DIR)/utilities/backupable/backupable_db_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -sim_cache_test: utilities/simulator_cache/sim_cache_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +checkpoint_test: $(OBJ_DIR)/utilities/checkpoint/checkpoint_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -env_mirror_test: utilities/env_mirror_test.o $(LIBOBJECTS) $(TESTHARNESS) +cache_simulator_test: $(OBJ_DIR)/utilities/simulator_cache/cache_simulator_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -env_timed_test: utilities/env_timed_test.o $(LIBOBJECTS) $(TESTHARNESS) +sim_cache_test: $(OBJ_DIR)/utilities/simulator_cache/sim_cache_test.o $(TEST_LIBRARY) $(LIBRARY) + $(AM_LINK) + +env_mirror_test: $(OBJ_DIR)/utilities/env_mirror_test.o $(TEST_LIBRARY) $(LIBRARY) + $(AM_LINK) + +env_timed_test: $(OBJ_DIR)/utilities/env_timed_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) ifdef ROCKSDB_USE_LIBRADOS -env_librados_test: utilities/env_librados_test.o $(LIBOBJECTS) $(TESTHARNESS) - $(AM_V_CCLD)$(CXX) $^ $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS) +env_librados_test: $(OBJ_DIR)/utilities/env_librados_test.o $(TEST_LIBRARY) $(LIBRARY) + $(AM_LINK) endif -object_registry_test: utilities/object_registry_test.o $(LIBOBJECTS) $(TESTHARNESS) +object_registry_test: $(OBJ_DIR)/utilities/object_registry_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -ttl_test: utilities/ttl/ttl_test.o $(LIBOBJECTS) $(TESTHARNESS) +ttl_test: $(OBJ_DIR)/utilities/ttl/ttl_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -write_batch_with_index_test: utilities/write_batch_with_index/write_batch_with_index_test.o $(LIBOBJECTS) $(TESTHARNESS) +write_batch_with_index_test: $(OBJ_DIR)/utilities/write_batch_with_index/write_batch_with_index_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -flush_job_test: db/flush_job_test.o $(LIBOBJECTS) $(TESTHARNESS) +flush_job_test: $(OBJ_DIR)/db/flush_job_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -compaction_iterator_test: db/compaction/compaction_iterator_test.o $(LIBOBJECTS) $(TESTHARNESS) +compaction_iterator_test: $(OBJ_DIR)/db/compaction/compaction_iterator_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -compaction_job_test: db/compaction/compaction_job_test.o $(LIBOBJECTS) $(TESTHARNESS) +compaction_job_test: $(OBJ_DIR)/db/compaction/compaction_job_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -compaction_job_stats_test: db/compaction/compaction_job_stats_test.o $(LIBOBJECTS) $(TESTHARNESS) +compaction_job_stats_test: $(OBJ_DIR)/db/compaction/compaction_job_stats_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -compact_on_deletion_collector_test: utilities/table_properties_collectors/compact_on_deletion_collector_test.o $(LIBOBJECTS) $(TESTHARNESS) +compact_on_deletion_collector_test: $(OBJ_DIR)/utilities/table_properties_collectors/compact_on_deletion_collector_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -wal_manager_test: db/wal_manager_test.o $(LIBOBJECTS) $(TESTHARNESS) +wal_manager_test: $(OBJ_DIR)/db/wal_manager_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) +dbformat_test: $(OBJ_DIR)/db/dbformat_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -env_basic_test: env/env_basic_test.o $(LIBOBJECTS) $(TESTHARNESS) +env_basic_test: $(OBJ_DIR)/env/env_basic_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -env_test: env/env_test.o $(LIBOBJECTS) $(TESTHARNESS) +env_test: $(OBJ_DIR)/env/env_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -io_posix_test: env/io_posix_test.o $(LIBOBJECTS) $(TESTHARNESS) +io_posix_test: $(OBJ_DIR)/env/io_posix_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -fault_injection_test: db/fault_injection_test.o $(LIBOBJECTS) $(TESTHARNESS) +fault_injection_test: $(OBJ_DIR)/db/fault_injection_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -rate_limiter_test: util/rate_limiter_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +rate_limiter_test: $(OBJ_DIR)/util/rate_limiter_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -delete_scheduler_test: file/delete_scheduler_test.o $(LIBOBJECTS) $(TESTHARNESS) +delete_scheduler_test: $(OBJ_DIR)/file/delete_scheduler_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) +filename_test: $(OBJ_DIR)/db/filename_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -random_access_file_reader_test: file/random_access_file_reader_test.o $(LIBOBJECTS) $(TESTHARNESS) $(TESTUTIL) +random_access_file_reader_test: $(OBJ_DIR)/file/random_access_file_reader_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -file_reader_writer_test: util/file_reader_writer_test.o $(LIBOBJECTS) $(TESTHARNESS) +file_reader_writer_test: $(OBJ_DIR)/util/file_reader_writer_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -block_based_filter_block_test: table/block_based/block_based_filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) +block_based_filter_block_test: $(OBJ_DIR)/table/block_based/block_based_filter_block_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -block_based_table_reader_test: table/block_based/block_based_table_reader_test.o $(LIBOBJECTS) $(TESTHARNESS) +block_based_table_reader_test: table/block_based/block_based_table_reader_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -full_filter_block_test: table/block_based/full_filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) +full_filter_block_test: $(OBJ_DIR)/table/block_based/full_filter_block_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -partitioned_filter_block_test: table/block_based/partitioned_filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) +partitioned_filter_block_test: $(OBJ_DIR)/table/block_based/partitioned_filter_block_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) +log_test: $(OBJ_DIR)/db/log_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cleanable_test: table/cleanable_test.o $(LIBOBJECTS) $(TESTHARNESS) +cleanable_test: $(OBJ_DIR)/table/cleanable_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) +table_test: $(OBJ_DIR)/table/table_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -block_fetcher_test: table/block_fetcher_test.o $(LIBOBJECTS) $(TESTHARNESS) +block_fetcher_test: table/block_fetcher_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -block_test: table/block_based/block_test.o $(LIBOBJECTS) $(TESTHARNESS) +block_test: $(OBJ_DIR)/table/block_based/block_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -data_block_hash_index_test: table/block_based/data_block_hash_index_test.o $(LIBOBJECTS) $(TESTHARNESS) +data_block_hash_index_test: $(OBJ_DIR)/table/block_based/data_block_hash_index_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -inlineskiplist_test: memtable/inlineskiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) +inlineskiplist_test: $(OBJ_DIR)/memtable/inlineskiplist_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -skiplist_test: memtable/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) +skiplist_test: $(OBJ_DIR)/memtable/skiplist_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -write_buffer_manager_test: memtable/write_buffer_manager_test.o $(LIBOBJECTS) $(TESTHARNESS) +write_buffer_manager_test: $(OBJ_DIR)/memtable/write_buffer_manager_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) +version_edit_test: $(OBJ_DIR)/db/version_edit_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -version_set_test: db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) +version_set_test: $(OBJ_DIR)/db/version_set_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -compaction_picker_test: db/compaction/compaction_picker_test.o $(LIBOBJECTS) $(TESTHARNESS) +compaction_picker_test: $(OBJ_DIR)/db/compaction/compaction_picker_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -version_builder_test: db/version_builder_test.o $(LIBOBJECTS) $(TESTHARNESS) +version_builder_test: $(OBJ_DIR)/db/version_builder_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -file_indexer_test: db/file_indexer_test.o $(LIBOBJECTS) $(TESTHARNESS) +file_indexer_test: $(OBJ_DIR)/db/file_indexer_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -reduce_levels_test: tools/reduce_levels_test.o $(LIBOBJECTS) $(TESTHARNESS) +reduce_levels_test: $(OBJ_DIR)/tools/reduce_levels_test.o $(TOOLS_LIBRARY) $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) +write_batch_test: $(OBJ_DIR)/db/write_batch_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -write_controller_test: db/write_controller_test.o $(LIBOBJECTS) $(TESTHARNESS) +write_controller_test: $(OBJ_DIR)/db/write_controller_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -merge_helper_test: db/merge_helper_test.o $(LIBOBJECTS) $(TESTHARNESS) +merge_helper_test: $(OBJ_DIR)/db/merge_helper_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -memory_test: utilities/memory/memory_test.o $(LIBOBJECTS) $(TESTHARNESS) +memory_test: $(OBJ_DIR)/utilities/memory/memory_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -merge_test: db/merge_test.o $(LIBOBJECTS) $(TESTHARNESS) +merge_test: $(OBJ_DIR)/db/merge_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -merger_test: table/merger_test.o $(LIBOBJECTS) $(TESTHARNESS) +merger_test: $(OBJ_DIR)/table/merger_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -util_merge_operators_test: utilities/util_merge_operators_test.o $(LIBOBJECTS) $(TESTHARNESS) +util_merge_operators_test: $(OBJ_DIR)/utilities/util_merge_operators_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -options_file_test: db/options_file_test.o $(LIBOBJECTS) $(TESTHARNESS) +options_file_test: $(OBJ_DIR)/db/options_file_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -deletefile_test: db/deletefile_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +deletefile_test: $(OBJ_DIR)/db/deletefile_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -obsolete_files_test: db/obsolete_files_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +obsolete_files_test: $(OBJ_DIR)/db/obsolete_files_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -rocksdb_dump: tools/dump/rocksdb_dump.o $(LIBOBJECTS) +rocksdb_dump: $(OBJ_DIR)/tools/dump/rocksdb_dump.o $(LIBRARY) $(AM_LINK) -rocksdb_undump: tools/dump/rocksdb_undump.o $(LIBOBJECTS) +rocksdb_undump: $(OBJ_DIR)/tools/dump/rocksdb_undump.o $(LIBRARY) $(AM_LINK) -cuckoo_table_builder_test: table/cuckoo/cuckoo_table_builder_test.o $(LIBOBJECTS) $(TESTHARNESS) +cuckoo_table_builder_test: $(OBJ_DIR)/table/cuckoo/cuckoo_table_builder_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cuckoo_table_reader_test: table/cuckoo/cuckoo_table_reader_test.o $(LIBOBJECTS) $(TESTHARNESS) +cuckoo_table_reader_test: $(OBJ_DIR)/table/cuckoo/cuckoo_table_reader_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cuckoo_table_db_test: db/cuckoo_table_db_test.o $(LIBOBJECTS) $(TESTHARNESS) +cuckoo_table_db_test: $(OBJ_DIR)/db/cuckoo_table_db_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -listener_test: db/listener_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +listener_test: $(OBJ_DIR)/db/listener_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -thread_list_test: util/thread_list_test.o $(LIBOBJECTS) $(TESTHARNESS) +thread_list_test: $(OBJ_DIR)/util/thread_list_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -compact_files_test: db/compact_files_test.o $(LIBOBJECTS) $(TESTHARNESS) +compact_files_test: $(OBJ_DIR)/db/compact_files_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -options_test: options/options_test.o $(LIBOBJECTS) $(TESTHARNESS) +options_test: $(OBJ_DIR)/options/options_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -options_settable_test: options/options_settable_test.o $(LIBOBJECTS) $(TESTHARNESS) +options_settable_test: $(OBJ_DIR)/options/options_settable_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -options_util_test: utilities/options/options_util_test.o $(LIBOBJECTS) $(TESTHARNESS) +options_util_test: $(OBJ_DIR)/utilities/options/options_util_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_bench_tool_test: tools/db_bench_tool_test.o $(BENCHTOOLOBJECTS) $(TESTHARNESS) +db_bench_tool_test: $(OBJ_DIR)/tools/db_bench_tool_test.o $(BENCH_OBJECTS) $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -trace_analyzer_test: tools/trace_analyzer_test.o $(LIBOBJECTS) $(ANALYZETOOLOBJECTS) $(TESTHARNESS) +trace_analyzer_test: $(OBJ_DIR)/tools/trace_analyzer_test.o $(ANALYZE_OBJECTS) $(TOOLS_LIBRARY) $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -event_logger_test: logging/event_logger_test.o $(LIBOBJECTS) $(TESTHARNESS) +event_logger_test: $(OBJ_DIR)/logging/event_logger_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -timer_queue_test: util/timer_queue_test.o $(LIBOBJECTS) $(TESTHARNESS) +timer_queue_test: $(OBJ_DIR)/util/timer_queue_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -sst_dump_test: tools/sst_dump_test.o $(LIBOBJECTS) $(TESTHARNESS) +sst_dump_test: $(OBJ_DIR)/tools/sst_dump_test.o $(TOOLS_LIBRARY) $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -optimistic_transaction_test: utilities/transactions/optimistic_transaction_test.o $(LIBOBJECTS) $(TESTHARNESS) +optimistic_transaction_test: $(OBJ_DIR)/utilities/transactions/optimistic_transaction_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -mock_env_test : env/mock_env_test.o $(LIBOBJECTS) $(TESTHARNESS) +mock_env_test : $(OBJ_DIR)/env/mock_env_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -manual_compaction_test: db/manual_compaction_test.o $(LIBOBJECTS) $(TESTHARNESS) +manual_compaction_test: $(OBJ_DIR)/db/manual_compaction_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -filelock_test: util/filelock_test.o $(LIBOBJECTS) $(TESTHARNESS) +filelock_test: $(OBJ_DIR)/util/filelock_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -auto_roll_logger_test: logging/auto_roll_logger_test.o $(LIBOBJECTS) $(TESTHARNESS) +auto_roll_logger_test: $(OBJ_DIR)/logging/auto_roll_logger_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -env_logger_test: logging/env_logger_test.o $(LIBOBJECTS) $(TESTHARNESS) +env_logger_test: $(OBJ_DIR)/logging/env_logger_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -memtable_list_test: db/memtable_list_test.o $(LIBOBJECTS) $(TESTHARNESS) +memtable_list_test: $(OBJ_DIR)/db/memtable_list_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -write_callback_test: db/write_callback_test.o $(LIBOBJECTS) $(TESTHARNESS) +write_callback_test: $(OBJ_DIR)/db/write_callback_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -heap_test: util/heap_test.o $(GTEST) +heap_test: $(OBJ_DIR)/util/heap_test.o $(GTEST) $(AM_LINK) -transaction_lock_mgr_test: utilities/transactions/transaction_lock_mgr_test.o $(LIBOBJECTS) $(TESTHARNESS) +transaction_lock_mgr_test: utilities/transactions/transaction_lock_mgr_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -transaction_test: utilities/transactions/transaction_test.o $(LIBOBJECTS) $(TESTHARNESS) +transaction_test: $(OBJ_DIR)/utilities/transactions/transaction_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -write_prepared_transaction_test: utilities/transactions/write_prepared_transaction_test.o $(LIBOBJECTS) $(TESTHARNESS) +write_prepared_transaction_test: $(OBJ_DIR)/utilities/transactions/write_prepared_transaction_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -write_unprepared_transaction_test: utilities/transactions/write_unprepared_transaction_test.o $(LIBOBJECTS) $(TESTHARNESS) +write_unprepared_transaction_test: $(OBJ_DIR)/utilities/transactions/write_unprepared_transaction_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -sst_dump: tools/sst_dump.o $(LIBOBJECTS) +sst_dump: $(OBJ_DIR)/tools/sst_dump.o $(TOOLS_LIBRARY) $(LIBRARY) $(AM_LINK) -blob_dump: tools/blob_dump.o $(LIBOBJECTS) +blob_dump: $(OBJ_DIR)/tools/blob_dump.o $(TOOLS_LIBRARY) $(LIBRARY) $(AM_LINK) -repair_test: db/repair_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +repair_test: $(OBJ_DIR)/db/repair_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -ldb_cmd_test: tools/ldb_cmd_test.o $(LIBOBJECTS) $(TESTHARNESS) +ldb_cmd_test: $(OBJ_DIR)/tools/ldb_cmd_test.o $(TOOLS_LIBRARY) $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -ldb: tools/ldb.o $(LIBOBJECTS) +ldb: $(OBJ_DIR)/tools/ldb.o $(TOOLS_LIBRARY) $(LIBRARY) $(AM_LINK) -iostats_context_test: monitoring/iostats_context_test.o $(LIBOBJECTS) $(TESTHARNESS) +iostats_context_test: $(OBJ_DIR)/monitoring/iostats_context_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_V_CCLD)$(CXX) $^ $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) -persistent_cache_test: utilities/persistent_cache/persistent_cache_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +persistent_cache_test: $(OBJ_DIR)/utilities/persistent_cache/persistent_cache_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -statistics_test: monitoring/statistics_test.o $(LIBOBJECTS) $(TESTHARNESS) +statistics_test: $(OBJ_DIR)/monitoring/statistics_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -stats_history_test: monitoring/stats_history_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +stats_history_test: $(OBJ_DIR)/monitoring/stats_history_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -lru_cache_test: cache/lru_cache_test.o $(LIBOBJECTS) $(TESTHARNESS) +lru_cache_test: $(OBJ_DIR)/cache/lru_cache_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -range_del_aggregator_test: db/range_del_aggregator_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +range_del_aggregator_test: $(OBJ_DIR)/db/range_del_aggregator_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -range_del_aggregator_bench: db/range_del_aggregator_bench.o $(LIBOBJECTS) $(TESTUTIL) +range_del_aggregator_bench: $(OBJ_DIR)/db/range_del_aggregator_bench.o $(LIBRARY) $(AM_LINK) -blob_db_test: utilities/blob_db/blob_db_test.o $(LIBOBJECTS) $(TESTHARNESS) +blob_db_test: $(OBJ_DIR)/utilities/blob_db/blob_db_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -repeatable_thread_test: util/repeatable_thread_test.o $(LIBOBJECTS) $(TESTHARNESS) +repeatable_thread_test: $(OBJ_DIR)/util/repeatable_thread_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -range_tombstone_fragmenter_test: db/range_tombstone_fragmenter_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +range_tombstone_fragmenter_test: $(OBJ_DIR)/db/range_tombstone_fragmenter_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -sst_file_reader_test: table/sst_file_reader_test.o $(LIBOBJECTS) $(TESTHARNESS) +sst_file_reader_test: $(OBJ_DIR)/table/sst_file_reader_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_secondary_test: db/db_impl/db_secondary_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +db_secondary_test: $(OBJ_DIR)/db/db_impl/db_secondary_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -block_cache_tracer_test: trace_replay/block_cache_tracer_test.o trace_replay/block_cache_tracer.o $(LIBOBJECTS) $(TESTHARNESS) +block_cache_tracer_test: $(OBJ_DIR)/trace_replay/block_cache_tracer_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -block_cache_trace_analyzer_test: tools/block_cache_analyzer/block_cache_trace_analyzer_test.o tools/block_cache_analyzer/block_cache_trace_analyzer.o $(LIBOBJECTS) $(TESTHARNESS) +block_cache_trace_analyzer_test: $(OBJ_DIR)/tools/block_cache_analyzer/block_cache_trace_analyzer_test.o $(OBJ_DIR)/tools/block_cache_analyzer/block_cache_trace_analyzer.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -defer_test: util/defer_test.o $(LIBOBJECTS) $(TESTHARNESS) +defer_test: $(OBJ_DIR)/util/defer_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -blob_file_addition_test: db/blob/blob_file_addition_test.o $(LIBOBJECTS) $(TESTHARNESS) +blob_file_addition_test: $(OBJ_DIR)/db/blob/blob_file_addition_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -blob_file_garbage_test: db/blob/blob_file_garbage_test.o $(LIBOBJECTS) $(TESTHARNESS) +blob_file_garbage_test: $(OBJ_DIR)/db/blob/blob_file_garbage_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -timer_test: util/timer_test.o $(LIBOBJECTS) $(TESTHARNESS) +timer_test: $(OBJ_DIR)/util/timer_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -testutil_test: test_util/testutil_test.o $(LIBOBJECTS) $(TESTHARNESS) +testutil_test: $(OBJ_DIR)/test_util/testutil_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -io_tracer_test: trace_replay/io_tracer_test.o trace_replay/io_tracer.o $(LIBOBJECTS) $(TESTHARNESS) + +io_tracer_test: $(OBJ_DIR)/trace_replay/io_tracer_test.o $(OBJ_DIR)/trace_replay/io_tracer.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) #------------------------------------------------- @@ -2097,42 +1959,23 @@ endif cd zstd-$(ZSTD_VER)/lib && DESTDIR=. PREFIX= $(MAKE) CFLAGS='-fPIC -O2 ${EXTRA_CFLAGS}' install cp zstd-$(ZSTD_VER)/lib/libzstd.a . -# A version of each $(LIBOBJECTS) compiled with -fPIC and a fixed set of static compression libraries -java_static_libobjects = $(patsubst %,jls/%,$(LIB_CC_OBJECTS)) -CLEAN_FILES += jls -java_static_all_libobjects = $(java_static_libobjects) - +# A version of each $(LIB_OBJECTS) compiled with -fPIC and a fixed set of static compression libraries ifneq ($(ROCKSDB_JAVA_NO_COMPRESSION), 1) JAVA_COMPRESSIONS = libz.a libbz2.a libsnappy.a liblz4.a libzstd.a endif JAVA_STATIC_FLAGS = -DZLIB -DBZIP2 -DSNAPPY -DLZ4 -DZSTD JAVA_STATIC_INCLUDES = -I./zlib-$(ZLIB_VER) -I./bzip2-$(BZIP2_VER) -I./snappy-$(SNAPPY_VER) -I./lz4-$(LZ4_VER)/lib -I./zstd-$(ZSTD_VER)/lib/include - -ifeq ($(HAVE_POWER8),1) -JAVA_STATIC_C_LIBOBJECTS = $(patsubst %.c.o,jls/%.c.o,$(LIB_SOURCES_C:.c=.o)) -JAVA_STATIC_ASM_LIBOBJECTS = $(patsubst %.S.o,jls/%.S.o,$(LIB_SOURCES_ASM:.S=.o)) - -java_static_ppc_libobjects = $(JAVA_STATIC_C_LIBOBJECTS) $(JAVA_STATIC_ASM_LIBOBJECTS) - -jls/util/crc32c_ppc.o: util/crc32c_ppc.c - $(AM_V_CC)$(CC) $(CFLAGS) $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) -c $< -o $@ - -jls/util/crc32c_ppc_asm.o: util/crc32c_ppc_asm.S - $(AM_V_CC)$(CC) $(CFLAGS) $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) -c $< -o $@ - -java_static_all_libobjects += $(java_static_ppc_libobjects) +ifneq ($(findstring rocksdbjavastatic, $(MAKECMDGOALS)),) +CXXFLAGS += $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) +CFLAGS += $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) endif - -$(java_static_libobjects): jls/%.o: %.cc $(JAVA_COMPRESSIONS) - $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) -fPIC -c $< -o $@ $(COVERAGEFLAGS) - -rocksdbjavastatic: $(java_static_all_libobjects) +rocksdbjavastatic: $(LIB_OBJECTS) $(JAVA_COMPRESSIONS) cd java;$(MAKE) javalib; rm -f ./java/target/$(ROCKSDBJNILIB) $(CXX) $(CXXFLAGS) -I./java/. $(JAVA_INCLUDE) -shared -fPIC \ -o ./java/target/$(ROCKSDBJNILIB) $(JNI_NATIVE_SOURCES) \ - $(java_static_all_libobjects) $(COVERAGEFLAGS) \ + $(LIB_OBJECTS) $(COVERAGEFLAGS) \ $(JAVA_COMPRESSIONS) $(JAVA_STATIC_LDFLAGS) cd java/target;if [ "$(DEBUG_LEVEL)" == "0" ]; then \ strip $(STRIPFLAGS) $(ROCKSDBJNILIB); \ @@ -2202,39 +2045,21 @@ rocksdbjavastaticpublishcentral: mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=java/rocksjni.pom -Dfile=java/target/rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH).jar # A version of each $(LIBOBJECTS) compiled with -fPIC -ifeq ($(HAVE_POWER8),1) -JAVA_CC_OBJECTS = $(SHARED_CC_OBJECTS) -JAVA_C_OBJECTS = $(SHARED_C_OBJECTS) -JAVA_ASM_OBJECTS = $(SHARED_ASM_OBJECTS) -JAVA_C_LIBOBJECTS = $(patsubst %.c.o,jl/%.c.o,$(JAVA_C_OBJECTS)) -JAVA_ASM_LIBOBJECTS = $(patsubst %.S.o,jl/%.S.o,$(JAVA_ASM_OBJECTS)) -endif - -java_libobjects = $(patsubst %,jl/%,$(LIB_CC_OBJECTS)) -CLEAN_FILES += jl -java_all_libobjects = $(java_libobjects) - -ifeq ($(HAVE_POWER8),1) -java_ppc_libobjects = $(JAVA_C_LIBOBJECTS) $(JAVA_ASM_LIBOBJECTS) +jl/%.o: %.cc + $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -fPIC -c $< -o $@ $(COVERAGEFLAGS) jl/crc32c_ppc.o: util/crc32c_ppc.c $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ jl/crc32c_ppc_asm.o: util/crc32c_ppc_asm.S $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ -java_all_libobjects += $(java_ppc_libobjects) -endif - -$(java_libobjects): jl/%.o: %.cc - $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -fPIC -c $< -o $@ $(COVERAGEFLAGS) - -rocksdbjava: $(java_all_libobjects) +rocksdbjava: $(LIB_OBJECTS) $(AM_V_GEN)cd java;$(MAKE) javalib; $(AM_V_at)rm -f ./java/target/$(ROCKSDBJNILIB) - $(AM_V_at)$(CXX) $(CXXFLAGS) -I./java/. $(JAVA_INCLUDE) -shared -fPIC -o ./java/target/$(ROCKSDBJNILIB) $(JNI_NATIVE_SOURCES) $(java_all_libobjects) $(JAVA_LDFLAGS) $(COVERAGEFLAGS) + $(AM_V_at)$(CXX) $(CXXFLAGS) -I./java/. $(JAVA_INCLUDE) -shared -fPIC -o ./java/target/$(ROCKSDBJNILIB) $(JNI_NATIVE_SOURCES) $(LIB_OBJECTS) $(JAVA_LDFLAGS) $(COVERAGEFLAGS) $(AM_V_at)cd java;jar -cf target/$(ROCKSDB_JAR) HISTORY*.md $(AM_V_at)cd java/target;jar -uf $(ROCKSDB_JAR) $(ROCKSDBJNILIB) $(AM_V_at)cd java/target/classes;jar -uf ../$(ROCKSDB_JAR) org/rocksdb/*.class org/rocksdb/util/*.class @@ -2289,31 +2114,30 @@ IOSVERSION=$(shell defaults read $(PLATFORMSROOT)/iPhoneOS.platform/version CFBu else ifeq ($(HAVE_POWER8),1) -util/crc32c_ppc.o: util/crc32c_ppc.c +$(OBJ_DIR)/util/crc32c_ppc.o: util/crc32c_ppc.c $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ -util/crc32c_ppc_asm.o: util/crc32c_ppc_asm.S ++$(OBJ_DIR)/util/crc32c_ppc_asm.o: util/crc32c_ppc_asm.S $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ endif -.cc.o: - $(AM_V_CC)$(CXX) $(CXXFLAGS) -c $< -o $@ $(COVERAGEFLAGS) +$(OBJ_DIR)/%.o: %.cc + $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -c $< -o $@ $(COVERAGEFLAGS) -.cpp.o: - $(AM_V_CC)$(CXX) $(CXXFLAGS) -c $< -o $@ $(COVERAGEFLAGS) +$(OBJ_DIR)/%.o: %.cpp + $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -c $< -o $@ $(COVERAGEFLAGS) -.c.o: +$(OBJ_DIR)/%.o: %.c $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ endif + # --------------------------------------------------------------------------- # Source files dependencies detection # --------------------------------------------------------------------------- -# FIXME: nothing checks that entries in MAIN_SOURCES actually exist -all_sources = $(LIB_SOURCES) $(MAIN_SOURCES) $(MOCK_LIB_SOURCES) $(TOOL_LIB_SOURCES) $(BENCH_LIB_SOURCES) $(TEST_LIB_SOURCES) $(ANALYZER_LIB_SOURCES) $(STRESS_LIB_SOURCES) -DEPFILES = $(all_sources:.cc=.cc.d) - +DEPFILES = $(patsubst %.cc, $(OBJ_DIR)/%.cc.d, $(ALL_SOURCES)) +DEPFILES+ = $(patsubst %.c, $(OBJ_DIR)/%.c.d, $(LIB_SOURCES_C) $(TEST_MAIN_SOURCES_C)) ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1) - DEPFILES += $(FOLLY_SOURCES:.cpp=.cpp.d) + DEPFILES +=$(patsubst %.cpp, $(OBJ_DIR)/%.cpp.d, $(FOLLY_SOURCES)) endif # Add proper dependency support so changing a .h file forces a .cc file to @@ -2321,23 +2145,25 @@ endif # The .d file indicates .cc file's dependencies on .h files. We generate such # dependency by g++'s -MM option, whose output is a make dependency rule. -%.cc.d: %.cc - @$(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ - -MM -MT'$@' -MT'$(<:.cc=.o)' "$<" -o '$@' +$(OBJ_DIR)/%.cc.d: %.cc + @mkdir -p $(@D) && $(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ + -MM -MT'$@' -MT'$(<:.cc=.o)' -MT'$(<:%.cc=$(OBJ_DIR)/%.o)' \ + "$<" -o '$@' -%.cpp.d: %.cpp - @$(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ - -MM -MT'$@' -MT'$(<:.cpp=.o)' "$<" -o '$@' +$(OBJ_DIR)/%.cpp.d: %.cpp + @mkdir -p $(@D) && $(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ + -MM -MT'$@' -MT'$(<:.cpp=.o)' -MT'$(<:%.cpp=$(OBJ_DIR)/%.o)' \ + "$<" -o '$@' ifeq ($(HAVE_POWER8),1) -DEPFILES_C = $(LIB_SOURCES_C:.c=.c.d) -DEPFILES_ASM = $(LIB_SOURCES_ASM:.S=.S.d) +DEPFILES_C = $(patsubst %.c, $(OBJ_DIR)/%.c.d, $(LIB_SOURCES_C)) +DEPFILES_ASM = $(patsubst %.S, $(OBJ_DIR)/%.S.d, $(LIB_SOURCES_ASM)) -%.c.d: %.c +$(OBJ_DIR)/%.c.d: %.c @$(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ -MM -MT'$@' -MT'$(<:.c=.o)' "$<" -o '$@' -%.S.d: %.S ++$(OBJ_DIR)/%.S.d: %.S @$(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ -MM -MT'$@' -MT'$(<:.S=.o)' "$<" -o '$@' diff --git a/buckifier/buckify_rocksdb.py b/buckifier/buckify_rocksdb.py index b708173cf..6bda6d409 100644 --- a/buckifier/buckify_rocksdb.py +++ b/buckifier/buckify_rocksdb.py @@ -48,8 +48,8 @@ def parse_src_mk(repo_path): if '=' in line: current_src = line.split('=')[0].strip() src_files[current_src] = [] - elif '.cc' in line: - src_path = line.split('.cc')[0].strip() + '.cc' + elif '.c' in line: + src_path = line.split('\\')[0].strip() src_files[current_src].append(src_path) return src_files @@ -69,27 +69,11 @@ def get_cc_files(repo_path): return cc_files -# Get tests from Makefile -def get_tests(repo_path): +# Get parallel tests from Makefile +def get_parallel_tests(repo_path): Makefile = repo_path + "/Makefile" - # Dictionary TEST_NAME => IS_PARALLEL - tests = {} - - found_tests = False - for line in open(Makefile): - line = line.strip() - if line.startswith("TESTS ="): - found_tests = True - elif found_tests: - if line.endswith("\\"): - # remove the trailing \ - line = line[:-1] - line = line.strip() - tests[line] = False - else: - # we consumed all the tests - break + s = set({}) found_parallel_tests = False for line in open(Makefile): @@ -101,12 +85,12 @@ def get_tests(repo_path): # remove the trailing \ line = line[:-1] line = line.strip() - tests[line] = True + s.add(line) else: # we consumed all the parallel tests break - return tests + return s # Parse extra dependencies passed by user from command line def get_dependencies(): @@ -139,10 +123,10 @@ def generate_targets(repo_path, deps_map): src_mk = parse_src_mk(repo_path) # get all .cc files cc_files = get_cc_files(repo_path) - # get tests from Makefile - tests = get_tests(repo_path) + # get parallel tests from Makefile + parallel_tests = get_parallel_tests(repo_path) - if src_mk is None or cc_files is None or tests is None: + if src_mk is None or cc_files is None or parallel_tests is None: return False TARGETS = TARGETSBuilder("%s/TARGETS" % repo_path) @@ -178,32 +162,35 @@ def generate_targets(repo_path, deps_map): + ["test_util/testutil.cc"]) print("Extra dependencies:\n{0}".format(json.dumps(deps_map))) - # test for every test we found in the Makefile + + # Dictionary test executable name -> relative source file path + test_source_map = {} + print(src_mk) + test_main_sources = src_mk.get("TEST_MAIN_SOURCES", []) + \ + src_mk.get("TEST_MAIN_SOURCES_C", []) + for test_src in test_main_sources: + test = test_src.split('.c')[0].strip().split('/')[-1].strip() + test_source_map[test] = test_src + print("" + test + " " + test_src) + for target_alias, deps in deps_map.items(): - for test in sorted(tests): - match_src = [src for src in cc_files if ("/%s.c" % test) in src] - if len(match_src) == 0: - print(ColorString.warning("Cannot find .cc file for %s" % test)) - continue - elif len(match_src) > 1: - print(ColorString.warning("Found more than one .cc for %s" % test)) - print(match_src) + for test, test_src in sorted(test_source_map.items()): + if len(test) == 0: + print(ColorString.warning("Failed to get test name for %s" % test_src)) continue - assert(len(match_src) == 1) - is_parallel = tests[test] test_target_name = \ test if not target_alias else test + "_" + target_alias TARGETS.register_test( test_target_name, - match_src[0], - is_parallel, + test_src, + test in parallel_tests, json.dumps(deps['extra_deps']), json.dumps(deps['extra_compiler_flags'])) if test in _EXPORTED_TEST_LIBS: test_library = "%s_lib" % test_target_name - TARGETS.add_library(test_library, match_src, [":rocksdb_test_lib"]) + TARGETS.add_library(test_library, [test_src], [":rocksdb_test_lib"]) TARGETS.flush_tests() print(ColorString.info("Generated TARGETS Summary:")) diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index c5b7a2336..b93b029ea 100755 --- a/build_tools/build_detect_platform +++ b/build_tools/build_detect_platform @@ -151,7 +151,7 @@ case "$TARGET_OS" in else PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -latomic" fi - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread -lrt" + PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread -lrt -ldl" if test $ROCKSDB_USE_IO_URING; then # check for liburing $CXX $CFLAGS -x c++ - -luring -o /dev/null 2>/dev/null </dev/null << EOF + if $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF #include + using namespace GFLAGS_NAMESPACE; int main() {} EOF - if [ "$?" = 0 ]; then - COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=1" - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" - else - # check if namespace is google - $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF + then + COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=1" + PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" + # check if namespace is gflags + elif $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF + #include + using namespace gflags; + int main() {} +EOF + then + COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=1 -DGFLAGS_NAMESPACE=gflags" + PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" + # check if namespace is google + elif $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF #include using namespace google; int main() {} EOF - if [ "$?" = 0 ]; then - COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=google" - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" - fi + then + COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=1 -DGFLAGS_NAMESPACE=google" + PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" fi fi @@ -441,7 +449,7 @@ EOF COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_MALLOC_USABLE_SIZE" fi fi - + if ! test $ROCKSDB_DISABLE_MEMKIND; then # Test whether memkind library is installed $CXX $CFLAGS $COMMON_FLAGS -lmemkind -x c++ - -o /dev/null 2>/dev/null </dev/null <GetSnapshot(); std::string fname = sst_files_dir_ + "test_file"; - rocksdb::SstFileWriter writer(EnvOptions(), options); + ROCKSDB_NAMESPACE::SstFileWriter writer(EnvOptions(), options); ASSERT_OK(writer.Open(fname)); std::string key1 = "ab"; std::string key2 = "ab"; @@ -2904,7 +2904,7 @@ TEST_P(ExternalSSTFileTest, ASSERT_OK(Put(key0, value)); std::string fname = sst_files_dir_ + "test_file"; - rocksdb::SstFileWriter writer(EnvOptions(), options); + ROCKSDB_NAMESPACE::SstFileWriter writer(EnvOptions(), options); ASSERT_OK(writer.Open(fname)); // key0 is a dummy to ensure the turnaround point (key1) comes from Prev diff --git a/db_stress_tool/db_stress_tool.cc b/db_stress_tool/db_stress_tool.cc index 5212c19d4..498462e56 100644 --- a/db_stress_tool/db_stress_tool.cc +++ b/db_stress_tool/db_stress_tool.cc @@ -45,10 +45,11 @@ int db_stress_tool(int argc, char** argv) { SanitizeDoubleParam(&FLAGS_memtable_prefix_bloom_size_ratio); SanitizeDoubleParam(&FLAGS_max_bytes_for_level_multiplier); +#ifndef NDEBUG if (FLAGS_mock_direct_io) { test::SetupSyncPointsToMockDirectIO(); } - +#endif if (FLAGS_statistics) { dbstats = ROCKSDB_NAMESPACE::CreateDBStatistics(); if (FLAGS_test_secondary) { diff --git a/src.mk b/src.mk index 3f92d6f89..c4fec346e 100644 --- a/src.mk +++ b/src.mk @@ -15,13 +15,13 @@ LIB_SOURCES = \ db/c.cc \ db/column_family.cc \ db/compacted_db_impl.cc \ - db/compaction/compaction.cc \ + db/compaction/compaction.cc \ db/compaction/compaction_iterator.cc \ db/compaction/compaction_job.cc \ db/compaction/compaction_picker.cc \ db/compaction/compaction_picker_fifo.cc \ db/compaction/compaction_picker_level.cc \ - db/compaction/compaction_picker_universal.cc \ + db/compaction/compaction_picker_universal.cc \ db/convenience.cc \ db/db_filesnapshot.cc \ db/db_impl/db_impl.cc \ @@ -36,7 +36,7 @@ LIB_SOURCES = \ db/db_info_dumper.cc \ db/db_iter.cc \ db/dbformat.cc \ - db/error_handler.cc \ + db/error_handler.cc \ db/event_helpers.cc \ db/experimental.cc \ db/external_sst_file_ingestion_job.cc \ @@ -77,7 +77,7 @@ LIB_SOURCES = \ env/env_hdfs.cc \ env/env_posix.cc \ env/file_system.cc \ - env/fs_posix.cc \ + env/fs_posix.cc \ env/io_posix.cc \ env/mock_env.cc \ file/delete_scheduler.cc \ @@ -150,7 +150,7 @@ LIB_SOURCES = \ table/block_based/partitioned_index_reader.cc \ table/block_based/reader_common.cc \ table/block_based/uncompression_dict_reader.cc \ - table/block_fetcher.cc \ + table/block_fetcher.cc \ table/cuckoo/cuckoo_table_builder.cc \ table/cuckoo/cuckoo_table_factory.cc \ table/cuckoo/cuckoo_table_reader.cc \ @@ -191,7 +191,7 @@ LIB_SOURCES = \ util/random.cc \ util/rate_limiter.cc \ util/slice.cc \ - util/file_checksum_helper.cc \ + util/file_checksum_helper.cc \ util/status.cc \ util/string_util.cc \ util/thread_local.cc \ @@ -216,7 +216,7 @@ LIB_SOURCES = \ utilities/memory/memory_util.cc \ utilities/merge_operators/max.cc \ utilities/merge_operators/put.cc \ - utilities/merge_operators/sortlist.cc \ + utilities/merge_operators/sortlist.cc \ utilities/merge_operators/string_append/stringappend.cc \ utilities/merge_operators/string_append/stringappend2.cc \ utilities/merge_operators/uint64add.cc \ @@ -277,7 +277,7 @@ ANALYZER_LIB_SOURCES = \ MOCK_LIB_SOURCES = \ table/mock_table.cc \ - test_util/fault_injection_test_fs.cc \ + test_util/fault_injection_test_fs.cc \ test_util/fault_injection_test_env.cc BENCH_LIB_SOURCES = \ @@ -307,10 +307,32 @@ FOLLY_SOURCES = \ third-party/folly/folly/synchronization/ParkingLot.cpp \ third-party/folly/folly/synchronization/WaitOptions.cpp \ -MAIN_SOURCES = \ - cache/cache_bench.cc \ - cache/cache_test.cc \ +TOOLS_MAIN_SOURCES = \ db_stress_tool/db_stress.cc \ + tools/blob_dump.cc \ + tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc \ + tools/db_repl_stress.cc \ + tools/db_sanity_test.cc \ + tools/ldb.cc \ + tools/sst_dump.cc \ + tools/write_stress.cc \ + tools/dump/rocksdb_dump.cc \ + tools/dump/rocksdb_undump.cc \ + tools/trace_analyzer.cc \ + +BENCH_MAIN_SOURCES = \ + cache/cache_bench.cc \ + db/range_del_aggregator_bench.cc \ + memtable/memtablerep_bench.cc \ + table/table_reader_bench.cc \ + tools/db_bench.cc \ + util/filter_bench.cc \ + utilities/persistent_cache/persistent_cache_bench.cc \ + #util/log_write_bench.cc \ + +TEST_MAIN_SOURCES = \ + cache/cache_test.cc \ + cache/lru_cache_test.cc \ db/blob/blob_file_addition_test.cc \ db/blob/blob_file_garbage_test.cc \ db/blob/db_blob_index_test.cc \ @@ -324,7 +346,7 @@ MAIN_SOURCES = \ db/corruption_test.cc \ db/cuckoo_table_db_test.cc \ db/db_basic_test.cc \ - db/db_with_timestamp_basic_test.cc \ + db/db_with_timestamp_basic_test.cc \ db/db_block_cache_test.cc \ db/db_bloom_filter_test.cc \ db/db_compaction_filter_test.cc \ @@ -332,6 +354,7 @@ MAIN_SOURCES = \ db/db_dynamic_level_test.cc \ db/db_encryption_test.cc \ db/db_flush_test.cc \ + db/import_column_family_test.cc \ db/db_inplace_update_test.cc \ db/db_io_failure_test.cc \ db/db_iter_test.cc \ @@ -340,7 +363,7 @@ MAIN_SOURCES = \ db/db_log_iter_test.cc \ db/db_memtable_test.cc \ db/db_merge_operator_test.cc \ - db/db_merge_operand_test.cc \ + db/db_merge_operand_test.cc \ db/db_options_test.cc \ db/db_properties_test.cc \ db/db_range_del_test.cc \ @@ -358,8 +381,7 @@ MAIN_SOURCES = \ db/db_write_test.cc \ db/dbformat_test.cc \ db/deletefile_test.cc \ - db/env_timed_test.cc \ - db/error_handler_fs_test.cc \ + db/error_handler_fs_test.cc \ db/external_sst_file_basic_test.cc \ db/external_sst_file_test.cc \ db/fault_injection_test.cc \ @@ -367,29 +389,21 @@ MAIN_SOURCES = \ db/file_reader_writer_test.cc \ db/filename_test.cc \ db/flush_job_test.cc \ - db/hash_table_test.cc \ - db/hash_test.cc \ - db/heap_test.cc \ db/listener_test.cc \ db/log_test.cc \ - db/lru_cache_test.cc \ db/manual_compaction_test.cc \ db/memtable_list_test.cc \ db/merge_helper_test.cc \ db/merge_test.cc \ - db/obsolete_files_test.cc \ - db/options_settable_test.cc \ + db/obsolete_files_test.cc \ db/options_file_test.cc \ db/perf_context_test.cc \ - db/persistent_cache_test.cc \ db/plain_table_db_test.cc \ db/prefix_test.cc \ db/repair_test.cc \ db/range_del_aggregator_test.cc \ - db/range_del_aggregator_bench.cc \ db/range_tombstone_fragmenter_test.cc \ db/table_properties_collector_test.cc \ - db/util_merge_operators_test.cc \ db/version_builder_test.cc \ db/version_edit_test.cc \ db/version_set_test.cc \ @@ -401,6 +415,7 @@ MAIN_SOURCES = \ env/env_test.cc \ env/io_posix_test.cc \ env/mock_env_test.cc \ + file/delete_scheduler_test.cc \ file/random_access_file_reader_test.cc \ logging/auto_roll_logger_test.cc \ logging/env_logger_test.cc \ @@ -408,13 +423,13 @@ MAIN_SOURCES = \ memory/arena_test.cc \ memory/memkind_kmem_allocator_test.cc \ memtable/inlineskiplist_test.cc \ - memtable/memtablerep_bench.cc \ memtable/skiplist_test.cc \ memtable/write_buffer_manager_test.cc \ monitoring/histogram_test.cc \ monitoring/iostats_context_test.cc \ monitoring/statistics_test.cc \ monitoring/stats_history_test.cc \ + options/options_settable_test.cc \ options/options_test.cc \ table/block_based/block_based_filter_block_test.cc \ table/block_based/block_based_table_reader_test.cc \ @@ -427,19 +442,14 @@ MAIN_SOURCES = \ table/cuckoo/cuckoo_table_reader_test.cc \ table/merger_test.cc \ table/sst_file_reader_test.cc \ - table/table_reader_bench.cc \ table/table_test.cc \ table/block_fetcher_test.cc \ - third-party/gtest-1.8.1/fused-src/gtest/gtest-all.cc \ + test_util/testutil_test.cc \ tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc \ - tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc \ - tools/db_bench.cc \ - tools/db_bench_tool_test.cc \ - tools/db_sanity_test.cc \ tools/ldb_cmd_test.cc \ tools/reduce_levels_test.cc \ tools/sst_dump_test.cc \ - tools/trace_analyzer_test.cc \ + tools/trace_analyzer_test.cc \ trace_replay/block_cache_tracer_test.cc \ trace_replay/io_tracer_test.cc \ util/autovector_test.cc \ @@ -449,9 +459,11 @@ MAIN_SOURCES = \ util/defer_test.cc \ util/dynamic_bloom_test.cc \ util/filelock_test.cc \ - util/log_write_bench.cc \ - util/rate_limiter_test.cc \ + util/file_reader_writer_test.cc \ + util/hash_test.cc \ + util/heap_test.cc \ util/random_test.cc \ + util/rate_limiter_test.cc \ util/repeatable_thread_test.cc \ util/slice_test.cc \ util/slice_transform_test.cc \ @@ -467,11 +479,14 @@ MAIN_SOURCES = \ utilities/cassandra/cassandra_row_merge_test.cc \ utilities/cassandra/cassandra_serialize_test.cc \ utilities/checkpoint/checkpoint_test.cc \ + utilities/env_timed_test.cc \ utilities/memory/memory_test.cc \ utilities/merge_operators/string_append/stringappend_test.cc \ utilities/object_registry_test.cc \ utilities/option_change_migration/option_change_migration_test.cc \ utilities/options/options_util_test.cc \ + utilities/persistent_cache/hash_table_test.cc \ + utilities/persistent_cache/persistent_cache_test.cc \ utilities/simulator_cache/cache_simulator_test.cc \ utilities/simulator_cache/sim_cache_test.cc \ utilities/table_properties_collectors/compact_on_deletion_collector_test.cc \ @@ -481,8 +496,13 @@ MAIN_SOURCES = \ utilities/transactions/write_prepared_transaction_test.cc \ utilities/transactions/write_unprepared_transaction_test.cc \ utilities/ttl/ttl_test.cc \ + utilities/util_merge_operators_test.cc \ utilities/write_batch_with_index/write_batch_with_index_test.cc \ +TEST_MAIN_SOURCES_C = \ + db/c_test.c \ + + JNI_NATIVE_SOURCES = \ java/rocksjni/backupenginejni.cc \ java/rocksjni/backupablejni.cc \