From e6f68faf993074c8667aacfe2f250559501e6eee Mon Sep 17 00:00:00 2001 From: omegaga Date: Mon, 11 Jul 2016 13:55:46 -0700 Subject: [PATCH] Update Makefile to fix dependency Summary: In D33849 we updated Makefile to generate .d files for all .cc sources. Since we have more types of source files now, this needs to be updated so that this mechanism can work for new files. Test Plan: change a dependent .h file, re-make and see if .o file is recompiled. Reviewers: sdong, andrewkr Reviewed By: andrewkr Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D60591 --- Makefile | 12 ++++++------ src.mk | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 9fd74a4eb..2467fd06f 100644 --- a/Makefile +++ b/Makefile @@ -251,8 +251,8 @@ util/build_version.cc: FORCE else mv -f $@-t $@; fi LIBOBJECTS = $(LIB_SOURCES:.cc=.o) -LIBOBJECTS += $(TOOL_SOURCES:.cc=.o) -MOCKOBJECTS = $(MOCK_SOURCES:.cc=.o) +LIBOBJECTS += $(TOOL_LIB_SOURCES:.cc=.o) +MOCKOBJECTS = $(MOCK_LIB_SOURCES:.cc=.o) GTEST = $(GTEST_DIR)/gtest/gtest-all.o TESTUTIL = ./util/testutil.o @@ -262,7 +262,7 @@ VALGRIND_VER := $(join $(VALGRIND_VER),valgrind) VALGRIND_OPTS = --error-exitcode=$(VALGRIND_ERROR) --leak-check=full -BENCHTOOLOBJECTS = $(BENCH_SOURCES:.cc=.o) $(LIBOBJECTS) $(TESTUTIL) +BENCHTOOLOBJECTS = $(BENCH_LIB_SOURCES:.cc=.o) $(LIBOBJECTS) $(TESTUTIL) TESTS = \ db_test \ @@ -464,7 +464,7 @@ $(SHARED3): $(SHARED4) endif $(SHARED4): - $(CXX) $(PLATFORM_SHARED_LDFLAGS)$(SHARED3) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(LIB_SOURCES) $(TOOL_SOURCES) \ + $(CXX) $(PLATFORM_SHARED_LDFLAGS)$(SHARED3) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(LIB_SOURCES) $(TOOL_LIB_SOURCES) \ $(LDFLAGS) -o $@ endif # PLATFORM_SHARED_EXT @@ -816,7 +816,7 @@ $(LIBRARY): $(LIBOBJECTS) $(AM_V_AR)rm -f $@ $(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIBOBJECTS) -$(TOOLS_LIBRARY): $(BENCH_SOURCES:.cc=.o) $(TOOL_SOURCES:.cc=.o) $(LIB_SOURCES:.cc=.o) $(TESTUTIL) +$(TOOLS_LIBRARY): $(BENCH_LIB_SOURCES:.cc=.o) $(TOOL_LIB_SOURCES:.cc=.o) $(LIB_SOURCES:.cc=.o) $(TESTUTIL) $(AM_V_AR)rm -f $@ $(AM_V_at)$(AR) $(ARFLAGS) $@ $^ @@ -1406,7 +1406,7 @@ endif # Source files dependencies detection # --------------------------------------------------------------------------- -all_sources = $(LIB_SOURCES) $(TEST_BENCH_SOURCES) $(MOCK_SOURCES) +all_sources = $(LIB_SOURCES) $(MAIN_SOURCES) $(MOCK_LIB_SOURCES) $(TOOL_LIB_SOURCES) $(BENCH_LIB_SOURCES) $(TEST_LIB_SOURCES) DEPFILES = $(all_sources:.cc=.d) # Add proper dependency support so changing a .h file forces a .cc file to diff --git a/src.mk b/src.mk index 67933d177..3488da0a6 100644 --- a/src.mk +++ b/src.mk @@ -177,20 +177,25 @@ LIB_SOURCES = \ util/xfunc.cc \ util/xxhash.cc \ -TOOL_SOURCES = \ +TOOL_LIB_SOURCES = \ tools/ldb_cmd.cc \ tools/ldb_tool.cc \ tools/sst_dump_tool.cc \ -MOCK_SOURCES = \ +MOCK_LIB_SOURCES = \ table/mock_table.cc \ util/mock_env.cc \ util/fault_injection_test_env.cc -BENCH_SOURCES = \ +BENCH_LIB_SOURCES = \ tools/db_bench_tool.cc -TEST_BENCH_SOURCES = \ +TEST_LIB_SOURCES = \ + util/testharness.cc \ + util/testutil.cc \ + db/db_test_util.cc + +MAIN_SOURCES = \ third-party/gtest-1.7.0/fused-src/gtest/gtest-all.cc \ db/auto_roll_logger_test.cc \ db/column_family_test.cc \ @@ -200,7 +205,6 @@ TEST_BENCH_SOURCES = \ db/comparator_db_test.cc \ db/corruption_test.cc \ db/cuckoo_table_db_test.cc \ - tools/db_bench_tool.cc \ db/dbformat_test.cc \ db/db_iter_test.cc \ db/db_test.cc \ @@ -235,7 +239,6 @@ TEST_BENCH_SOURCES = \ db/prefix_test.cc \ db/skiplist_test.cc \ db/table_properties_collector_test.cc \ - db/db_test_util.cc \ db/version_builder_test.cc \ db/version_edit_test.cc \ db/version_set_test.cc \ @@ -251,6 +254,7 @@ TEST_BENCH_SOURCES = \ table/merger_test.cc \ table/table_reader_bench.cc \ table/table_test.cc \ + tools/db_bench.cc \ tools/db_bench_tool_test.cc \ tools/db_sanity_test.cc \ tools/ldb_cmd_test.cc \ @@ -292,8 +296,6 @@ TEST_BENCH_SOURCES = \ util/event_logger_test.cc \ util/rate_limiter_test.cc \ util/slice_transform_test.cc \ - util/testharness.cc \ - util/testutil.cc \ util/thread_list_test.cc \ util/thread_local_test.cc