Revert Makefile

Summary: Revert Makefile

Test Plan: make clean

Reviewers: sdong, anthony

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D42711
This commit is contained in:
Yueh-Hsuan Chiang 2015-07-20 16:40:41 -07:00
parent 6867fb19c7
commit 9f1de95187

368
Makefile
View File

@ -15,10 +15,10 @@ ARFLAGS = rs
# Transform parallel LOG output into something more readable. # Transform parallel LOG output into something more readable.
perl_command = perl -n \ perl_command = perl -n \
-e '@a=split("\t",$$_,-1); $$t=$$a[8]; $$t =~ s,^\./,,;' \ -e '@a=split("\t",$$_,-1); $$t=$$a[8]; $$t =~ s,^\./,,;' \
-e '$$t =~ s, >.*,,; chomp $$t;' \ -e '$$t =~ s, >.*,,; chomp $$t;' \
-e '$$t =~ /.*--gtest_filter=(.*?\.[\w\/]+)/ and $$t=$$1;' \ -e '$$t =~ /.*--gtest_filter=(.*?\.[\w\/]+)/ and $$t=$$1;' \
-e 'printf "%7.3f %s %s\n", $$a[3], $$a[6] == 0 ? "PASS" : "FAIL", $$t' -e 'printf "%7.3f %s %s\n", $$a[3], $$a[6] == 0 ? "PASS" : "FAIL", $$t'
quoted_perl_command = $(subst ','\'',$(perl_command)) quoted_perl_command = $(subst ','\'',$(perl_command))
# DEBUG_LEVEL can have three values: # DEBUG_LEVEL can have three values:
@ -36,31 +36,31 @@ quoted_perl_command = $(subst ','\'',$(perl_command))
DEBUG_LEVEL=1 DEBUG_LEVEL=1
ifeq ($(MAKECMDGOALS),dbg) ifeq ($(MAKECMDGOALS),dbg)
DEBUG_LEVEL=2 DEBUG_LEVEL=2
endif endif
ifeq ($(MAKECMDGOALS),shared_lib) ifeq ($(MAKECMDGOALS),shared_lib)
DEBUG_LEVEL=0 DEBUG_LEVEL=0
endif endif
ifeq ($(MAKECMDGOALS),install-shared) ifeq ($(MAKECMDGOALS),install-shared)
DEBUG_LEVEL=0 DEBUG_LEVEL=0
endif endif
ifeq ($(MAKECMDGOALS),static_lib) ifeq ($(MAKECMDGOALS),static_lib)
DEBUG_LEVEL=0 DEBUG_LEVEL=0
endif endif
ifeq ($(MAKECMDGOALS),install-static) ifeq ($(MAKECMDGOALS),install-static)
DEBUG_LEVEL=0 DEBUG_LEVEL=0
endif endif
ifeq ($(MAKECMDGOALS),install) ifeq ($(MAKECMDGOALS),install)
DEBUG_LEVEL=0 DEBUG_LEVEL=0
endif endif
ifeq ($(MAKECMDGOALS),rocksdbjavastatic) ifeq ($(MAKECMDGOALS),rocksdbjavastatic)
DEBUG_LEVEL=0 DEBUG_LEVEL=0
endif endif
# compile with -O2 if debug level is not 2 # compile with -O2 if debug level is not 2
@ -124,36 +124,36 @@ OPT += -DNDEBUG
endif endif
ifneq ($(filter -DROCKSDB_LITE,$(OPT)),) ifneq ($(filter -DROCKSDB_LITE,$(OPT)),)
# found # found
CFLAGS += -fno-exceptions CFLAGS += -fno-exceptions
CXXFLAGS += -fno-exceptions CXXFLAGS += -fno-exceptions
endif endif
# ASAN doesn't work well with jemalloc. If we're compiling with ASAN, we should use regular malloc. # ASAN doesn't work well with jemalloc. If we're compiling with ASAN, we should use regular malloc.
ifdef COMPILE_WITH_ASAN ifdef COMPILE_WITH_ASAN
DISABLE_JEMALLOC=1 DISABLE_JEMALLOC=1
EXEC_LDFLAGS += -fsanitize=address EXEC_LDFLAGS += -fsanitize=address
PLATFORM_CCFLAGS += -fsanitize=address PLATFORM_CCFLAGS += -fsanitize=address
PLATFORM_CXXFLAGS += -fsanitize=address PLATFORM_CXXFLAGS += -fsanitize=address
endif endif
# TSAN doesn't work well with jemalloc. If we're compiling with TSAN, we should use regular malloc. # TSAN doesn't work well with jemalloc. If we're compiling with TSAN, we should use regular malloc.
ifdef COMPILE_WITH_TSAN ifdef COMPILE_WITH_TSAN
DISABLE_JEMALLOC=1 DISABLE_JEMALLOC=1
EXEC_LDFLAGS += -fsanitize=thread -pie EXEC_LDFLAGS += -fsanitize=thread -pie
PLATFORM_CCFLAGS += -fsanitize=thread -fPIC -DROCKSDB_TSAN_RUN PLATFORM_CCFLAGS += -fsanitize=thread -fPIC -DROCKSDB_TSAN_RUN
PLATFORM_CXXFLAGS += -fsanitize=thread -fPIC -DROCKSDB_TSAN_RUN PLATFORM_CXXFLAGS += -fsanitize=thread -fPIC -DROCKSDB_TSAN_RUN
# Turn off -pg when enabling TSAN testing, because that induces # Turn off -pg when enabling TSAN testing, because that induces
# a link failure. TODO: find the root cause # a link failure. TODO: find the root cause
pg = pg =
else else
pg = -pg pg = -pg
endif endif
ifndef DISABLE_JEMALLOC ifndef DISABLE_JEMALLOC
EXEC_LDFLAGS := $(JEMALLOC_LIB) $(EXEC_LDFLAGS) EXEC_LDFLAGS := $(JEMALLOC_LIB) $(EXEC_LDFLAGS)
PLATFORM_CXXFLAGS += $(JEMALLOC_INCLUDE) PLATFORM_CXXFLAGS += $(JEMALLOC_INCLUDE)
PLATFORM_CCFLAGS += $(JEMALLOC_INCLUDE) PLATFORM_CCFLAGS += $(JEMALLOC_INCLUDE)
endif endif
export GTEST_THROW_ON_FAILURE=1 GTEST_HAS_EXCEPTIONS=1 export GTEST_THROW_ON_FAILURE=1 GTEST_HAS_EXCEPTIONS=1
@ -165,10 +165,10 @@ PLATFORM_CXXFLAGS += -isystem $(GTEST_DIR)
default: all default: all
WARNING_FLAGS = -W -Wextra -Wall -Wsign-compare -Wshadow \ WARNING_FLAGS = -W -Wextra -Wall -Wsign-compare -Wshadow \
-Wno-unused-parameter -Wno-unused-parameter
ifndef DISABLE_WARNING_AS_ERROR ifndef DISABLE_WARNING_AS_ERROR
WARNING_FLAGS += -Werror WARNING_FLAGS += -Werror
endif endif
CFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CCFLAGS) $(OPT) CFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
@ -178,18 +178,18 @@ LDFLAGS += $(PLATFORM_LDFLAGS)
date := $(shell date +%F) date := $(shell date +%F)
ifdef FORCE_GIT_SHA ifdef FORCE_GIT_SHA
git_sha := $(FORCE_GIT_SHA) git_sha := $(FORCE_GIT_SHA)
else else
git_sha := $(shell git rev-parse HEAD 2>/dev/null) git_sha := $(shell git rev-parse HEAD 2>/dev/null)
endif endif
gen_build_version = \ gen_build_version = \
printf '%s\n' \ printf '%s\n' \
'\#include "build_version.h"' \ '\#include "build_version.h"' \
'const char* rocksdb_build_git_sha = \ 'const char* rocksdb_build_git_sha = \
"rocksdb_build_git_sha:$(git_sha)";' \ "rocksdb_build_git_sha:$(git_sha)";' \
'const char* rocksdb_build_git_date = \ 'const char* rocksdb_build_git_date = \
"rocksdb_build_git_date:$(date)";' \ "rocksdb_build_git_date:$(date)";' \
'const char* rocksdb_build_compile_date = __DATE__;' 'const char* rocksdb_build_compile_date = __DATE__;'
# Record the version of the source that we are compiling. # Record the version of the source that we are compiling.
# We keep a record of the git revision in this file. It is then built # We keep a record of the git revision in this file. It is then built
@ -199,11 +199,11 @@ printf '%s\n' \
CLEAN_FILES += util/build_version.cc: CLEAN_FILES += util/build_version.cc:
FORCE: FORCE:
util/build_version.cc: FORCE util/build_version.cc: FORCE
$(AM_V_GEN)rm -f $@-t $(AM_V_GEN)rm -f $@-t
$(AM_V_at)$(gen_build_version) > $@-t $(AM_V_at)$(gen_build_version) > $@-t
$(AM_V_at)if test -f $@; then \ $(AM_V_at)if test -f $@; then \
cmp -s $@-t $@ && rm -f $@-t || mv -f $@-t $@; \ cmp -s $@-t $@ && rm -f $@-t || mv -f $@-t $@; \
else mv -f $@-t $@; fi else mv -f $@-t $@; fi
LIBOBJECTS = $(LIB_SOURCES:.cc=.o) LIBOBJECTS = $(LIB_SOURCES:.cc=.o)
MOCKOBJECTS = $(MOCK_SOURCES:.cc=.o) MOCKOBJECTS = $(MOCK_SOURCES:.cc=.o)
@ -303,20 +303,20 @@ TESTS = \
SUBSET := $(shell echo $(TESTS) |sed s/^.*$(ROCKSDBTESTS_START)/$(ROCKSDBTESTS_START)/) SUBSET := $(shell echo $(TESTS) |sed s/^.*$(ROCKSDBTESTS_START)/$(ROCKSDBTESTS_START)/)
TOOLS = \ TOOLS = \
sst_dump \ sst_dump \
db_sanity_test \ db_sanity_test \
db_stress \ db_stress \
ldb \ ldb \
db_repl_stress \ db_repl_stress \
rocksdb_dump \ rocksdb_dump \
rocksdb_undump rocksdb_undump
BENCHMARKS = db_bench table_reader_bench cache_bench memtablerep_bench BENCHMARKS = db_bench table_reader_bench cache_bench memtablerep_bench
# The library name is configurable since we are maintaining libraries of both # The library name is configurable since we are maintaining libraries of both
# debug/release mode. # debug/release mode.
ifeq ($(LIBNAME),) ifeq ($(LIBNAME),)
LIBNAME=librocksdb LIBNAME=librocksdb
endif endif
LIBRARY = ${LIBNAME}.a LIBRARY = ${LIBNAME}.a
@ -347,23 +347,23 @@ SHARED3 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR)
SHARED4 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR).$(SHARED_PATCH) SHARED4 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR).$(SHARED_PATCH)
SHARED = $(SHARED1) $(SHARED2) $(SHARED3) $(SHARED4) SHARED = $(SHARED1) $(SHARED2) $(SHARED3) $(SHARED4)
$(SHARED1): $(SHARED4) $(SHARED1): $(SHARED4)
ln -fs $(SHARED4) $(SHARED1) ln -fs $(SHARED4) $(SHARED1)
$(SHARED2): $(SHARED4) $(SHARED2): $(SHARED4)
ln -fs $(SHARED4) $(SHARED2) ln -fs $(SHARED4) $(SHARED2)
$(SHARED3): $(SHARED4) $(SHARED3): $(SHARED4)
ln -fs $(SHARED4) $(SHARED3) ln -fs $(SHARED4) $(SHARED3)
endif endif
$(SHARED4): $(SHARED4):
$(CXX) $(PLATFORM_SHARED_LDFLAGS)$(SHARED3) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(LIB_SOURCES) \ $(CXX) $(PLATFORM_SHARED_LDFLAGS)$(SHARED3) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(LIB_SOURCES) \
$(LDFLAGS) -o $@ $(LDFLAGS) -o $@
endif # PLATFORM_SHARED_EXT endif # PLATFORM_SHARED_EXT
.PHONY: blackbox_crash_test check clean coverage crash_test ldb_tests package \ .PHONY: blackbox_crash_test check clean coverage crash_test ldb_tests package \
release tags valgrind_check whitebox_crash_test format static_lib shared_lib all \ release tags valgrind_check whitebox_crash_test format static_lib shared_lib all \
dbg rocksdbjavastatic rocksdbjava install install-static install-shared uninstall \ dbg rocksdbjavastatic rocksdbjava install install-static install-shared uninstall \
analyze analyze
all: $(LIBRARY) $(BENCHMARKS) $(TOOLS) $(TESTS) all: $(LIBRARY) $(BENCHMARKS) $(TOOLS) $(TESTS)
@ -375,15 +375,15 @@ dbg: $(LIBRARY) $(BENCHMARKS) $(TOOLS) $(TESTS)
# creates static library and programs # creates static library and programs
release: release:
$(MAKE) clean $(MAKE) clean
OPT="-DNDEBUG -O2" $(MAKE) static_lib $(TOOLS) db_bench OPT="-DNDEBUG -O2" $(MAKE) static_lib $(TOOLS) db_bench
coverage: coverage:
$(MAKE) clean $(MAKE) clean
COVERAGEFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS+="-lgcov" $(MAKE) J=1 all check COVERAGEFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS+="-lgcov" $(MAKE) J=1 all check
cd coverage && ./coverage_test.sh cd coverage && ./coverage_test.sh
# Delete intermediate files # Delete intermediate files
find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \; find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \;
# Extract the names of its tests by running db_test with --gtest_list_tests. # Extract the names of its tests by running db_test with --gtest_list_tests.
# This filter removes the "#"-introduced comments, and expands to # This filter removes the "#"-introduced comments, and expands to
@ -404,11 +404,11 @@ find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \;
# MultiThreaded/MultiThreadedDBTest.MultiThreaded/1 # MultiThreaded/MultiThreadedDBTest.MultiThreaded/1
# #
test_names = \ test_names = \
./db_test --gtest_list_tests \ ./db_test --gtest_list_tests \
| perl -n \ | perl -n \
-e 's/ *\#.*//;' \ -e 's/ *\#.*//;' \
-e '/^(\s*)(\S+)/; !$$1 and do {$$p=$$2; break};' \ -e '/^(\s*)(\S+)/; !$$1 and do {$$p=$$2; break};' \
-e 'print qq! $$p$$2!' -e 'print qq! $$p$$2!'
ifeq ($(MAKECMDGOALS),check) ifeq ($(MAKECMDGOALS),check)
# Use /dev/shm if it has the sticky bit set (otherwise, /tmp), # Use /dev/shm if it has the sticky bit set (otherwise, /tmp),
@ -416,8 +416,8 @@ ifeq ($(MAKECMDGOALS),check)
# We'll use that directory in the "make check" rules. # We'll use that directory in the "make check" rules.
ifeq ($(TMPD),) ifeq ($(TMPD),)
TMPD := $(shell f=/dev/shm; test -k $$f || f=/tmp; \ TMPD := $(shell f=/dev/shm; test -k $$f || f=/tmp; \
perl -le 'use File::Temp "tempdir";' \ perl -le 'use File::Temp "tempdir";' \
-e 'print tempdir("'$$f'/rocksdb.XXXX", CLEANUP => 0)') -e 'print tempdir("'$$f'/rocksdb.XXXX", CLEANUP => 0)')
endif endif
endif endif
@ -439,16 +439,16 @@ t_run = $(patsubst %,t/%,$(t_sanitized))
# tests run). # tests run).
filter = --gtest_filter=$(subst -,/,$(@F)) filter = --gtest_filter=$(subst -,/,$(@F))
$(t_run): Makefile db_test $(t_run): Makefile db_test
$(AM_V_GEN)mkdir -p t $(AM_V_GEN)mkdir -p t
$(AM_V_at)rm -f $@ $@-t $(AM_V_at)rm -f $@ $@-t
$(AM_V_at)printf '%s\n' \ $(AM_V_at)printf '%s\n' \
'#!/bin/sh' \ '#!/bin/sh' \
'd=$(TMPD)/$(@F)' \ 'd=$(TMPD)/$(@F)' \
'mkdir -p $$d' \ 'mkdir -p $$d' \
'TEST_TMPDIR=$$d ./db_test $(filter)' \ 'TEST_TMPDIR=$$d ./db_test $(filter)' \
> $@-t > $@-t
$(AM_V_at)chmod a=rx $@-t $(AM_V_at)chmod a=rx $@-t
$(AM_V_at)mv $@-t $@ $(AM_V_at)mv $@-t $@
# Reorder input lines (which are one per test) so that the # Reorder input lines (which are one per test) so that the
# longest-running tests appear first in the output. # longest-running tests appear first in the output.
@ -467,11 +467,11 @@ $(AM_V_at)mv $@-t $@
# 107.816 PASS t/DBTest.EncodeDecompressedBlockSizeTest # 107.816 PASS t/DBTest.EncodeDecompressedBlockSizeTest
# #
slow_test_regexp = \ slow_test_regexp = \
^t/DBTest\.(?:FileCreationRandomFailure|EncodeDecompressedBlockSizeTest)$$ ^t/DBTest\.(?:FileCreationRandomFailure|EncodeDecompressedBlockSizeTest)$$
prioritize_long_running_tests = \ prioritize_long_running_tests = \
perl -pe 's,($(slow_test_regexp)),100 $$1,' \ perl -pe 's,($(slow_test_regexp)),100 $$1,' \
| sort -k1,1gr \ | sort -k1,1gr \
| sed 's/^[.0-9]* //' | sed 's/^[.0-9]* //'
# "make check" uses # "make check" uses
# Run with "make J=1 check" to disable parallelism in "make check". # Run with "make J=1 check" to disable parallelism in "make check".
@ -485,18 +485,18 @@ tests-regexp = .
.PHONY: check_0 .PHONY: check_0
check_0: $(t_run) check_0: $(t_run)
$(AM_V_GEN)export TEST_TMPDIR=$(TMPD); \ $(AM_V_GEN)export TEST_TMPDIR=$(TMPD); \
printf '%s\n' '' \ printf '%s\n' '' \
'To monitor subtest <duration,pass/fail,name>,' \ 'To monitor subtest <duration,pass/fail,name>,' \
' run "make watch-log" in a separate window' ''; \ ' run "make watch-log" in a separate window' ''; \
test -t 1 && eta=--eta || eta=; \ test -t 1 && eta=--eta || eta=; \
{ \ { \
printf './%s\n' $(filter-out db_test, $(TESTS)); \ printf './%s\n' $(filter-out db_test, $(TESTS)); \
printf '%s\n' $(t_run); \ printf '%s\n' $(t_run); \
} \ } \
| $(prioritize_long_running_tests) \ | $(prioritize_long_running_tests) \
| grep -E '$(tests-regexp)' \ | grep -E '$(tests-regexp)' \
| parallel -j$(J) --joblog=LOG $$eta --gnu '{} >& t/log-{/}' | parallel -j$(J) --joblog=LOG $$eta --gnu '{} >& t/log-{/}'
endif endif
CLEAN_FILES += t LOG $(TMPD) CLEAN_FILES += t LOG $(TMPD)
@ -509,178 +509,178 @@ CLEAN_FILES += t LOG $(TMPD)
# regardless of their duration. As with any use of "watch", hit ^C to # regardless of their duration. As with any use of "watch", hit ^C to
# interrupt. # interrupt.
watch-log: watch-log:
watch --interval=0 'sort -k7,7nr -k4,4gr LOG|$(quoted_perl_command)' watch --interval=0 'sort -k7,7nr -k4,4gr LOG|$(quoted_perl_command)'
# If J != 1 and GNU parallel is installed, run the tests in parallel, # If J != 1 and GNU parallel is installed, run the tests in parallel,
# via the check_0 rule above. Otherwise, run them sequentially. # via the check_0 rule above. Otherwise, run them sequentially.
check: all check: all
$(AM_V_GEN)if test "$(J)" != 1 \ $(AM_V_GEN)if test "$(J)" != 1 \
&& (parallel --gnu --help 2>/dev/null) | \ && (parallel --gnu --help 2>/dev/null) | \
grep -q 'GNU Parallel'; \ grep -q 'GNU Parallel'; \
then \ then \
t=$$($(test_names)); \ t=$$($(test_names)); \
$(MAKE) T="$$t" TMPD=$(TMPD) check_0; \ $(MAKE) T="$$t" TMPD=$(TMPD) check_0; \
else \ else \
for t in $(TESTS); do \ for t in $(TESTS); do \
echo "===== Running $$t"; ./$$t || exit 1; done; \ echo "===== Running $$t"; ./$$t || exit 1; done; \
fi fi
rm -rf $(TMPD) rm -rf $(TMPD)
python tools/ldb_test.py python tools/ldb_test.py
sh tools/rocksdb_dump_test.sh sh tools/rocksdb_dump_test.sh
check_some: $(SUBSET) ldb_tests check_some: $(SUBSET) ldb_tests
for t in $(SUBSET); do echo "===== Running $$t"; ./$$t || exit 1; done for t in $(SUBSET); do echo "===== Running $$t"; ./$$t || exit 1; done
.PHONY: ldb_tests .PHONY: ldb_tests
ldb_tests: ldb ldb_tests: ldb
python tools/ldb_test.py python tools/ldb_test.py
crash_test: whitebox_crash_test blackbox_crash_test crash_test: whitebox_crash_test blackbox_crash_test
blackbox_crash_test: db_stress blackbox_crash_test: db_stress
python -u tools/db_crashtest.py python -u tools/db_crashtest.py
whitebox_crash_test: db_stress whitebox_crash_test: db_stress
python -u tools/db_crashtest2.py python -u tools/db_crashtest2.py
asan_check: asan_check:
$(MAKE) clean $(MAKE) clean
COMPILE_WITH_ASAN=1 $(MAKE) check -j32 COMPILE_WITH_ASAN=1 $(MAKE) check -j32
$(MAKE) clean $(MAKE) clean
asan_crash_test: asan_crash_test:
$(MAKE) clean $(MAKE) clean
COMPILE_WITH_ASAN=1 $(MAKE) crash_test COMPILE_WITH_ASAN=1 $(MAKE) crash_test
$(MAKE) clean $(MAKE) clean
valgrind_check: $(TESTS) valgrind_check: $(TESTS)
mkdir -p $(VALGRIND_DIR) mkdir -p $(VALGRIND_DIR)
echo TESTS THAT HAVE VALGRIND ERRORS > $(VALGRIND_DIR)/valgrind_failed_tests; \ echo TESTS THAT HAVE VALGRIND ERRORS > $(VALGRIND_DIR)/valgrind_failed_tests; \
echo TIMES in seconds TAKEN BY TESTS ON VALGRIND > $(VALGRIND_DIR)/valgrind_tests_times; \ echo TIMES in seconds TAKEN BY TESTS ON VALGRIND > $(VALGRIND_DIR)/valgrind_tests_times; \
for t in $(filter-out skiplist_test,$(TESTS)); do \ for t in $(filter-out skiplist_test,$(TESTS)); do \
stime=`date '+%s'`; \ stime=`date '+%s'`; \
$(VALGRIND_VER) $(VALGRIND_OPTS) ./$$t; \ $(VALGRIND_VER) $(VALGRIND_OPTS) ./$$t; \
if [ $$? -eq $(VALGRIND_ERROR) ] ; then \ if [ $$? -eq $(VALGRIND_ERROR) ] ; then \
echo $$t >> $(VALGRIND_DIR)/valgrind_failed_tests; \ echo $$t >> $(VALGRIND_DIR)/valgrind_failed_tests; \
fi; \ fi; \
etime=`date '+%s'`; \ etime=`date '+%s'`; \
echo $$t $$((etime - stime)) >> $(VALGRIND_DIR)/valgrind_tests_times; \ echo $$t $$((etime - stime)) >> $(VALGRIND_DIR)/valgrind_tests_times; \
done done
analyze: clean analyze: clean
$(CLANG_SCAN_BUILD) --use-analyzer=$(CLANG_ANALYZER) \ $(CLANG_SCAN_BUILD) --use-analyzer=$(CLANG_ANALYZER) \
--use-c++=$(CXX) --use-cc=$(CC) --status-bugs \ --use-c++=$(CXX) --use-cc=$(CC) --status-bugs \
-o $(CURDIR)/scan_build_report \ -o $(CURDIR)/scan_build_report \
$(MAKE) dbg $(MAKE) dbg
CLEAN_FILES += unity.cc CLEAN_FILES += unity.cc
unity.cc: Makefile unity.cc: Makefile
rm -f $@ $@-t rm -f $@ $@-t
for source_file in $(LIB_SOURCES); do \ for source_file in $(LIB_SOURCES); do \
echo "#include <$$source_file>" >> $@-t; \ echo "#include <$$source_file>" >> $@-t; \
done done
echo 'int main(int argc, char** argv){ return 0; }' >> $@-t echo 'int main(int argc, char** argv){ return 0; }' >> $@-t
chmod a=r $@-t chmod a=r $@-t
mv $@-t $@ mv $@-t $@
unity: unity.o unity: unity.o
$(AM_LINK) $(AM_LINK)
clean: clean:
rm -f $(BENCHMARKS) $(TOOLS) $(TESTS) $(LIBRARY) $(SHARED) rm -f $(BENCHMARKS) $(TOOLS) $(TESTS) $(LIBRARY) $(SHARED)
rm -rf $(CLEAN_FILES) ios-x86 ios-arm scan_build_report rm -rf $(CLEAN_FILES) ios-x86 ios-arm scan_build_report
find . -name "*.[oda]" -exec rm -f {} \; find . -name "*.[oda]" -exec rm -f {} \;
find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \; find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \;
rm -rf bzip2* snappy* zlib* lz4* rm -rf bzip2* snappy* zlib* lz4*
tags: tags:
ctags * -R ctags * -R
cscope -b `find . -name '*.cc'` `find . -name '*.h'` cscope -b `find . -name '*.cc'` `find . -name '*.h'`
format: format:
build_tools/format-diff.sh build_tools/format-diff.sh
package: package:
bash build_tools/make_package.sh $(SHARED_MAJOR).$(SHARED_MINOR) bash build_tools/make_package.sh $(SHARED_MAJOR).$(SHARED_MINOR)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Unit tests and tools # Unit tests and tools
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
$(LIBRARY): $(LIBOBJECTS) $(LIBRARY): $(LIBOBJECTS)
$(AM_V_AR)rm -f $@ $(AM_V_AR)rm -f $@
$(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIBOBJECTS) $(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIBOBJECTS)
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
$(AM_LINK) $(AM_LINK)
cache_bench: util/cache_bench.o $(LIBOBJECTS) $(TESTUTIL) cache_bench: util/cache_bench.o $(LIBOBJECTS) $(TESTUTIL)
$(AM_LINK) $(AM_LINK)
memtablerep_bench: db/memtablerep_bench.o $(LIBOBJECTS) $(TESTUTIL) memtablerep_bench: db/memtablerep_bench.o $(LIBOBJECTS) $(TESTUTIL)
$(AM_LINK) $(AM_LINK)
block_hash_index_test: table/block_hash_index_test.o $(LIBOBJECTS) $(TESTHARNESS) block_hash_index_test: table/block_hash_index_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
db_stress: tools/db_stress.o $(LIBOBJECTS) $(TESTUTIL) db_stress: tools/db_stress.o $(LIBOBJECTS) $(TESTUTIL)
$(AM_LINK) $(AM_LINK)
db_sanity_test: tools/db_sanity_test.o $(LIBOBJECTS) $(TESTUTIL) db_sanity_test: tools/db_sanity_test.o $(LIBOBJECTS) $(TESTUTIL)
$(AM_LINK) $(AM_LINK)
db_repl_stress: tools/db_repl_stress.o $(LIBOBJECTS) $(TESTUTIL) db_repl_stress: tools/db_repl_stress.o $(LIBOBJECTS) $(TESTUTIL)
$(AM_LINK) $(AM_LINK)
arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
autovector_test: util/autovector_test.o $(LIBOBJECTS) $(TESTHARNESS) autovector_test: util/autovector_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
column_family_test: db/column_family_test.o $(LIBOBJECTS) $(TESTHARNESS) column_family_test: db/column_family_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
table_properties_collector_test: db/table_properties_collector_test.o $(LIBOBJECTS) $(TESTHARNESS) table_properties_collector_test: db/table_properties_collector_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
bloom_test: util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) bloom_test: util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
dynamic_bloom_test: util/dynamic_bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) dynamic_bloom_test: util/dynamic_bloom_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
stringappend_test: utilities/merge_operators/string_append/stringappend_test.o $(LIBOBJECTS) $(TESTHARNESS) stringappend_test: utilities/merge_operators/string_append/stringappend_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
redis_test: utilities/redis/redis_lists_test.o $(LIBOBJECTS) $(TESTHARNESS) redis_test: utilities/redis/redis_lists_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
histogram_test: util/histogram_test.o $(LIBOBJECTS) $(TESTHARNESS) histogram_test: util/histogram_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
thread_local_test: util/thread_local_test.o $(LIBOBJECTS) $(TESTHARNESS) thread_local_test: util/thread_local_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
slice_transform_test: util/slice_transform_test.o $(LIBOBJECTS) $(TESTHARNESS) slice_transform_test: util/slice_transform_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
db_test: db/db_test.o util/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) db_test: db/db_test.o util/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)
db_log_iter_test: db/db_log_iter_test.o util/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS) db_log_iter_test: db/db_log_iter_test.o util/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK) $(AM_LINK)