From bd77e341915312594395e486b0ec0bed9d6933a6 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Mon, 6 Jul 2020 11:18:11 -0700 Subject: [PATCH] More Makefile clean-up (#7066) Summary: (a) use STRESS_LIBRARY for db_stress and make sure STRESS_LIBRARY has other stress test dependencies (as in buck build) (b) fix rpath option to be accepted on MacOS. It still doesn't fully work for me e.g. to run a LIB_MODE=shared unit test binary from another directory, as it does on Linux, but the option is now accepted, and running unit tests from current directory works for me. Also adding LIB_MODE=shared to Travis. (Later TBD where best to fit in in CircleCI.) Pull Request resolved: https://github.com/facebook/rocksdb/pull/7066 Test Plan: manual Reviewed By: cheng-chang Differential Revision: D22364068 Pulled By: pdillinger fbshipit-source-id: 6fa98a222f89f808ee786474de1100d92c1adec3 --- .travis.yml | 2 +- Makefile | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 72b56cad5..79bfea717 100644 --- a/.travis.yml +++ b/.travis.yml @@ -278,7 +278,7 @@ script: OPT="-DTRAVIS -DROCKSDB_NAMESPACE=alternative_rocksdb_ns" V=1 make -j4 tools && OPT="-DTRAVIS -DROCKSDB_NAMESPACE=alternative_rocksdb_ns" V=1 ROCKSDBTESTS_START=db_iter_test ROCKSDBTESTS_END=options_file_test make -j4 check_some ;; 3) - OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=options_file_test ROCKSDBTESTS_END=write_prepared_transaction_test make -j4 check_some + OPT=-DTRAVIS LIB_MODE=shared V=1 ROCKSDBTESTS_START=options_file_test ROCKSDBTESTS_END=write_prepared_transaction_test make -j4 check_some ;; 4) OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=write_prepared_transaction_test make -j4 check_some diff --git a/Makefile b/Makefile index a19d2ff96..b93cf1d9b 100644 --- a/Makefile +++ b/Makefile @@ -288,7 +288,7 @@ endif ifeq ($(LIB_MODE),shared) # So that binaries are executable from build location, in addition to install location -EXEC_LDFLAGS += -Wl,-rpath='$$ORIGIN' +EXEC_LDFLAGS += -Wl,-rpath -Wl,'$$ORIGIN' endif # ASAN doesn't work well with jemalloc. If we're compiling with ASAN, we should use regular malloc. @@ -1164,9 +1164,15 @@ $(STATIC_TOOLS_LIBRARY): $(BENCH_OBJECTS) $(TOOL_OBJECTS) $(TESTUTIL) $(AM_V_AR)rm -f $@ $(SHARED_TOOLS_LIBRARY) $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ +ifeq ($(DEBUG_LEVEL),0) $(STATIC_STRESS_LIBRARY): $(TESTUTIL) $(ANALYZE_OBJECTS) $(STRESS_OBJECTS) $(AM_V_AR)rm -f $@ $(SHARED_STRESS_LIBRARY) $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ +else +$(STATIC_STRESS_LIBRARY): $(TEST_OBJECTS) $(ANALYZE_OBJECTS) $(STRESS_OBJECTS) + $(AM_V_AR)rm -f $@ $(SHARED_STRESS_LIBRARY) + $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ +endif $(SHARED_TEST_LIBRARY): $(TEST_OBJECTS) $(SHARED1) $(AM_V_AR)rm -f $@ $(STATIC_TEST_LIBRARY) @@ -1176,9 +1182,15 @@ $(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) +ifeq ($(DEBUG_LEVEL),0) +$(SHARED_STRESS_LIBRARY): $(ANALYZE_OBJECTS) $(STRESS_OBJECTS) $(SHARED_TOOLS_LIBRARY) $(SHARED1) $(AM_V_AR)rm -f $@ $(STATIC_STRESS_LIBRARY) $(AM_SHARE) +else +$(SHARED_STRESS_LIBRARY): $(ANALYZE_OBJECTS) $(STRESS_OBJECTS) $(SHARED_TOOLS_LIBRARY) $(TEST_LIBRARY) $(SHARED1) + $(AM_V_AR)rm -f $@ $(STATIC_STRESS_LIBRARY) + $(AM_SHARE) +endif librocksdb_env_basic_test.a: $(OBJ_DIR)/env/env_basic_test.o $(LIB_OBJECTS) $(TESTHARNESS) $(AM_V_AR)rm -f $@ @@ -1210,13 +1222,9 @@ memtablerep_bench: $(OBJ_DIR)/memtable/memtablerep_bench.o $(TESTUTIL) $(LIBRARY filter_bench: $(OBJ_DIR)/util/filter_bench.o $(LIBRARY) $(AM_LINK) -ifeq ($(DEBUG_LEVEL),0) -db_stress: $(OBJ_DIR)/db_stress_tool/db_stress.o $(STRESS_OBJECTS) $(TESTUTIL) $(LIBRARY) +db_stress: $(OBJ_DIR)/db_stress_tool/db_stress.o $(STRESS_LIBRARY) $(LIBRARY) $(AM_LINK) -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)