From 21e5bf0d934b67591730945170946833fc9e3642 Mon Sep 17 00:00:00 2001 From: mrambacher Date: Mon, 6 Apr 2020 15:24:16 -0400 Subject: [PATCH 01/17] 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. Added OBJ_DIR option to Makefile to allow objects to be placed in an alternative location. This value is currently unused (set to the current directory) but will allow objects to be placed in different directories to simplify the build process when building multiple targets (like LITE, release/debug, shared/static, java, etc). --- Makefile | 785 ++++++++------------ TARGETS | 1102 ++--------------------------- build_tools/build_detect_platform | 2 +- db_stress_tool/db_stress_tool.cc | 3 +- src.mk | 61 +- 5 files changed, 391 insertions(+), 1562 deletions(-) diff --git a/Makefile b/Makefile index dda691c60d1..860b0f64551 100644 --- a/Makefile +++ b/Makefile @@ -152,6 +152,7 @@ CFLAGS += -march=armv8-a+crc+crypto ARMCRC_SOURCE=1 endif + # if we're compiling for release, compile without debug code (-DNDEBUG) ifeq ($(DEBUG_LEVEL),0) OPT += -DNDEBUG @@ -215,7 +216,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) -o $@ $(EXEC_LDFLAGS) -L. $(patsubst lib%.a, -l%, $(patsubst lib%.$(PLATFORM_SHARED_EXT), -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 +231,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 @@ -436,211 +439,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 +TXNTESTUTIL = $(OBJ_DIR)/test_util/transaction_test_util.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) -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 \ +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 PARALLEL_TEST = \ backupable_db_test \ @@ -675,8 +510,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 +570,40 @@ 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 -else - LIBNAME=librocksdb_debug +ifneq ($(DEBUG_LEVEL),0) + LIBDEBUG=_debug endif endif -LIBRARY = ${LIBNAME}.a -TOOLS_LIBRARY = ${LIBNAME}_tools.a -STRESS_LIBRARY = ${LIBNAME}_stress.a +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) + +LIBRARY=$(STATIC_LIBRARY) +TEST_LIBRARY=$(STATIC_TEST_LIBRARY) +TOOLS_LIBRARY=$(STATIC_TOOLS_LIBRARY) +STRESS_LIBRARY=$(STATIC_STRESS_LIBRARY) 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 +617,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 +628,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 +636,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 +663,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,6 +675,8 @@ tools_lib: $(TOOLS_LIBRARY) test_libs: $(TEST_LIBS) +benchmarks: $(BENCHMARKS) + dbg: $(LIBRARY) $(BENCHMARKS) tools $(TESTS) # creates static library and programs @@ -1248,14 +1060,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_test.o db/db_test_util.o $(TESTHARNESS) $(TOOLLIBOBJECTS) unity.a +unity_test: $(OBJ_DIR)/db/db_test.o $(TEST_OBJECTS) $(TOOL_OBJECTS) unity.a $(AM_LINK) ./unity_test @@ -1311,588 +1122,608 @@ 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) - $(AM_V_AR)rm -f $@ +$(STATIC_TEST_LIBRARY): $(TEST_OBJECTS) + $(AM_V_AR)rm -f $@ $(SHARED_TEST_LIBRARY) $(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 $@ +$(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) $@ $^ -librocksdb_env_basic_test.a: env/env_basic_test.o $(LIBOBJECTS) $(TESTHARNESS) +$(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) $@ $^ -db_bench: tools/db_bench.o $(BENCHTOOLOBJECTS) +db_bench: $(OBJ_DIR)/tools/db_bench.o $(BENCH_OBJECTS) $(TXNTESTUTIL) $(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 $(TXNTESTUTIL) $(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) +perf_context_test: $(OBJ_DIR)/db/perf_context_test.o $(TEST_LIBRARY) $(LIBRARY) + $(AM_LINK) -prefix_test: db/prefix_test.o $(LIBOBJECTS) $(TESTHARNESS) - $(AM_V_CCLD)$(CXX) $^ $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) +prefix_test: $(OBJ_DIR)/db/prefix_test.o $(TEST_LIBRARY) $(LIBRARY) + $(AM_LINK) -backupable_db_test: utilities/backupable/backupable_db_test.o $(LIBOBJECTS) $(TESTHARNESS) +backupable_db_test: $(OBJ_DIR)/utilities/backupable/backupable_db_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -checkpoint_test: utilities/checkpoint/checkpoint_test.o $(LIBOBJECTS) $(TESTHARNESS) +checkpoint_test: $(OBJ_DIR)/utilities/checkpoint/checkpoint_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -cache_simulator_test: utilities/simulator_cache/cache_simulator_test.o $(LIBOBJECTS) $(TESTHARNESS) +cache_simulator_test: $(OBJ_DIR)/utilities/simulator_cache/cache_simulator_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -sim_cache_test: utilities/simulator_cache/sim_cache_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) +sim_cache_test: $(OBJ_DIR)/utilities/simulator_cache/sim_cache_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -env_mirror_test: utilities/env_mirror_test.o $(LIBOBJECTS) $(TESTHARNESS) +env_mirror_test: $(OBJ_DIR)/utilities/env_mirror_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -env_timed_test: utilities/env_timed_test.o $(LIBOBJECTS) $(TESTHARNESS) +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: util/timer_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) testutil_test: test_util/testutil_test.o $(LIBOBJECTS) $(TESTHARNESS) @@ -2097,7 +1928,7 @@ 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 +# A version of each $(LIB_OBJECTS) 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) @@ -2289,31 +2120,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 +2151,24 @@ 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 +$(OBJ_DIR)/%.cpp.d: %.cpp @$(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ -MM -MT'$@' -MT'$(<:.cpp=.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/TARGETS b/TARGETS index 132e5ff5337..e4b80cad680 100644 --- a/TARGETS +++ b/TARGETS @@ -288,7 +288,6 @@ cpp_library( "table/two_level_iterator.cc", "test_util/sync_point.cc", "test_util/sync_point_impl.cc", - "test_util/transaction_test_util.cc", "tools/dump/db_dump_tool.cc", "tools/ldb_cmd.cc", "tools/ldb_tool.cc", @@ -388,6 +387,7 @@ cpp_library( "test_util/fault_injection_test_fs.cc", "test_util/testharness.cc", "test_util/testutil.cc", + "test_util/transaction_test_util.cc", "tools/block_cache_analyzer/block_cache_trace_analyzer.cc", "tools/trace_analyzer_tool.cc", "utilities/cassandra/test_utils.cc", @@ -449,41 +449,20 @@ cpp_library( ) cpp_library( - name = "env_basic_test_lib", - srcs = ["env/env_basic_test.cc"], - auto_headers = AutoHeaders.RECURSIVE_GLOB, + name = "rocksdb_third_party_gtest", + srcs = ["third-party/gtest-1.8.1/fused-src/gtest/gtest-all.cc"], + headers = ["third-party/gtest-1.8.1/fused-src/gtest/gtest.h"], arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, compiler_flags = ROCKSDB_COMPILER_FLAGS, os_deps = ROCKSDB_OS_DEPS, os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, - deps = [":rocksdb_test_lib"], + deps = [], external_deps = ROCKSDB_EXTERNAL_DEPS, ) # [test_name, test_src, test_type, extra_deps, extra_compiler_flags] ROCKS_TESTS = [ - [ - "arena_test", - "memory/arena_test.cc", - "serial", - [], - [], - ], - [ - "auto_roll_logger_test", - "logging/auto_roll_logger_test.cc", - "serial", - [], - [], - ], - [ - "autovector_test", - "util/autovector_test.cc", - "serial", - [], - [], - ], [ "backupable_db_test", "utilities/backupable/backupable_db_test.cc", @@ -491,265 +470,6 @@ ROCKS_TESTS = [ [], [], ], - [ - "blob_db_test", - "utilities/blob_db/blob_db_test.cc", - "serial", - [], - [], - ], - [ - "blob_file_addition_test", - "db/blob/blob_file_addition_test.cc", - "serial", - [], - [], - ], - [ - "blob_file_garbage_test", - "db/blob/blob_file_garbage_test.cc", - "serial", - [], - [], - ], - [ - "block_based_filter_block_test", - "table/block_based/block_based_filter_block_test.cc", - "serial", - [], - [], - ], - [ - "block_based_table_reader_test", - "table/block_based/block_based_table_reader_test.cc", - "serial", - [], - [], - ], - [ - "block_cache_trace_analyzer_test", - "tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc", - "serial", - [], - [], - ], - [ - "block_cache_tracer_test", - "trace_replay/block_cache_tracer_test.cc", - "serial", - [], - [], - ], - [ - "block_fetcher_test", - "table/block_fetcher_test.cc", - "serial", - [], - [], - ], - [ - "block_test", - "table/block_based/block_test.cc", - "serial", - [], - [], - ], - [ - "bloom_test", - "util/bloom_test.cc", - "serial", - [], - [], - ], - [ - "c_test", - "db/c_test.c", - "serial", - [], - [], - ], - [ - "cache_simulator_test", - "utilities/simulator_cache/cache_simulator_test.cc", - "serial", - [], - [], - ], - [ - "cache_test", - "cache/cache_test.cc", - "serial", - [], - [], - ], - [ - "cassandra_format_test", - "utilities/cassandra/cassandra_format_test.cc", - "serial", - [], - [], - ], - [ - "cassandra_functional_test", - "utilities/cassandra/cassandra_functional_test.cc", - "serial", - [], - [], - ], - [ - "cassandra_row_merge_test", - "utilities/cassandra/cassandra_row_merge_test.cc", - "serial", - [], - [], - ], - [ - "cassandra_serialize_test", - "utilities/cassandra/cassandra_serialize_test.cc", - "serial", - [], - [], - ], - [ - "checkpoint_test", - "utilities/checkpoint/checkpoint_test.cc", - "serial", - [], - [], - ], - [ - "cleanable_test", - "table/cleanable_test.cc", - "serial", - [], - [], - ], - [ - "coding_test", - "util/coding_test.cc", - "serial", - [], - [], - ], - [ - "column_family_test", - "db/column_family_test.cc", - "serial", - [], - [], - ], - [ - "compact_files_test", - "db/compact_files_test.cc", - "serial", - [], - [], - ], - [ - "compact_on_deletion_collector_test", - "utilities/table_properties_collectors/compact_on_deletion_collector_test.cc", - "serial", - [], - [], - ], - [ - "compaction_iterator_test", - "db/compaction/compaction_iterator_test.cc", - "serial", - [], - [], - ], - [ - "compaction_job_stats_test", - "db/compaction/compaction_job_stats_test.cc", - "serial", - [], - [], - ], - [ - "compaction_job_test", - "db/compaction/compaction_job_test.cc", - "serial", - [], - [], - ], - [ - "compaction_picker_test", - "db/compaction/compaction_picker_test.cc", - "serial", - [], - [], - ], - [ - "comparator_db_test", - "db/comparator_db_test.cc", - "serial", - [], - [], - ], - [ - "corruption_test", - "db/corruption_test.cc", - "serial", - [], - [], - ], - [ - "crc32c_test", - "util/crc32c_test.cc", - "serial", - [], - [], - ], - [ - "cuckoo_table_builder_test", - "table/cuckoo/cuckoo_table_builder_test.cc", - "serial", - [], - [], - ], - [ - "cuckoo_table_db_test", - "db/cuckoo_table_db_test.cc", - "serial", - [], - [], - ], - [ - "cuckoo_table_reader_test", - "table/cuckoo/cuckoo_table_reader_test.cc", - "serial", - [], - [], - ], - [ - "data_block_hash_index_test", - "table/block_based/data_block_hash_index_test.cc", - "serial", - [], - [], - ], - [ - "db_basic_test", - "db/db_basic_test.cc", - "serial", - [], - [], - ], - [ - "db_blob_index_test", - "db/blob/db_blob_index_test.cc", - "serial", - [], - [], - ], - [ - "db_block_cache_test", - "db/db_block_cache_test.cc", - "serial", - [], - [], - ], [ "db_bloom_filter_test", "db/db_bloom_filter_test.cc", @@ -771,90 +491,6 @@ ROCKS_TESTS = [ [], [], ], - [ - "db_dynamic_level_test", - "db/db_dynamic_level_test.cc", - "serial", - [], - [], - ], - [ - "db_encryption_test", - "db/db_encryption_test.cc", - "serial", - [], - [], - ], - [ - "db_flush_test", - "db/db_flush_test.cc", - "serial", - [], - [], - ], - [ - "db_inplace_update_test", - "db/db_inplace_update_test.cc", - "serial", - [], - [], - ], - [ - "db_io_failure_test", - "db/db_io_failure_test.cc", - "serial", - [], - [], - ], - [ - "db_iter_stress_test", - "db/db_iter_stress_test.cc", - "serial", - [], - [], - ], - [ - "db_iter_test", - "db/db_iter_test.cc", - "serial", - [], - [], - ], - [ - "db_iterator_test", - "db/db_iterator_test.cc", - "serial", - [], - [], - ], - [ - "db_log_iter_test", - "db/db_log_iter_test.cc", - "serial", - [], - [], - ], - [ - "db_logical_block_size_cache_test", - "db/db_logical_block_size_cache_test.cc", - "serial", - [], - [], - ], - [ - "db_memtable_test", - "db/db_memtable_test.cc", - "serial", - [], - [], - ], - [ - "db_merge_operand_test", - "db/db_merge_operand_test.cc", - "serial", - [], - [], - ], [ "db_merge_operator_test", "db/db_merge_operator_test.cc", @@ -863,667 +499,93 @@ ROCKS_TESTS = [ [], ], [ - "db_options_test", - "db/db_options_test.cc", - "serial", + "db_sst_test", + "db/db_sst_test.cc", + "parallel", [], [], ], [ - "db_properties_test", - "db/db_properties_test.cc", - "serial", + "db_test", + "db/db_test.cc", + "parallel", [], [], ], [ - "db_range_del_test", - "db/db_range_del_test.cc", - "serial", + "db_universal_compaction_test", + "db/db_universal_compaction_test.cc", + "parallel", [], [], ], [ - "db_secondary_test", - "db/db_impl/db_secondary_test.cc", - "serial", + "db_wal_test", + "db/db_wal_test.cc", + "parallel", [], [], ], [ - "db_sst_test", - "db/db_sst_test.cc", + "external_sst_file_test", + "db/external_sst_file_test.cc", "parallel", [], [], ], [ - "db_statistics_test", - "db/db_statistics_test.cc", - "serial", + "fault_injection_test", + "db/fault_injection_test.cc", + "parallel", [], [], ], [ - "db_table_properties_test", - "db/db_table_properties_test.cc", - "serial", + "file_reader_writer_test", + "util/file_reader_writer_test.cc", + "parallel", [], [], ], [ - "db_tailing_iter_test", - "db/db_tailing_iter_test.cc", - "serial", + "import_column_family_test", + "db/import_column_family_test.cc", + "parallel", [], [], ], [ - "db_test", - "db/db_test.cc", + "inlineskiplist_test", + "memtable/inlineskiplist_test.cc", "parallel", [], [], ], [ - "db_test2", - "db/db_test2.cc", - "serial", + "manual_compaction_test", + "db/manual_compaction_test.cc", + "parallel", [], [], ], [ - "db_universal_compaction_test", - "db/db_universal_compaction_test.cc", + "persistent_cache_test", + "utilities/persistent_cache/persistent_cache_test.cc", "parallel", [], [], ], [ - "db_wal_test", - "db/db_wal_test.cc", + "table_test", + "table/table_test.cc", "parallel", [], [], ], [ - "db_with_timestamp_basic_test", - "db/db_with_timestamp_basic_test.cc", - "serial", - [], - [], - ], - [ - "db_with_timestamp_compaction_test", - "db/db_with_timestamp_compaction_test.cc", - "serial", - [], - [], - ], - [ - "db_write_test", - "db/db_write_test.cc", - "serial", - [], - [], - ], - [ - "dbformat_test", - "db/dbformat_test.cc", - "serial", - [], - [], - ], - [ - "defer_test", - "util/defer_test.cc", - "serial", - [], - [], - ], - [ - "delete_scheduler_test", - "file/delete_scheduler_test.cc", - "serial", - [], - [], - ], - [ - "deletefile_test", - "db/deletefile_test.cc", - "serial", - [], - [], - ], - [ - "dynamic_bloom_test", - "util/dynamic_bloom_test.cc", - "serial", - [], - [], - ], - [ - "env_basic_test", - "env/env_basic_test.cc", - "serial", - [], - [], - ], - [ - "env_logger_test", - "logging/env_logger_test.cc", - "serial", - [], - [], - ], - [ - "env_test", - "env/env_test.cc", - "serial", - [], - [], - ], - [ - "env_timed_test", - "utilities/env_timed_test.cc", - "serial", - [], - [], - ], - [ - "error_handler_fs_test", - "db/error_handler_fs_test.cc", - "serial", - [], - [], - ], - [ - "event_logger_test", - "logging/event_logger_test.cc", - "serial", - [], - [], - ], - [ - "external_sst_file_basic_test", - "db/external_sst_file_basic_test.cc", - "serial", - [], - [], - ], - [ - "external_sst_file_test", - "db/external_sst_file_test.cc", - "parallel", - [], - [], - ], - [ - "fault_injection_test", - "db/fault_injection_test.cc", - "parallel", - [], - [], - ], - [ - "file_indexer_test", - "db/file_indexer_test.cc", - "serial", - [], - [], - ], - [ - "file_reader_writer_test", - "util/file_reader_writer_test.cc", - "parallel", - [], - [], - ], - [ - "filelock_test", - "util/filelock_test.cc", - "serial", - [], - [], - ], - [ - "filename_test", - "db/filename_test.cc", - "serial", - [], - [], - ], - [ - "flush_job_test", - "db/flush_job_test.cc", - "serial", - [], - [], - ], - [ - "full_filter_block_test", - "table/block_based/full_filter_block_test.cc", - "serial", - [], - [], - ], - [ - "hash_table_test", - "utilities/persistent_cache/hash_table_test.cc", - "serial", - [], - [], - ], - [ - "hash_test", - "util/hash_test.cc", - "serial", - [], - [], - ], - [ - "heap_test", - "util/heap_test.cc", - "serial", - [], - [], - ], - [ - "histogram_test", - "monitoring/histogram_test.cc", - "serial", - [], - [], - ], - [ - "import_column_family_test", - "db/import_column_family_test.cc", - "parallel", - [], - [], - ], - [ - "inlineskiplist_test", - "memtable/inlineskiplist_test.cc", - "parallel", - [], - [], - ], - [ - "io_posix_test", - "env/io_posix_test.cc", - "serial", - [], - [], - ], - [ - "io_tracer_test", - "trace_replay/io_tracer_test.cc", - "serial", - [], - [], - ], - [ - "iostats_context_test", - "monitoring/iostats_context_test.cc", - "serial", - [], - [], - ], - [ - "ldb_cmd_test", - "tools/ldb_cmd_test.cc", - "serial", - [], - [], - ], - [ - "listener_test", - "db/listener_test.cc", - "serial", - [], - [], - ], - [ - "log_test", - "db/log_test.cc", - "serial", - [], - [], - ], - [ - "lru_cache_test", - "cache/lru_cache_test.cc", - "serial", - [], - [], - ], - [ - "manual_compaction_test", - "db/manual_compaction_test.cc", - "parallel", - [], - [], - ], - [ - "memkind_kmem_allocator_test", - "memory/memkind_kmem_allocator_test.cc", - "serial", - [], - [], - ], - [ - "memory_test", - "utilities/memory/memory_test.cc", - "serial", - [], - [], - ], - [ - "memtable_list_test", - "db/memtable_list_test.cc", - "serial", - [], - [], - ], - [ - "merge_helper_test", - "db/merge_helper_test.cc", - "serial", - [], - [], - ], - [ - "merge_test", - "db/merge_test.cc", - "serial", - [], - [], - ], - [ - "merger_test", - "table/merger_test.cc", - "serial", - [], - [], - ], - [ - "mock_env_test", - "env/mock_env_test.cc", - "serial", - [], - [], - ], - [ - "object_registry_test", - "utilities/object_registry_test.cc", - "serial", - [], - [], - ], - [ - "obsolete_files_test", - "db/obsolete_files_test.cc", - "serial", - [], - [], - ], - [ - "optimistic_transaction_test", - "utilities/transactions/optimistic_transaction_test.cc", - "serial", - [], - [], - ], - [ - "option_change_migration_test", - "utilities/option_change_migration/option_change_migration_test.cc", - "serial", - [], - [], - ], - [ - "options_file_test", - "db/options_file_test.cc", - "serial", - [], - [], - ], - [ - "options_settable_test", - "options/options_settable_test.cc", - "serial", - [], - [], - ], - [ - "options_test", - "options/options_test.cc", - "serial", - [], - [], - ], - [ - "options_util_test", - "utilities/options/options_util_test.cc", - "serial", - [], - [], - ], - [ - "partitioned_filter_block_test", - "table/block_based/partitioned_filter_block_test.cc", - "serial", - [], - [], - ], - [ - "perf_context_test", - "db/perf_context_test.cc", - "serial", - [], - [], - ], - [ - "persistent_cache_test", - "utilities/persistent_cache/persistent_cache_test.cc", - "parallel", - [], - [], - ], - [ - "plain_table_db_test", - "db/plain_table_db_test.cc", - "serial", - [], - [], - ], - [ - "prefix_test", - "db/prefix_test.cc", - "serial", - [], - [], - ], - [ - "random_access_file_reader_test", - "file/random_access_file_reader_test.cc", - "serial", - [], - [], - ], - [ - "random_test", - "util/random_test.cc", - "serial", - [], - [], - ], - [ - "range_del_aggregator_test", - "db/range_del_aggregator_test.cc", - "serial", - [], - [], - ], - [ - "range_tombstone_fragmenter_test", - "db/range_tombstone_fragmenter_test.cc", - "serial", - [], - [], - ], - [ - "rate_limiter_test", - "util/rate_limiter_test.cc", - "serial", - [], - [], - ], - [ - "reduce_levels_test", - "tools/reduce_levels_test.cc", - "serial", - [], - [], - ], - [ - "repair_test", - "db/repair_test.cc", - "serial", - [], - [], - ], - [ - "repeatable_thread_test", - "util/repeatable_thread_test.cc", - "serial", - [], - [], - ], - [ - "sim_cache_test", - "utilities/simulator_cache/sim_cache_test.cc", - "serial", - [], - [], - ], - [ - "skiplist_test", - "memtable/skiplist_test.cc", - "serial", - [], - [], - ], - [ - "slice_test", - "util/slice_test.cc", - "serial", - [], - [], - ], - [ - "slice_transform_test", - "util/slice_transform_test.cc", - "serial", - [], - [], - ], - [ - "sst_dump_test", - "tools/sst_dump_test.cc", - "serial", - [], - [], - ], - [ - "sst_file_reader_test", - "table/sst_file_reader_test.cc", - "serial", - [], - [], - ], - [ - "statistics_test", - "monitoring/statistics_test.cc", - "serial", - [], - [], - ], - [ - "stats_history_test", - "monitoring/stats_history_test.cc", - "serial", - [], - [], - ], - [ - "stringappend_test", - "utilities/merge_operators/string_append/stringappend_test.cc", - "serial", - [], - [], - ], - [ - "table_properties_collector_test", - "db/table_properties_collector_test.cc", - "serial", - [], - [], - ], - [ - "table_test", - "table/table_test.cc", - "parallel", - [], - [], - ], - [ - "testutil_test", - "test_util/testutil_test.cc", - "serial", - [], - [], - ], - [ - "thread_list_test", - "util/thread_list_test.cc", - "serial", - [], - [], - ], - [ - "thread_local_test", - "util/thread_local_test.cc", - "serial", - [], - [], - ], - [ - "timer_queue_test", - "util/timer_queue_test.cc", - "serial", - [], - [], - ], - [ - "timer_test", - "util/timer_test.cc", - "serial", - [], - [], - ], - [ - "trace_analyzer_test", - "tools/trace_analyzer_test.cc", - "serial", - [], - [], - ], - [ - "transaction_lock_mgr_test", - "utilities/transactions/transaction_lock_mgr_test.cc", - "parallel", + "transaction_lock_mgr_test", + "utilities/transactions/transaction_lock_mgr_test.cc", + "parallel", [], [], ], @@ -1534,90 +596,6 @@ ROCKS_TESTS = [ [], [], ], - [ - "ttl_test", - "utilities/ttl/ttl_test.cc", - "serial", - [], - [], - ], - [ - "util_merge_operators_test", - "utilities/util_merge_operators_test.cc", - "serial", - [], - [], - ], - [ - "version_builder_test", - "db/version_builder_test.cc", - "serial", - [], - [], - ], - [ - "version_edit_test", - "db/version_edit_test.cc", - "serial", - [], - [], - ], - [ - "version_set_test", - "db/version_set_test.cc", - "serial", - [], - [], - ], - [ - "wal_manager_test", - "db/wal_manager_test.cc", - "serial", - [], - [], - ], - [ - "work_queue_test", - "util/work_queue_test.cc", - "serial", - [], - [], - ], - [ - "write_batch_test", - "db/write_batch_test.cc", - "serial", - [], - [], - ], - [ - "write_batch_with_index_test", - "utilities/write_batch_with_index/write_batch_with_index_test.cc", - "serial", - [], - [], - ], - [ - "write_buffer_manager_test", - "memtable/write_buffer_manager_test.cc", - "serial", - [], - [], - ], - [ - "write_callback_test", - "db/write_callback_test.cc", - "serial", - [], - [], - ], - [ - "write_controller_test", - "db/write_controller_test.cc", - "serial", - [], - [], - ], [ "write_prepared_transaction_test", "utilities/transactions/write_prepared_transaction_test.cc", diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index 3610405a898..7132adb9311 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 < Date: Thu, 4 Jun 2020 12:36:41 -0400 Subject: [PATCH 02/17] Enable building of tests etc against shared libraries This change adds a LIB_MODE flag to control how RocksDB binaries, libraries, and tests are built. Using shared libraries reduces the size of the executables substantially. Additionally, shared libraries will make it easier/cleaner to develop and deploy extension libraries to RocksDB. --- Makefile | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 860b0f64551..93480dbfdc4 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,19 +66,23 @@ 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) @@ -152,6 +163,11 @@ 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) @@ -600,10 +616,18 @@ 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 LIBRARY=$(STATIC_LIBRARY) TEST_LIBRARY=$(STATIC_TEST_LIBRARY) TOOLS_LIBRARY=$(STATIC_TOOLS_LIBRARY) STRESS_LIBRARY=$(STATIC_STRESS_LIBRARY) +endif 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) @@ -682,7 +706,7 @@ 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 @@ -1078,7 +1102,9 @@ 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 {} \; From a94cd463eeed07141098b22262d313afc938c1b1 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Thu, 4 Jun 2020 15:45:26 -0700 Subject: [PATCH 03/17] Enable debug binaries can find shared libraries in build location --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 93480dbfdc4..32cc7c51290 100644 --- a/Makefile +++ b/Makefile @@ -287,6 +287,13 @@ ifneq ($(filter -DROCKSDB_LITE,$(OPT)),) LUA_PATH = endif +ifeq ($(LIB_MODE),shared) +ifneq ($(DEBUG_LEVEL),0) +# So that debug binaries can find shared libraries in build location +EXEC_LDFLAGS += -Wl,-rpath="$(PWD)" +endif +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 From b94b715e5909a9a8074533dcf13488f2314d84e9 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Fri, 19 Jun 2020 15:45:25 -0700 Subject: [PATCH 04/17] Fix AM_LINK --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 32cc7c51290..7cbca4f8bf5 100644 --- a/Makefile +++ b/Makefile @@ -232,7 +232,7 @@ LIB_SOURCES += utilities/env_librados.cc LDFLAGS += -lrados endif -AM_LINK = $(AM_V_CCLD)$(CXX) -o $@ $(EXEC_LDFLAGS) -L. $(patsubst lib%.a, -l%, $(patsubst lib%.$(PLATFORM_SHARED_EXT), -l%, $^)) $(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. From 482638ecda8c50462009c74d393a7e39a97d95ee Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Fri, 19 Jun 2020 20:43:07 -0700 Subject: [PATCH 05/17] Fix after merge --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7cbca4f8bf5..05f7e1f790d 100644 --- a/Makefile +++ b/Makefile @@ -1756,12 +1756,13 @@ blob_file_addition_test: $(OBJ_DIR)/db/blob/blob_file_addition_test.o $(TEST_LIB blob_file_garbage_test: $(OBJ_DIR)/db/blob/blob_file_garbage_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -timer_test: util/timer_test.o $(TEST_LIBRARY) $(LIBRARY) +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) #------------------------------------------------- From 75677e7f96ad21710fa944802394e097dfb673b1 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Fri, 19 Jun 2020 20:02:37 -0700 Subject: [PATCH 06/17] gflags namespace detection fix --- build_tools/build_detect_platform | 34 +++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index 7132adb9311..652ce993b91 100755 --- a/build_tools/build_detect_platform +++ b/build_tools/build_detect_platform @@ -296,24 +296,32 @@ EOF # Test whether gflags library is installed # http://gflags.github.io/gflags/ # check if the namespace is gflags - $CXX $CFLAGS -x c++ - -o /dev/null 2>/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 < Date: Sat, 20 Jun 2020 13:57:00 -0700 Subject: [PATCH 07/17] Fix buckifier and some in src.mk --- TARGETS | 1117 ++++++++++++++++++++++++++++++++-- buckifier/buckify_rocksdb.py | 67 +- src.mk | 27 +- 3 files changed, 1117 insertions(+), 94 deletions(-) diff --git a/TARGETS b/TARGETS index e4b80cad680..1fd91cffe43 100644 --- a/TARGETS +++ b/TARGETS @@ -461,8 +461,42 @@ cpp_library( external_deps = ROCKSDB_EXTERNAL_DEPS, ) +cpp_library( + name = "env_basic_test_lib", + srcs = ["env/env_basic_test.cc"], + auto_headers = AutoHeaders.RECURSIVE_GLOB, + arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, + compiler_flags = ROCKSDB_COMPILER_FLAGS, + os_deps = ROCKSDB_OS_DEPS, + os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, + preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, + deps = [":rocksdb_test_lib"], + external_deps = ROCKSDB_EXTERNAL_DEPS, +) + # [test_name, test_src, test_type, extra_deps, extra_compiler_flags] ROCKS_TESTS = [ + [ + "arena_test", + "memory/arena_test.cc", + "serial", + [], + [], + ], + [ + "auto_roll_logger_test", + "logging/auto_roll_logger_test.cc", + "serial", + [], + [], + ], + [ + "autovector_test", + "util/autovector_test.cc", + "serial", + [], + [], + ], [ "backupable_db_test", "utilities/backupable/backupable_db_test.cc", @@ -470,6 +504,265 @@ ROCKS_TESTS = [ [], [], ], + [ + "blob_db_test", + "utilities/blob_db/blob_db_test.cc", + "serial", + [], + [], + ], + [ + "blob_file_addition_test", + "db/blob/blob_file_addition_test.cc", + "serial", + [], + [], + ], + [ + "blob_file_garbage_test", + "db/blob/blob_file_garbage_test.cc", + "serial", + [], + [], + ], + [ + "block_based_filter_block_test", + "table/block_based/block_based_filter_block_test.cc", + "serial", + [], + [], + ], + [ + "block_based_table_reader_test", + "table/block_based/block_based_table_reader_test.cc", + "serial", + [], + [], + ], + [ + "block_cache_trace_analyzer_test", + "tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc", + "serial", + [], + [], + ], + [ + "block_cache_tracer_test", + "trace_replay/block_cache_tracer_test.cc", + "serial", + [], + [], + ], + [ + "block_fetcher_test", + "table/block_fetcher_test.cc", + "serial", + [], + [], + ], + [ + "block_test", + "table/block_based/block_test.cc", + "serial", + [], + [], + ], + [ + "bloom_test", + "util/bloom_test.cc", + "serial", + [], + [], + ], + [ + "c_test", + "db/c_test.c", + "serial", + [], + [], + ], + [ + "cache_simulator_test", + "utilities/simulator_cache/cache_simulator_test.cc", + "serial", + [], + [], + ], + [ + "cache_test", + "cache/cache_test.cc", + "serial", + [], + [], + ], + [ + "cassandra_format_test", + "utilities/cassandra/cassandra_format_test.cc", + "serial", + [], + [], + ], + [ + "cassandra_functional_test", + "utilities/cassandra/cassandra_functional_test.cc", + "serial", + [], + [], + ], + [ + "cassandra_row_merge_test", + "utilities/cassandra/cassandra_row_merge_test.cc", + "serial", + [], + [], + ], + [ + "cassandra_serialize_test", + "utilities/cassandra/cassandra_serialize_test.cc", + "serial", + [], + [], + ], + [ + "checkpoint_test", + "utilities/checkpoint/checkpoint_test.cc", + "serial", + [], + [], + ], + [ + "cleanable_test", + "table/cleanable_test.cc", + "serial", + [], + [], + ], + [ + "coding_test", + "util/coding_test.cc", + "serial", + [], + [], + ], + [ + "column_family_test", + "db/column_family_test.cc", + "serial", + [], + [], + ], + [ + "compact_files_test", + "db/compact_files_test.cc", + "serial", + [], + [], + ], + [ + "compact_on_deletion_collector_test", + "utilities/table_properties_collectors/compact_on_deletion_collector_test.cc", + "serial", + [], + [], + ], + [ + "compaction_iterator_test", + "db/compaction/compaction_iterator_test.cc", + "serial", + [], + [], + ], + [ + "compaction_job_stats_test", + "db/compaction/compaction_job_stats_test.cc", + "serial", + [], + [], + ], + [ + "compaction_job_test", + "db/compaction/compaction_job_test.cc", + "serial", + [], + [], + ], + [ + "compaction_picker_test", + "db/compaction/compaction_picker_test.cc", + "serial", + [], + [], + ], + [ + "comparator_db_test", + "db/comparator_db_test.cc", + "serial", + [], + [], + ], + [ + "corruption_test", + "db/corruption_test.cc", + "serial", + [], + [], + ], + [ + "crc32c_test", + "util/crc32c_test.cc", + "serial", + [], + [], + ], + [ + "cuckoo_table_builder_test", + "table/cuckoo/cuckoo_table_builder_test.cc", + "serial", + [], + [], + ], + [ + "cuckoo_table_db_test", + "db/cuckoo_table_db_test.cc", + "serial", + [], + [], + ], + [ + "cuckoo_table_reader_test", + "table/cuckoo/cuckoo_table_reader_test.cc", + "serial", + [], + [], + ], + [ + "data_block_hash_index_test", + "table/block_based/data_block_hash_index_test.cc", + "serial", + [], + [], + ], + [ + "db_basic_test", + "db/db_basic_test.cc", + "serial", + [], + [], + ], + [ + "db_blob_index_test", + "db/blob/db_blob_index_test.cc", + "serial", + [], + [], + ], + [ + "db_block_cache_test", + "db/db_block_cache_test.cc", + "serial", + [], + [], + ], [ "db_bloom_filter_test", "db/db_bloom_filter_test.cc", @@ -492,110 +785,852 @@ ROCKS_TESTS = [ [], ], [ - "db_merge_operator_test", - "db/db_merge_operator_test.cc", - "parallel", + "db_dynamic_level_test", + "db/db_dynamic_level_test.cc", + "serial", [], [], ], [ - "db_sst_test", - "db/db_sst_test.cc", - "parallel", + "db_encryption_test", + "db/db_encryption_test.cc", + "serial", [], [], ], [ - "db_test", - "db/db_test.cc", - "parallel", + "db_flush_test", + "db/db_flush_test.cc", + "serial", [], [], ], [ - "db_universal_compaction_test", - "db/db_universal_compaction_test.cc", - "parallel", + "db_inplace_update_test", + "db/db_inplace_update_test.cc", + "serial", [], [], ], [ - "db_wal_test", - "db/db_wal_test.cc", - "parallel", + "db_io_failure_test", + "db/db_io_failure_test.cc", + "serial", [], [], ], [ - "external_sst_file_test", - "db/external_sst_file_test.cc", - "parallel", + "db_iter_stress_test", + "db/db_iter_stress_test.cc", + "serial", [], [], ], [ - "fault_injection_test", - "db/fault_injection_test.cc", - "parallel", + "db_iter_test", + "db/db_iter_test.cc", + "serial", [], [], ], [ - "file_reader_writer_test", - "util/file_reader_writer_test.cc", - "parallel", + "db_iterator_test", + "db/db_iterator_test.cc", + "serial", [], [], ], [ - "import_column_family_test", - "db/import_column_family_test.cc", - "parallel", + "db_log_iter_test", + "db/db_log_iter_test.cc", + "serial", [], [], ], [ - "inlineskiplist_test", - "memtable/inlineskiplist_test.cc", - "parallel", + "db_logical_block_size_cache_test", + "db/db_logical_block_size_cache_test.cc", + "serial", [], [], ], [ - "manual_compaction_test", - "db/manual_compaction_test.cc", - "parallel", + "db_memtable_test", + "db/db_memtable_test.cc", + "serial", [], [], ], [ - "persistent_cache_test", - "utilities/persistent_cache/persistent_cache_test.cc", + "db_merge_operand_test", + "db/db_merge_operand_test.cc", + "serial", + [], + [], + ], + [ + "db_merge_operator_test", + "db/db_merge_operator_test.cc", "parallel", [], [], ], [ - "table_test", - "table/table_test.cc", + "db_options_test", + "db/db_options_test.cc", + "serial", + [], + [], + ], + [ + "db_properties_test", + "db/db_properties_test.cc", + "serial", + [], + [], + ], + [ + "db_range_del_test", + "db/db_range_del_test.cc", + "serial", + [], + [], + ], + [ + "db_secondary_test", + "db/db_impl/db_secondary_test.cc", + "serial", + [], + [], + ], + [ + "db_sst_test", + "db/db_sst_test.cc", "parallel", [], [], ], [ - "transaction_lock_mgr_test", - "utilities/transactions/transaction_lock_mgr_test.cc", + "db_statistics_test", + "db/db_statistics_test.cc", + "serial", + [], + [], + ], + [ + "db_table_properties_test", + "db/db_table_properties_test.cc", + "serial", + [], + [], + ], + [ + "db_tailing_iter_test", + "db/db_tailing_iter_test.cc", + "serial", + [], + [], + ], + [ + "db_test", + "db/db_test.cc", "parallel", [], [], ], [ - "transaction_test", - "utilities/transactions/transaction_test.cc", + "db_test2", + "db/db_test2.cc", + "serial", + [], + [], + ], + [ + "db_universal_compaction_test", + "db/db_universal_compaction_test.cc", "parallel", [], [], ], + [ + "db_wal_test", + "db/db_wal_test.cc", + "parallel", + [], + [], + ], + [ + "db_with_timestamp_basic_test", + "db/db_with_timestamp_basic_test.cc", + "serial", + [], + [], + ], + [ + "db_with_timestamp_compaction_test", + "db/db_with_timestamp_compaction_test.cc", + "serial", + [], + [], + ], + [ + "db_write_test", + "db/db_write_test.cc", + "serial", + [], + [], + ], + [ + "dbformat_test", + "db/dbformat_test.cc", + "serial", + [], + [], + ], + [ + "defer_test", + "util/defer_test.cc", + "serial", + [], + [], + ], + [ + "delete_scheduler_test", + "file/delete_scheduler_test.cc", + "serial", + [], + [], + ], + [ + "deletefile_test", + "db/deletefile_test.cc", + "serial", + [], + [], + ], + [ + "dynamic_bloom_test", + "util/dynamic_bloom_test.cc", + "serial", + [], + [], + ], + [ + "env_basic_test", + "env/env_basic_test.cc", + "serial", + [], + [], + ], + [ + "env_logger_test", + "logging/env_logger_test.cc", + "serial", + [], + [], + ], + [ + "env_test", + "env/env_test.cc", + "serial", + [], + [], + ], + [ + "env_timed_test", + "utilities/env_timed_test.cc", + "serial", + [], + [], + ], + [ + "error_handler_fs_test", + "db/error_handler_fs_test.cc", + "serial", + [], + [], + ], + [ + "event_logger_test", + "logging/event_logger_test.cc", + "serial", + [], + [], + ], + [ + "external_sst_file_basic_test", + "db/external_sst_file_basic_test.cc", + "serial", + [], + [], + ], + [ + "external_sst_file_test", + "db/external_sst_file_test.cc", + "parallel", + [], + [], + ], + [ + "fault_injection_test", + "db/fault_injection_test.cc", + "parallel", + [], + [], + ], + [ + "file_indexer_test", + "db/file_indexer_test.cc", + "serial", + [], + [], + ], + [ + "file_reader_writer_test", + "util/file_reader_writer_test.cc", + "parallel", + [], + [], + ], + [ + "filelock_test", + "util/filelock_test.cc", + "serial", + [], + [], + ], + [ + "filename_test", + "db/filename_test.cc", + "serial", + [], + [], + ], + [ + "flush_job_test", + "db/flush_job_test.cc", + "serial", + [], + [], + ], + [ + "full_filter_block_test", + "table/block_based/full_filter_block_test.cc", + "serial", + [], + [], + ], + [ + "hash_table_test", + "utilities/persistent_cache/hash_table_test.cc", + "serial", + [], + [], + ], + [ + "hash_test", + "util/hash_test.cc", + "serial", + [], + [], + ], + [ + "heap_test", + "util/heap_test.cc", + "serial", + [], + [], + ], + [ + "histogram_test", + "monitoring/histogram_test.cc", + "serial", + [], + [], + ], + [ + "import_column_family_test", + "db/import_column_family_test.cc", + "parallel", + [], + [], + ], + [ + "inlineskiplist_test", + "memtable/inlineskiplist_test.cc", + "parallel", + [], + [], + ], + [ + "io_posix_test", + "env/io_posix_test.cc", + "serial", + [], + [], + ], + [ + "io_tracer_test", + "trace_replay/io_tracer_test.cc", + "serial", + [], + [], + ], + [ + "iostats_context_test", + "monitoring/iostats_context_test.cc", + "serial", + [], + [], + ], + [ + "ldb_cmd_test", + "tools/ldb_cmd_test.cc", + "serial", + [], + [], + ], + [ + "listener_test", + "db/listener_test.cc", + "serial", + [], + [], + ], + [ + "log_test", + "db/log_test.cc", + "serial", + [], + [], + ], + [ + "lru_cache_test", + "cache/lru_cache_test.cc", + "serial", + [], + [], + ], + [ + "manual_compaction_test", + "db/manual_compaction_test.cc", + "parallel", + [], + [], + ], + [ + "memkind_kmem_allocator_test", + "memory/memkind_kmem_allocator_test.cc", + "serial", + [], + [], + ], + [ + "memory_test", + "utilities/memory/memory_test.cc", + "serial", + [], + [], + ], + [ + "memtable_list_test", + "db/memtable_list_test.cc", + "serial", + [], + [], + ], + [ + "merge_helper_test", + "db/merge_helper_test.cc", + "serial", + [], + [], + ], + [ + "merge_test", + "db/merge_test.cc", + "serial", + [], + [], + ], + [ + "merger_test", + "table/merger_test.cc", + "serial", + [], + [], + ], + [ + "mock_env_test", + "env/mock_env_test.cc", + "serial", + [], + [], + ], + [ + "object_registry_test", + "utilities/object_registry_test.cc", + "serial", + [], + [], + ], + [ + "obsolete_files_test", + "db/obsolete_files_test.cc", + "serial", + [], + [], + ], + [ + "optimistic_transaction_test", + "utilities/transactions/optimistic_transaction_test.cc", + "serial", + [], + [], + ], + [ + "option_change_migration_test", + "utilities/option_change_migration/option_change_migration_test.cc", + "serial", + [], + [], + ], + [ + "options_file_test", + "db/options_file_test.cc", + "serial", + [], + [], + ], + [ + "options_settable_test", + "options/options_settable_test.cc", + "serial", + [], + [], + ], + [ + "options_test", + "options/options_test.cc", + "serial", + [], + [], + ], + [ + "options_util_test", + "utilities/options/options_util_test.cc", + "serial", + [], + [], + ], + [ + "partitioned_filter_block_test", + "table/block_based/partitioned_filter_block_test.cc", + "serial", + [], + [], + ], + [ + "perf_context_test", + "db/perf_context_test.cc", + "serial", + [], + [], + ], + [ + "persistent_cache_test", + "utilities/persistent_cache/persistent_cache_test.cc", + "parallel", + [], + [], + ], + [ + "plain_table_db_test", + "db/plain_table_db_test.cc", + "serial", + [], + [], + ], + [ + "prefix_test", + "db/prefix_test.cc", + "serial", + [], + [], + ], + [ + "random_access_file_reader_test", + "file/random_access_file_reader_test.cc", + "serial", + [], + [], + ], + [ + "random_test", + "util/random_test.cc", + "serial", + [], + [], + ], + [ + "range_del_aggregator_test", + "db/range_del_aggregator_test.cc", + "serial", + [], + [], + ], + [ + "range_tombstone_fragmenter_test", + "db/range_tombstone_fragmenter_test.cc", + "serial", + [], + [], + ], + [ + "rate_limiter_test", + "util/rate_limiter_test.cc", + "serial", + [], + [], + ], + [ + "reduce_levels_test", + "tools/reduce_levels_test.cc", + "serial", + [], + [], + ], + [ + "repair_test", + "db/repair_test.cc", + "serial", + [], + [], + ], + [ + "repeatable_thread_test", + "util/repeatable_thread_test.cc", + "serial", + [], + [], + ], + [ + "sim_cache_test", + "utilities/simulator_cache/sim_cache_test.cc", + "serial", + [], + [], + ], + [ + "skiplist_test", + "memtable/skiplist_test.cc", + "serial", + [], + [], + ], + [ + "slice_test", + "util/slice_test.cc", + "serial", + [], + [], + ], + [ + "slice_transform_test", + "util/slice_transform_test.cc", + "serial", + [], + [], + ], + [ + "sst_dump_test", + "tools/sst_dump_test.cc", + "serial", + [], + [], + ], + [ + "sst_file_reader_test", + "table/sst_file_reader_test.cc", + "serial", + [], + [], + ], + [ + "statistics_test", + "monitoring/statistics_test.cc", + "serial", + [], + [], + ], + [ + "stats_history_test", + "monitoring/stats_history_test.cc", + "serial", + [], + [], + ], + [ + "stringappend_test", + "utilities/merge_operators/string_append/stringappend_test.cc", + "serial", + [], + [], + ], + [ + "table_properties_collector_test", + "db/table_properties_collector_test.cc", + "serial", + [], + [], + ], + [ + "table_test", + "table/table_test.cc", + "parallel", + [], + [], + ], + [ + "testutil_test", + "test_util/testutil_test.cc", + "serial", + [], + [], + ], + [ + "thread_list_test", + "util/thread_list_test.cc", + "serial", + [], + [], + ], + [ + "thread_local_test", + "util/thread_local_test.cc", + "serial", + [], + [], + ], + [ + "timer_queue_test", + "util/timer_queue_test.cc", + "serial", + [], + [], + ], + [ + "timer_test", + "util/timer_test.cc", + "serial", + [], + [], + ], + [ + "trace_analyzer_test", + "tools/trace_analyzer_test.cc", + "serial", + [], + [], + ], + [ + "transaction_lock_mgr_test", + "utilities/transactions/transaction_lock_mgr_test.cc", + "parallel", + [], + [], + ], + [ + "transaction_test", + "utilities/transactions/transaction_test.cc", + "parallel", + [], + [], + ], + [ + "ttl_test", + "utilities/ttl/ttl_test.cc", + "serial", + [], + [], + ], + [ + "util_merge_operators_test", + "utilities/util_merge_operators_test.cc", + "serial", + [], + [], + ], + [ + "version_builder_test", + "db/version_builder_test.cc", + "serial", + [], + [], + ], + [ + "version_edit_test", + "db/version_edit_test.cc", + "serial", + [], + [], + ], + [ + "version_set_test", + "db/version_set_test.cc", + "serial", + [], + [], + ], + [ + "wal_manager_test", + "db/wal_manager_test.cc", + "serial", + [], + [], + ], + [ + "work_queue_test", + "util/work_queue_test.cc", + "serial", + [], + [], + ], + [ + "write_batch_test", + "db/write_batch_test.cc", + "serial", + [], + [], + ], + [ + "write_batch_with_index_test", + "utilities/write_batch_with_index/write_batch_with_index_test.cc", + "serial", + [], + [], + ], + [ + "write_buffer_manager_test", + "memtable/write_buffer_manager_test.cc", + "serial", + [], + [], + ], + [ + "write_callback_test", + "db/write_callback_test.cc", + "serial", + [], + [], + ], + [ + "write_controller_test", + "db/write_controller_test.cc", + "serial", + [], + [], + ], [ "write_prepared_transaction_test", "utilities/transactions/write_prepared_transaction_test.cc", diff --git a/buckifier/buckify_rocksdb.py b/buckifier/buckify_rocksdb.py index b708173cf40..6bda6d40928 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/src.mk b/src.mk index f4ecb0ae580..31863b45e35 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 \ @@ -189,7 +189,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 \ @@ -214,7 +214,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 \ @@ -275,7 +275,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 = \ @@ -345,7 +345,7 @@ TEST_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 \ @@ -362,7 +362,7 @@ TEST_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 \ @@ -380,7 +380,7 @@ TEST_MAIN_SOURCES = \ db/db_write_test.cc \ db/dbformat_test.cc \ db/deletefile_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 \ @@ -394,7 +394,7 @@ TEST_MAIN_SOURCES = \ db/memtable_list_test.cc \ db/merge_helper_test.cc \ db/merge_test.cc \ - db/obsolete_files_test.cc \ + db/obsolete_files_test.cc \ db/options_file_test.cc \ db/perf_context_test.cc \ db/plain_table_db_test.cc \ @@ -443,11 +443,12 @@ TEST_MAIN_SOURCES = \ table/sst_file_reader_test.cc \ table/table_test.cc \ table/block_fetcher_test.cc \ + test_util/testutil_test.cc \ tools/block_cache_analyzer/block_cache_trace_analyzer_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 \ From a73d90f18f09fbada2ee74d066c5230b2df58308 Mon Sep 17 00:00:00 2001 From: mrambacher Date: Mon, 22 Jun 2020 12:02:45 -0400 Subject: [PATCH 08/17] Fix rocksdbjava and rocksdbjavastatic targets --- Makefile | 43 +++++++++---------------------------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 05f7e1f790d..123e55054bd 100644 --- a/Makefile +++ b/Makefile @@ -1963,9 +1963,8 @@ endif cp zstd-$(ZSTD_VER)/lib/libzstd.a . # A version of each $(LIB_OBJECTS) compiled with -fPIC and a fixed set of static compression libraries -java_static_libobjects = $(patsubst %,jls/%,$(LIB_CC_OBJECTS)) +JAVA_STATIC_LIB_OBJECTS = $(patsubst $(OBJ_DIR)/%, jls/%, $(LIB_OBJECTS)) CLEAN_FILES += jls -java_static_all_libobjects = $(java_static_libobjects) ifneq ($(ROCKSDB_JAVA_NO_COMPRESSION), 1) JAVA_COMPRESSIONS = libz.a libbz2.a libsnappy.a liblz4.a libzstd.a @@ -1974,30 +1973,21 @@ 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) -endif - -$(java_static_libobjects): jls/%.o: %.cc $(JAVA_COMPRESSIONS) +jls/%.o: %.cc $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) -fPIC -c $< -o $@ $(COVERAGEFLAGS) -rocksdbjavastatic: $(java_static_all_libobjects) +rocksdbjavastatic: $(JAVA_STATIC_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) \ + $(JAVA_STATIC_LIB_OBJECTS) $(COVERAGEFLAGS) \ $(JAVA_COMPRESSIONS) $(JAVA_STATIC_LDFLAGS) cd java/target;if [ "$(DEBUG_LEVEL)" == "0" ]; then \ strip $(STRIPFLAGS) $(ROCKSDBJNILIB); \ @@ -2067,39 +2057,24 @@ 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)) +JAVA_LIB_OBJECTS = $(patsubst $(OBJ_DIR)/%, jl/%, $(LIB_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: $(JAVA_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) $(JAVA_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 From 3d545c90389329245ff23906c0bc31ef91495917 Mon Sep 17 00:00:00 2001 From: mrambacher Date: Tue, 23 Jun 2020 15:52:21 -0400 Subject: [PATCH 09/17] Fix up TARGET after merge --- TARGETS | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/TARGETS b/TARGETS index 1fd91cffe43..3098e6bcd89 100644 --- a/TARGETS +++ b/TARGETS @@ -448,19 +448,6 @@ cpp_library( external_deps = ROCKSDB_EXTERNAL_DEPS, ) -cpp_library( - name = "rocksdb_third_party_gtest", - srcs = ["third-party/gtest-1.8.1/fused-src/gtest/gtest-all.cc"], - headers = ["third-party/gtest-1.8.1/fused-src/gtest/gtest.h"], - arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, - compiler_flags = ROCKSDB_COMPILER_FLAGS, - os_deps = ROCKSDB_OS_DEPS, - os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, - preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, - deps = [], - external_deps = ROCKSDB_EXTERNAL_DEPS, -) - cpp_library( name = "env_basic_test_lib", srcs = ["env/env_basic_test.cc"], From 021611fd2004c2cdba69d7c93b097a5a276847d5 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Wed, 24 Jun 2020 09:04:50 -0700 Subject: [PATCH 10/17] Use ROCKSDB_NAMESPACE in a test --- db/external_sst_file_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/external_sst_file_test.cc b/db/external_sst_file_test.cc index f698d501eb6..395d0cd2eca 100644 --- a/db/external_sst_file_test.cc +++ b/db/external_sst_file_test.cc @@ -2852,7 +2852,7 @@ TEST_P(ExternalSSTFileTest, DeltaEncodingWhileGlobalSeqnoPresent) { auto snap = dbfull()->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"; From 5c0cea4355d3e5d5b82b10b5427e1436fa33dc88 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Wed, 24 Jun 2020 09:52:31 -0700 Subject: [PATCH 11/17] Simplify Makefile and fix bug for .cpp files, with .cc wrappers --- Makefile | 11 ++--------- src.mk | 10 +++++----- third-party/folly/folly/detail/Futex.cc | 1 + .../folly/folly/synchronization/AtomicNotification.cc | 1 + .../folly/folly/synchronization/DistributedMutex.cc | 1 + third-party/folly/folly/synchronization/ParkingLot.cc | 1 + .../folly/folly/synchronization/WaitOptions.cc | 1 + .../synchronization/test/DistributedMutexTest.cc | 1 + third-party/folly/generate_cc_files.sh | 9 +++++++++ 9 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 third-party/folly/folly/detail/Futex.cc create mode 100644 third-party/folly/folly/synchronization/AtomicNotification.cc create mode 100644 third-party/folly/folly/synchronization/DistributedMutex.cc create mode 100644 third-party/folly/folly/synchronization/ParkingLot.cc create mode 100644 third-party/folly/folly/synchronization/WaitOptions.cc create mode 100644 third-party/folly/folly/synchronization/test/DistributedMutexTest.cc create mode 100755 third-party/folly/generate_cc_files.sh diff --git a/Makefile b/Makefile index 123e55054bd..123f0b57010 100644 --- a/Makefile +++ b/Makefile @@ -470,7 +470,7 @@ LIB_OBJECTS += $(patsubst %.S, $(OBJ_DIR)/%.o, $(LIB_SOURCES_ASM)) endif ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1) - LIB_OBJECTS += $(patsubst %.cpp, $(OBJ_DIR)/%.o, $(FOLLY_SOURCES)) + LIB_OBJECTS += $(patsubst %.cc, $(OBJ_DIR)/%.o, $(FOLLY_SOURCES)) endif GTEST = $(OBJ_DIR)/$(GTEST_DIR)/gtest/gtest-all.o @@ -2138,9 +2138,6 @@ endif $(OBJ_DIR)/%.o: %.cc $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -c $< -o $@ $(COVERAGEFLAGS) -$(OBJ_DIR)/%.o: %.cpp - $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -c $< -o $@ $(COVERAGEFLAGS) - $(OBJ_DIR)/%.o: %.c $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ endif @@ -2152,7 +2149,7 @@ endif 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 +=$(patsubst %.cpp, $(OBJ_DIR)/%.cpp.d, $(FOLLY_SOURCES)) + DEPFILES +=$(patsubst %.cc, $(OBJ_DIR)/%.cc.d, $(FOLLY_SOURCES)) endif # Add proper dependency support so changing a .h file forces a .cc file to @@ -2165,10 +2162,6 @@ $(OBJ_DIR)/%.cc.d: %.cc -MM -MT'$@' -MT'$(<:.cc=.o)' -MT'$(<:%.cc=$(OBJ_DIR)/%.o)' \ "$<" -o '$@' -$(OBJ_DIR)/%.cpp.d: %.cpp - @$(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ - -MM -MT'$@' -MT'$(<:.cpp=.o)' "$<" -o '$@' - ifeq ($(HAVE_POWER8),1) DEPFILES_C = $(patsubst %.c, $(OBJ_DIR)/%.c.d, $(LIB_SOURCES_C)) DEPFILES_ASM = $(patsubst %.S, $(OBJ_DIR)/%.S.d, $(LIB_SOURCES_ASM)) diff --git a/src.mk b/src.mk index 31863b45e35..574b074b97d 100644 --- a/src.mk +++ b/src.mk @@ -300,11 +300,11 @@ TEST_LIB_SOURCES = \ utilities/cassandra/test_utils.cc \ FOLLY_SOURCES = \ - third-party/folly/folly/detail/Futex.cpp \ - third-party/folly/folly/synchronization/AtomicNotification.cpp \ - third-party/folly/folly/synchronization/DistributedMutex.cpp \ - third-party/folly/folly/synchronization/ParkingLot.cpp \ - third-party/folly/folly/synchronization/WaitOptions.cpp \ + third-party/folly/folly/detail/Futex.cc \ + third-party/folly/folly/synchronization/AtomicNotification.cc \ + third-party/folly/folly/synchronization/DistributedMutex.cc \ + third-party/folly/folly/synchronization/ParkingLot.cc \ + third-party/folly/folly/synchronization/WaitOptions.cc \ TOOLS_MAIN_SOURCES = \ db_stress_tool/db_stress.cc \ diff --git a/third-party/folly/folly/detail/Futex.cc b/third-party/folly/folly/detail/Futex.cc new file mode 100644 index 00000000000..493caf40f1d --- /dev/null +++ b/third-party/folly/folly/detail/Futex.cc @@ -0,0 +1 @@ +#include "Futex.cpp" diff --git a/third-party/folly/folly/synchronization/AtomicNotification.cc b/third-party/folly/folly/synchronization/AtomicNotification.cc new file mode 100644 index 00000000000..61a29437a71 --- /dev/null +++ b/third-party/folly/folly/synchronization/AtomicNotification.cc @@ -0,0 +1 @@ +#include "AtomicNotification.cpp" diff --git a/third-party/folly/folly/synchronization/DistributedMutex.cc b/third-party/folly/folly/synchronization/DistributedMutex.cc new file mode 100644 index 00000000000..00aa0f6e5e5 --- /dev/null +++ b/third-party/folly/folly/synchronization/DistributedMutex.cc @@ -0,0 +1 @@ +#include "DistributedMutex.cpp" diff --git a/third-party/folly/folly/synchronization/ParkingLot.cc b/third-party/folly/folly/synchronization/ParkingLot.cc new file mode 100644 index 00000000000..42382c733fa --- /dev/null +++ b/third-party/folly/folly/synchronization/ParkingLot.cc @@ -0,0 +1 @@ +#include "ParkingLot.cpp" diff --git a/third-party/folly/folly/synchronization/WaitOptions.cc b/third-party/folly/folly/synchronization/WaitOptions.cc new file mode 100644 index 00000000000..18ebe2c096f --- /dev/null +++ b/third-party/folly/folly/synchronization/WaitOptions.cc @@ -0,0 +1 @@ +#include "WaitOptions.cpp" diff --git a/third-party/folly/folly/synchronization/test/DistributedMutexTest.cc b/third-party/folly/folly/synchronization/test/DistributedMutexTest.cc new file mode 100644 index 00000000000..1e8dc098ffa --- /dev/null +++ b/third-party/folly/folly/synchronization/test/DistributedMutexTest.cc @@ -0,0 +1 @@ +#include "DistributedMutexTest.cpp" diff --git a/third-party/folly/generate_cc_files.sh b/third-party/folly/generate_cc_files.sh new file mode 100755 index 00000000000..af1a0a68ea8 --- /dev/null +++ b/third-party/folly/generate_cc_files.sh @@ -0,0 +1,9 @@ +#! /bin/bash + +# Generating these .cc files simplifies some logic in Makefile, because all +# source files are .cc (or .c) + +for CPP_FILE in `find folly -name '*.cpp'` +do + echo "#include \"$(basename $CPP_FILE)\"" > `echo $CPP_FILE | sed s/cpp$/cc/` +done From 7eab4c184be13159c303b44c791d050a6ec8744b Mon Sep 17 00:00:00 2001 From: mrambacher Date: Wed, 24 Jun 2020 14:29:53 -0400 Subject: [PATCH 12/17] Revert "Simplify Makefile and fix bug for .cpp files, with .cc wrappers" This reverts commit 5c0cea4355d3e5d5b82b10b5427e1436fa33dc88. --- Makefile | 11 +++++++++-- src.mk | 10 +++++----- third-party/folly/folly/detail/Futex.cc | 1 - .../folly/folly/synchronization/AtomicNotification.cc | 1 - .../folly/folly/synchronization/DistributedMutex.cc | 1 - third-party/folly/folly/synchronization/ParkingLot.cc | 1 - .../folly/folly/synchronization/WaitOptions.cc | 1 - .../synchronization/test/DistributedMutexTest.cc | 1 - third-party/folly/generate_cc_files.sh | 9 --------- 9 files changed, 14 insertions(+), 22 deletions(-) delete mode 100644 third-party/folly/folly/detail/Futex.cc delete mode 100644 third-party/folly/folly/synchronization/AtomicNotification.cc delete mode 100644 third-party/folly/folly/synchronization/DistributedMutex.cc delete mode 100644 third-party/folly/folly/synchronization/ParkingLot.cc delete mode 100644 third-party/folly/folly/synchronization/WaitOptions.cc delete mode 100644 third-party/folly/folly/synchronization/test/DistributedMutexTest.cc delete mode 100755 third-party/folly/generate_cc_files.sh diff --git a/Makefile b/Makefile index 123f0b57010..123e55054bd 100644 --- a/Makefile +++ b/Makefile @@ -470,7 +470,7 @@ LIB_OBJECTS += $(patsubst %.S, $(OBJ_DIR)/%.o, $(LIB_SOURCES_ASM)) endif ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1) - LIB_OBJECTS += $(patsubst %.cc, $(OBJ_DIR)/%.o, $(FOLLY_SOURCES)) + LIB_OBJECTS += $(patsubst %.cpp, $(OBJ_DIR)/%.o, $(FOLLY_SOURCES)) endif GTEST = $(OBJ_DIR)/$(GTEST_DIR)/gtest/gtest-all.o @@ -2138,6 +2138,9 @@ endif $(OBJ_DIR)/%.o: %.cc $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -c $< -o $@ $(COVERAGEFLAGS) +$(OBJ_DIR)/%.o: %.cpp + $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -c $< -o $@ $(COVERAGEFLAGS) + $(OBJ_DIR)/%.o: %.c $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ endif @@ -2149,7 +2152,7 @@ endif 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 +=$(patsubst %.cc, $(OBJ_DIR)/%.cc.d, $(FOLLY_SOURCES)) + DEPFILES +=$(patsubst %.cpp, $(OBJ_DIR)/%.cpp.d, $(FOLLY_SOURCES)) endif # Add proper dependency support so changing a .h file forces a .cc file to @@ -2162,6 +2165,10 @@ $(OBJ_DIR)/%.cc.d: %.cc -MM -MT'$@' -MT'$(<:.cc=.o)' -MT'$(<:%.cc=$(OBJ_DIR)/%.o)' \ "$<" -o '$@' +$(OBJ_DIR)/%.cpp.d: %.cpp + @$(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ + -MM -MT'$@' -MT'$(<:.cpp=.o)' "$<" -o '$@' + ifeq ($(HAVE_POWER8),1) DEPFILES_C = $(patsubst %.c, $(OBJ_DIR)/%.c.d, $(LIB_SOURCES_C)) DEPFILES_ASM = $(patsubst %.S, $(OBJ_DIR)/%.S.d, $(LIB_SOURCES_ASM)) diff --git a/src.mk b/src.mk index 574b074b97d..31863b45e35 100644 --- a/src.mk +++ b/src.mk @@ -300,11 +300,11 @@ TEST_LIB_SOURCES = \ utilities/cassandra/test_utils.cc \ FOLLY_SOURCES = \ - third-party/folly/folly/detail/Futex.cc \ - third-party/folly/folly/synchronization/AtomicNotification.cc \ - third-party/folly/folly/synchronization/DistributedMutex.cc \ - third-party/folly/folly/synchronization/ParkingLot.cc \ - third-party/folly/folly/synchronization/WaitOptions.cc \ + third-party/folly/folly/detail/Futex.cpp \ + third-party/folly/folly/synchronization/AtomicNotification.cpp \ + third-party/folly/folly/synchronization/DistributedMutex.cpp \ + third-party/folly/folly/synchronization/ParkingLot.cpp \ + third-party/folly/folly/synchronization/WaitOptions.cpp \ TOOLS_MAIN_SOURCES = \ db_stress_tool/db_stress.cc \ diff --git a/third-party/folly/folly/detail/Futex.cc b/third-party/folly/folly/detail/Futex.cc deleted file mode 100644 index 493caf40f1d..00000000000 --- a/third-party/folly/folly/detail/Futex.cc +++ /dev/null @@ -1 +0,0 @@ -#include "Futex.cpp" diff --git a/third-party/folly/folly/synchronization/AtomicNotification.cc b/third-party/folly/folly/synchronization/AtomicNotification.cc deleted file mode 100644 index 61a29437a71..00000000000 --- a/third-party/folly/folly/synchronization/AtomicNotification.cc +++ /dev/null @@ -1 +0,0 @@ -#include "AtomicNotification.cpp" diff --git a/third-party/folly/folly/synchronization/DistributedMutex.cc b/third-party/folly/folly/synchronization/DistributedMutex.cc deleted file mode 100644 index 00aa0f6e5e5..00000000000 --- a/third-party/folly/folly/synchronization/DistributedMutex.cc +++ /dev/null @@ -1 +0,0 @@ -#include "DistributedMutex.cpp" diff --git a/third-party/folly/folly/synchronization/ParkingLot.cc b/third-party/folly/folly/synchronization/ParkingLot.cc deleted file mode 100644 index 42382c733fa..00000000000 --- a/third-party/folly/folly/synchronization/ParkingLot.cc +++ /dev/null @@ -1 +0,0 @@ -#include "ParkingLot.cpp" diff --git a/third-party/folly/folly/synchronization/WaitOptions.cc b/third-party/folly/folly/synchronization/WaitOptions.cc deleted file mode 100644 index 18ebe2c096f..00000000000 --- a/third-party/folly/folly/synchronization/WaitOptions.cc +++ /dev/null @@ -1 +0,0 @@ -#include "WaitOptions.cpp" diff --git a/third-party/folly/folly/synchronization/test/DistributedMutexTest.cc b/third-party/folly/folly/synchronization/test/DistributedMutexTest.cc deleted file mode 100644 index 1e8dc098ffa..00000000000 --- a/third-party/folly/folly/synchronization/test/DistributedMutexTest.cc +++ /dev/null @@ -1 +0,0 @@ -#include "DistributedMutexTest.cpp" diff --git a/third-party/folly/generate_cc_files.sh b/third-party/folly/generate_cc_files.sh deleted file mode 100755 index af1a0a68ea8..00000000000 --- a/third-party/folly/generate_cc_files.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/bash - -# Generating these .cc files simplifies some logic in Makefile, because all -# source files are .cc (or .c) - -for CPP_FILE in `find folly -name '*.cpp'` -do - echo "#include \"$(basename $CPP_FILE)\"" > `echo $CPP_FILE | sed s/cpp$/cc/` -done From da335560a682173fcebb108de5741f0762a15b34 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Wed, 24 Jun 2020 09:04:50 -0700 Subject: [PATCH 13/17] Use ROCKSDB_NAMESPACE in a test (missed a case) --- db/external_sst_file_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/external_sst_file_test.cc b/db/external_sst_file_test.cc index 395d0cd2eca..4a6eefb4ff8 100644 --- a/db/external_sst_file_test.cc +++ b/db/external_sst_file_test.cc @@ -2902,7 +2902,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 From 63c097028f43329a14edc4aefdaacad3de1a800c Mon Sep 17 00:00:00 2001 From: mrambacher Date: Wed, 24 Jun 2020 15:42:02 -0400 Subject: [PATCH 14/17] Update Makefile with better rules for building rocksdbjava/static - If the make command is rocksdbjava/static, set the build/output directory appropriately and update the platform flags --- Makefile | 62 +++++++++++++++++++++++--------------------------------- 1 file changed, 25 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 123e55054bd..fcea960f87a 100644 --- a/Makefile +++ b/Makefile @@ -89,28 +89,27 @@ ifeq ($(MAKECMDGOALS),install) DEBUG_LEVEL=0 endif -ifeq ($(MAKECMDGOALS),rocksdbjavastatic) - ifneq ($(DEBUG_LEVEL),2) - DEBUG_LEVEL=0 - endif -endif -ifeq ($(MAKECMDGOALS),rocksdbjavastaticrelease) - ifneq ($(DEBUG_LEVEL),2) - DEBUG_LEVEL=0 - endif +ifneq ($(findstring jtest, $(MAKECMDGOALS)),) + OBJ_DIR=jl + LIB_MODE=shared endif -ifeq ($(MAKECMDGOALS),rocksdbjavastaticreleasedocker) - 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),rocksdbjavastaticpublish) - DEBUG_LEVEL=0 -endif - $(info $$DEBUG_LEVEL is ${DEBUG_LEVEL}) # Lite build flag. @@ -197,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)) @@ -1117,6 +1116,7 @@ clean-rocks: $(FIND) . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \; clean-rocksjava: + rm -rf jl jls cd java && $(MAKE) clean clean-not-downloaded-rocksjava: @@ -1963,31 +1963,22 @@ endif cp zstd-$(ZSTD_VER)/lib/libzstd.a . # A version of each $(LIB_OBJECTS) compiled with -fPIC and a fixed set of static compression libraries -JAVA_STATIC_LIB_OBJECTS = $(patsubst $(OBJ_DIR)/%, jls/%, $(LIB_OBJECTS)) -CLEAN_FILES += jls - 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 - -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 $@ - -jls/%.o: %.cc - $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) -fPIC -c $< -o $@ $(COVERAGEFLAGS) - -rocksdbjavastatic: $(JAVA_STATIC_LIB_OBJECTS) $(JAVA_COMPRESSIONS) +ifneq ($(findstring rocksdbjavastatic, $(MAKECMDGOALS)),) +CXXFLAGS += $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) +CFLAGS += $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) +endif +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_LIB_OBJECTS) $(COVERAGEFLAGS) \ + $(LIB_OBJECTS) $(COVERAGEFLAGS) \ $(JAVA_COMPRESSIONS) $(JAVA_STATIC_LDFLAGS) cd java/target;if [ "$(DEBUG_LEVEL)" == "0" ]; then \ strip $(STRIPFLAGS) $(ROCKSDBJNILIB); \ @@ -2058,9 +2049,6 @@ rocksdbjavastaticpublishcentral: # A version of each $(LIBOBJECTS) compiled with -fPIC -JAVA_LIB_OBJECTS = $(patsubst $(OBJ_DIR)/%, jl/%, $(LIB_OBJECTS)) -CLEAN_FILES += jl - jl/%.o: %.cc $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -fPIC -c $< -o $@ $(COVERAGEFLAGS) @@ -2071,10 +2059,10 @@ jl/crc32c_ppc_asm.o: util/crc32c_ppc_asm.S $(AM_V_CC)$(CC) $(CFLAGS) -c $< -o $@ -rocksdbjava: $(JAVA_LIB_OBJECTS) +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_LIB_OBJECTS) $(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 From 0314fa8156a6b52b429692904b67d00c49db4732 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Wed, 24 Jun 2020 13:05:59 -0700 Subject: [PATCH 15/17] Fix .cpp vs. .cc handling mismatch (fixes non-fatal "fatal error" output) --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fcea960f87a..69405f16699 100644 --- a/Makefile +++ b/Makefile @@ -2154,8 +2154,9 @@ $(OBJ_DIR)/%.cc.d: %.cc "$<" -o '$@' $(OBJ_DIR)/%.cpp.d: %.cpp - @$(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) \ - -MM -MT'$@' -MT'$(<:.cpp=.o)' "$<" -o '$@' + @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 = $(patsubst %.c, $(OBJ_DIR)/%.c.d, $(LIB_SOURCES_C)) From 91c3fdb4052b61a6a08533fb9f2bbdf37a41e202 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Mon, 29 Jun 2020 20:55:43 -0700 Subject: [PATCH 16/17] Revert special handling of transaction_test_util to fix buck build --- Makefile | 5 ++--- TARGETS | 2 +- src.mk | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 51e91dcd3c4..cfcd2b3cdde 100644 --- a/Makefile +++ b/Makefile @@ -474,7 +474,6 @@ endif GTEST = $(OBJ_DIR)/$(GTEST_DIR)/gtest/gtest-all.o TESTUTIL = $(OBJ_DIR)/test_util/testutil.o -TXNTESTUTIL = $(OBJ_DIR)/test_util/transaction_test_util.o TESTHARNESS = $(OBJ_DIR)/test_util/testharness.o $(TESTUTIL) $(GTEST) VALGRIND_ERROR = 2 VALGRIND_VER := $(join $(VALGRIND_VER),valgrind) @@ -1187,7 +1186,7 @@ librocksdb_env_basic_test.a: $(OBJ_DIR)/env/env_basic_test.o $(LIB_OBJECTS) $(TE $(AM_V_AR)rm -f $@ $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ -db_bench: $(OBJ_DIR)/tools/db_bench.o $(BENCH_OBJECTS) $(TXNTESTUTIL) $(TESTUTIL) $(LIBRARY) +db_bench: $(OBJ_DIR)/tools/db_bench.o $(BENCH_OBJECTS) $(TESTUTIL) $(LIBRARY) $(AM_LINK) trace_analyzer: $(OBJ_DIR)/tools/trace_analyzer.o $(ANALYZE_OBJECTS) $(TOOLS_LIBRARY) $(LIBRARY) @@ -1207,7 +1206,7 @@ cache_bench: $(OBJ_DIR)/cache/cache_bench.o $(LIBRARY) persistent_cache_bench: $(OBJ_DIR)/utilities/persistent_cache/persistent_cache_bench.o $(LIBRARY) $(AM_LINK) -memtablerep_bench: $(OBJ_DIR)/memtable/memtablerep_bench.o $(TXNTESTUTIL) $(TESTUTIL) $(LIBRARY) +memtablerep_bench: $(OBJ_DIR)/memtable/memtablerep_bench.o $(TESTUTIL) $(LIBRARY) $(AM_LINK) filter_bench: $(OBJ_DIR)/util/filter_bench.o $(LIBRARY) diff --git a/TARGETS b/TARGETS index c9ce1d6fb97..df285d497ff 100644 --- a/TARGETS +++ b/TARGETS @@ -289,6 +289,7 @@ cpp_library( "table/two_level_iterator.cc", "test_util/sync_point.cc", "test_util/sync_point_impl.cc", + "test_util/transaction_test_util.cc", "tools/dump/db_dump_tool.cc", "tools/ldb_cmd.cc", "tools/ldb_tool.cc", @@ -388,7 +389,6 @@ cpp_library( "test_util/fault_injection_test_fs.cc", "test_util/testharness.cc", "test_util/testutil.cc", - "test_util/transaction_test_util.cc", "tools/block_cache_analyzer/block_cache_trace_analyzer.cc", "tools/trace_analyzer_tool.cc", "utilities/cassandra/test_utils.cc", diff --git a/src.mk b/src.mk index cfdfea05cb5..c4fec346e42 100644 --- a/src.mk +++ b/src.mk @@ -173,6 +173,7 @@ LIB_SOURCES = \ table/two_level_iterator.cc \ test_util/sync_point.cc \ test_util/sync_point_impl.cc \ + test_util/transaction_test_util.cc \ tools/dump/db_dump_tool.cc \ trace_replay/trace_replay.cc \ trace_replay/block_cache_tracer.cc \ @@ -297,7 +298,6 @@ TEST_LIB_SOURCES = \ db/db_test_util.cc \ test_util/testharness.cc \ test_util/testutil.cc \ - test_util/transaction_test_util.cc \ utilities/cassandra/test_utils.cc \ FOLLY_SOURCES = \ From acb595312928d5a1d4e18e1b5c9ebf81822ac20e Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Mon, 29 Jun 2020 20:56:54 -0700 Subject: [PATCH 17/17] Use rpath=$ORIGIN for LIB_MODE=shared --- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index cfcd2b3cdde..b58b64e2b6b 100644 --- a/Makefile +++ b/Makefile @@ -287,10 +287,8 @@ ifneq ($(filter -DROCKSDB_LITE,$(OPT)),) endif ifeq ($(LIB_MODE),shared) -ifneq ($(DEBUG_LEVEL),0) -# So that debug binaries can find shared libraries in build location -EXEC_LDFLAGS += -Wl,-rpath="$(PWD)" -endif +# 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.