Putting build artifacts in subdirectory.
1. Object files, libraries, and compiled executables are put into subdirectories. 2. The shared library is linked from individual object files. This provides for greater parallelism on large desktops while at the same time making for easier builds on small (i.e. embedded) systems. Fixes issue #279. 3. One program, db_bench, is compiled using the shared library. 4. The source file for "leveldbutil" was renamed from leveldb_main.cc to leveldbutil.cc. This provides for simpler makefile rules. 5. Because all targets placed the library (libleveldb.a) at the top level, the last platform built (desktop/device) always overwrote any prior artifact. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=113407013
This commit is contained in:
parent
2d0320a458
commit
adbe3eb073
469
Makefile
469
Makefile
@ -20,214 +20,395 @@ $(shell CC="$(CC)" CXX="$(CXX)" TARGET_OS="$(TARGET_OS)" \
|
|||||||
# this file is generated by the previous line to set build flags and sources
|
# this file is generated by the previous line to set build flags and sources
|
||||||
include build_config.mk
|
include build_config.mk
|
||||||
|
|
||||||
|
TESTS = \
|
||||||
|
db/autocompact_test \
|
||||||
|
db/c_test \
|
||||||
|
db/corruption_test \
|
||||||
|
db/db_test \
|
||||||
|
db/dbformat_test \
|
||||||
|
db/fault_injection_test \
|
||||||
|
db/filename_test \
|
||||||
|
db/log_test \
|
||||||
|
db/recovery_test \
|
||||||
|
db/skiplist_test \
|
||||||
|
db/version_edit_test \
|
||||||
|
db/version_set_test \
|
||||||
|
db/write_batch_test \
|
||||||
|
helpers/memenv/memenv_test \
|
||||||
|
issues/issue178_test \
|
||||||
|
issues/issue200_test \
|
||||||
|
table/filter_block_test \
|
||||||
|
table/table_test \
|
||||||
|
util/arena_test \
|
||||||
|
util/bloom_test \
|
||||||
|
util/cache_test \
|
||||||
|
util/coding_test \
|
||||||
|
util/crc32c_test \
|
||||||
|
util/env_test \
|
||||||
|
util/hash_test
|
||||||
|
|
||||||
|
UTILS = \
|
||||||
|
db/db_bench \
|
||||||
|
db/leveldbutil
|
||||||
|
|
||||||
|
# Put the object files in a subdirectory, but the application at the top of the object dir.
|
||||||
|
PROGNAMES := $(notdir $(TESTS) $(UTILS))
|
||||||
|
|
||||||
|
# On Linux may need libkyotocabinet-dev for dependency.
|
||||||
|
BENCHMARKS = \
|
||||||
|
doc/bench/db_bench_sqlite3 \
|
||||||
|
doc/bench/db_bench_tree_db
|
||||||
|
|
||||||
CFLAGS += -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
|
CFLAGS += -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
|
||||||
CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT)
|
CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT)
|
||||||
|
|
||||||
LDFLAGS += $(PLATFORM_LDFLAGS)
|
LDFLAGS += $(PLATFORM_LDFLAGS)
|
||||||
LIBS += $(PLATFORM_LIBS)
|
LIBS += $(PLATFORM_LIBS)
|
||||||
|
|
||||||
LIBOBJECTS = $(SOURCES:.cc=.o)
|
SIMULATOR_OUTDIR=out-ios-x86
|
||||||
MEMENVOBJECTS = $(MEMENV_SOURCES:.cc=.o)
|
DEVICE_OUTDIR=out-ios-arm
|
||||||
|
|
||||||
TESTUTIL = ./util/testutil.o
|
|
||||||
TESTHARNESS = ./util/testharness.o $(TESTUTIL)
|
|
||||||
|
|
||||||
# Note: iOS should probably be using libtool, not ar.
|
|
||||||
ifeq ($(PLATFORM), IOS)
|
ifeq ($(PLATFORM), IOS)
|
||||||
|
# Note: iOS should probably be using libtool, not ar.
|
||||||
AR=xcrun ar
|
AR=xcrun ar
|
||||||
|
SIMULATORSDK=$(shell xcrun -sdk iphonesimulator --show-sdk-path)
|
||||||
|
DEVICESDK=$(shell xcrun -sdk iphoneos --show-sdk-path)
|
||||||
|
DEVICE_CFLAGS = -isysroot "$(DEVICESDK)" -arch armv6 -arch armv7 -arch armv7s -arch arm64
|
||||||
|
SIMULATOR_CFLAGS = -isysroot "$(SIMULATORSDK)" -arch i686 -arch x86_64
|
||||||
|
STATIC_OUTDIR=out-ios-universal
|
||||||
|
else
|
||||||
|
STATIC_OUTDIR=out-static
|
||||||
|
SHARED_OUTDIR=out-shared
|
||||||
|
STATIC_PROGRAMS := $(addprefix $(STATIC_OUTDIR)/, $(PROGNAMES))
|
||||||
|
SHARED_PROGRAMS := $(addprefix $(SHARED_OUTDIR)/, db_bench)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
TESTS = \
|
STATIC_LIBOBJECTS := $(addprefix $(STATIC_OUTDIR)/, $(SOURCES:.cc=.o))
|
||||||
arena_test \
|
STATIC_MEMENVOBJECTS := $(addprefix $(STATIC_OUTDIR)/, $(MEMENV_SOURCES:.cc=.o))
|
||||||
autocompact_test \
|
|
||||||
bloom_test \
|
|
||||||
c_test \
|
|
||||||
cache_test \
|
|
||||||
coding_test \
|
|
||||||
corruption_test \
|
|
||||||
crc32c_test \
|
|
||||||
db_test \
|
|
||||||
dbformat_test \
|
|
||||||
env_test \
|
|
||||||
fault_injection_test \
|
|
||||||
filename_test \
|
|
||||||
filter_block_test \
|
|
||||||
hash_test \
|
|
||||||
issue178_test \
|
|
||||||
issue200_test \
|
|
||||||
log_test \
|
|
||||||
memenv_test \
|
|
||||||
recovery_test \
|
|
||||||
skiplist_test \
|
|
||||||
table_test \
|
|
||||||
version_edit_test \
|
|
||||||
version_set_test \
|
|
||||||
write_batch_test
|
|
||||||
|
|
||||||
PROGRAMS = db_bench leveldbutil $(TESTS)
|
DEVICE_LIBOBJECTS := $(addprefix $(DEVICE_OUTDIR)/, $(SOURCES:.cc=.o))
|
||||||
BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
|
DEVICE_MEMENVOBJECTS := $(addprefix $(DEVICE_OUTDIR)/, $(MEMENV_SOURCES:.cc=.o))
|
||||||
|
|
||||||
LIBRARY = libleveldb.a
|
SIMULATOR_LIBOBJECTS := $(addprefix $(SIMULATOR_OUTDIR)/, $(SOURCES:.cc=.o))
|
||||||
MEMENVLIBRARY = libmemenv.a
|
SIMULATOR_MEMENVOBJECTS := $(addprefix $(SIMULATOR_OUTDIR)/, $(MEMENV_SOURCES:.cc=.o))
|
||||||
|
|
||||||
|
SHARED_LIBOBJECTS := $(addprefix $(SHARED_OUTDIR)/, $(SOURCES:.cc=.o))
|
||||||
|
SHARED_MEMENVOBJECTS := $(addprefix $(SHARED_OUTDIR)/, $(MEMENV_SOURCES:.cc=.o))
|
||||||
|
|
||||||
|
TESTUTIL := $(STATIC_OUTDIR)/util/testutil.o
|
||||||
|
TESTHARNESS := $(STATIC_OUTDIR)/util/testharness.o $(TESTUTIL)
|
||||||
|
|
||||||
|
STATIC_TESTOBJS := $(addprefix $(STATIC_OUTDIR)/, $(addsuffix .o, $(TESTS)))
|
||||||
|
STATIC_UTILOBJS := $(addprefix $(STATIC_OUTDIR)/, $(addsuffix .o, $(UTILS)))
|
||||||
|
STATIC_ALLOBJS := $(STATIC_LIBOBJECTS) $(STATIC_MEMENVOBJECTS) $(STATIC_TESTOBJS) $(STATIC_UTILOBJS) $(TESTHARNESS)
|
||||||
|
DEVICE_ALLOBJS := $(DEVICE_LIBOBJECTS) $(DEVICE_MEMENVOBJECTS)
|
||||||
|
SIMULATOR_ALLOBJS := $(SIMULATOR_LIBOBJECTS) $(SIMULATOR_MEMENVOBJECTS)
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
# Should we build shared libraries?
|
# Should we build shared libraries?
|
||||||
ifneq ($(PLATFORM_SHARED_EXT),)
|
ifneq ($(PLATFORM_SHARED_EXT),)
|
||||||
|
|
||||||
|
# Many leveldb test apps use non-exported API's. Only build a subset for testing.
|
||||||
|
SHARED_ALLOBJS := $(SHARED_LIBOBJECTS) $(SHARED_MEMENVOBJECTS) $(TESTHARNESS)
|
||||||
|
|
||||||
ifneq ($(PLATFORM_SHARED_VERSIONED),true)
|
ifneq ($(PLATFORM_SHARED_VERSIONED),true)
|
||||||
SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT)
|
SHARED_LIB1 = libleveldb.$(PLATFORM_SHARED_EXT)
|
||||||
SHARED2 = $(SHARED1)
|
SHARED_LIB2 = $(SHARED_LIB1)
|
||||||
SHARED3 = $(SHARED1)
|
SHARED_LIB3 = $(SHARED_LIB1)
|
||||||
SHARED = $(SHARED1)
|
SHARED_LIBS = $(SHARED_LIB1)
|
||||||
|
SHARED_MEMENVLIB = $(SHARED_OUTDIR)/libmemenv.a
|
||||||
else
|
else
|
||||||
# Update db.h if you change these.
|
# Update db.h if you change these.
|
||||||
SHARED_MAJOR = 1
|
SHARED_VERSION_MAJOR = 1
|
||||||
SHARED_MINOR = 18
|
SHARED_VERSION_MINOR = 18
|
||||||
SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT)
|
SHARED_LIB1 = libleveldb.$(PLATFORM_SHARED_EXT)
|
||||||
SHARED2 = $(SHARED1).$(SHARED_MAJOR)
|
SHARED_LIB2 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR)
|
||||||
SHARED3 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR)
|
SHARED_LIB3 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR).$(SHARED_VERSION_MINOR)
|
||||||
SHARED = $(SHARED1) $(SHARED2) $(SHARED3)
|
SHARED_LIBS = $(SHARED_OUTDIR)/$(SHARED_LIB1) $(SHARED_OUTDIR)/$(SHARED_LIB2) $(SHARED_OUTDIR)/$(SHARED_LIB3)
|
||||||
$(SHARED1): $(SHARED3)
|
$(SHARED_OUTDIR)/$(SHARED_LIB1): $(SHARED_OUTDIR)/$(SHARED_LIB3)
|
||||||
ln -fs $(SHARED3) $(SHARED1)
|
ln -fs $(SHARED_LIB3) $(SHARED_OUTDIR)/$(SHARED_LIB1)
|
||||||
$(SHARED2): $(SHARED3)
|
$(SHARED_OUTDIR)/$(SHARED_LIB2): $(SHARED_OUTDIR)/$(SHARED_LIB3)
|
||||||
ln -fs $(SHARED3) $(SHARED2)
|
ln -fs $(SHARED_LIB3) $(SHARED_OUTDIR)/$(SHARED_LIB2)
|
||||||
|
SHARED_MEMENVLIB = $(SHARED_OUTDIR)/libmemenv.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(SHARED3):
|
$(SHARED_OUTDIR)/$(SHARED_LIB3): $(SHARED_LIBOBJECTS)
|
||||||
$(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED2) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3) $(LIBS)
|
$(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED_LIB2) $(SHARED_LIBOBJECTS) -o $(SHARED_OUTDIR)/$(SHARED_LIB3) $(LIBS)
|
||||||
|
|
||||||
endif # PLATFORM_SHARED_EXT
|
endif # PLATFORM_SHARED_EXT
|
||||||
|
|
||||||
all: $(SHARED) $(LIBRARY)
|
all: $(SHARED_LIBS) $(SHARED_PROGRAMS) $(STATIC_OUTDIR)/libleveldb.a $(STATIC_OUTDIR)/libmemenv.a $(STATIC_PROGRAMS)
|
||||||
|
|
||||||
check: all $(PROGRAMS) $(TESTS)
|
check: $(STATIC_PROGRAMS)
|
||||||
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
|
for t in $(notdir $(TESTS)); do echo "***** Running $$t"; $(STATIC_OUTDIR)/$$t || exit 1; done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o build_config.mk
|
-rm -rf out-static out-shared out-ios-x86 out-ios-arm out-ios-universal
|
||||||
-rm -rf ios-x86/* ios-arm/*
|
-rm -f build_config.mk
|
||||||
|
-rm -rf ios-x86 ios-arm
|
||||||
|
|
||||||
$(LIBRARY): $(LIBOBJECTS)
|
$(STATIC_OUTDIR):
|
||||||
rm -f $@
|
mkdir $@
|
||||||
$(AR) -rs $@ $(LIBOBJECTS)
|
|
||||||
|
|
||||||
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
|
$(STATIC_OUTDIR)/db: | $(STATIC_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
db_bench_sqlite3: doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL)
|
$(STATIC_OUTDIR)/helpers/memenv: | $(STATIC_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) -o $@ -lsqlite3 $(LIBS)
|
mkdir -p $@
|
||||||
|
|
||||||
db_bench_tree_db: doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL)
|
$(STATIC_OUTDIR)/port: | $(STATIC_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL) -o $@ -lkyotocabinet $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
leveldbutil: db/leveldb_main.o $(LIBOBJECTS)
|
$(STATIC_OUTDIR)/table: | $(STATIC_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/leveldb_main.o $(LIBOBJECTS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(STATIC_OUTDIR)/util: | $(STATIC_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
autocompact_test: db/autocompact_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
.PHONY: STATIC_OBJDIRS
|
||||||
$(CXX) $(LDFLAGS) db/autocompact_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
STATIC_OBJDIRS: \
|
||||||
|
$(STATIC_OUTDIR)/db \
|
||||||
|
$(STATIC_OUTDIR)/port \
|
||||||
|
$(STATIC_OUTDIR)/table \
|
||||||
|
$(STATIC_OUTDIR)/util \
|
||||||
|
$(STATIC_OUTDIR)/helpers/memenv
|
||||||
|
|
||||||
bloom_test: util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SHARED_OUTDIR):
|
||||||
$(CXX) $(LDFLAGS) util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SHARED_OUTDIR)/db: | $(SHARED_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SHARED_OUTDIR)/helpers/memenv: | $(SHARED_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir -p $@
|
||||||
|
|
||||||
coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SHARED_OUTDIR)/port: | $(SHARED_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SHARED_OUTDIR)/table: | $(SHARED_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SHARED_OUTDIR)/util: | $(SHARED_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
.PHONY: SHARED_OBJDIRS
|
||||||
$(CXX) $(LDFLAGS) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
SHARED_OBJDIRS: \
|
||||||
|
$(SHARED_OUTDIR)/db \
|
||||||
|
$(SHARED_OUTDIR)/port \
|
||||||
|
$(SHARED_OUTDIR)/table \
|
||||||
|
$(SHARED_OUTDIR)/util \
|
||||||
|
$(SHARED_OUTDIR)/helpers/memenv
|
||||||
|
|
||||||
dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(DEVICE_OUTDIR):
|
||||||
$(CXX) $(LDFLAGS) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(DEVICE_OUTDIR)/db: | $(DEVICE_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
fault_injection_test: db/fault_injection_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(DEVICE_OUTDIR)/helpers/memenv: | $(DEVICE_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/fault_injection_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir -p $@
|
||||||
|
|
||||||
filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(DEVICE_OUTDIR)/port: | $(DEVICE_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
filter_block_test: table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(DEVICE_OUTDIR)/table: | $(DEVICE_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
hash_test: util/hash_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(DEVICE_OUTDIR)/util: | $(DEVICE_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) util/hash_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
issue178_test: issues/issue178_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
.PHONY: DEVICE_OBJDIRS
|
||||||
$(CXX) $(LDFLAGS) issues/issue178_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
DEVICE_OBJDIRS: \
|
||||||
|
$(DEVICE_OUTDIR)/db \
|
||||||
|
$(DEVICE_OUTDIR)/port \
|
||||||
|
$(DEVICE_OUTDIR)/table \
|
||||||
|
$(DEVICE_OUTDIR)/util \
|
||||||
|
$(DEVICE_OUTDIR)/helpers/memenv
|
||||||
|
|
||||||
issue200_test: issues/issue200_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SIMULATOR_OUTDIR):
|
||||||
$(CXX) $(LDFLAGS) issues/issue200_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SIMULATOR_OUTDIR)/db: | $(SIMULATOR_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
recovery_test: db/recovery_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SIMULATOR_OUTDIR)/helpers/memenv: | $(SIMULATOR_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/recovery_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir -p $@
|
||||||
|
|
||||||
table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SIMULATOR_OUTDIR)/port: | $(SIMULATOR_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SIMULATOR_OUTDIR)/table: | $(SIMULATOR_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(SIMULATOR_OUTDIR)/util: | $(SIMULATOR_OUTDIR)
|
||||||
$(CXX) $(LDFLAGS) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
mkdir $@
|
||||||
|
|
||||||
version_set_test: db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
.PHONY: SIMULATOR_OBJDIRS
|
||||||
$(CXX) $(LDFLAGS) db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
SIMULATOR_OBJDIRS: \
|
||||||
|
$(SIMULATOR_OUTDIR)/db \
|
||||||
|
$(SIMULATOR_OUTDIR)/port \
|
||||||
|
$(SIMULATOR_OUTDIR)/table \
|
||||||
|
$(SIMULATOR_OUTDIR)/util \
|
||||||
|
$(SIMULATOR_OUTDIR)/helpers/memenv
|
||||||
|
|
||||||
write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
$(STATIC_ALLOBJS): | STATIC_OBJDIRS
|
||||||
$(CXX) $(LDFLAGS) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
$(DEVICE_ALLOBJS): | DEVICE_OBJDIRS
|
||||||
|
$(SIMULATOR_ALLOBJS): | SIMULATOR_OBJDIRS
|
||||||
$(MEMENVLIBRARY) : $(MEMENVOBJECTS)
|
$(SHARED_ALLOBJS): | SHARED_OBJDIRS
|
||||||
rm -f $@
|
|
||||||
$(AR) -rs $@ $(MEMENVOBJECTS)
|
|
||||||
|
|
||||||
memenv_test : helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS)
|
|
||||||
$(CXX) $(LDFLAGS) helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) -o $@ $(LIBS)
|
|
||||||
|
|
||||||
ifeq ($(PLATFORM), IOS)
|
ifeq ($(PLATFORM), IOS)
|
||||||
# For iOS, create universal object files to be used on both the simulator and
|
$(DEVICE_OUTDIR)/libleveldb.a: $(DEVICE_LIBOBJECTS)
|
||||||
|
rm -f $@
|
||||||
|
$(AR) -rs $@ $(DEVICE_LIBOBJECTS)
|
||||||
|
|
||||||
|
$(SIMULATOR_OUTDIR)/libleveldb.a: $(SIMULATOR_LIBOBJECTS)
|
||||||
|
rm -f $@
|
||||||
|
$(AR) -rs $@ $(SIMULATOR_LIBOBJECTS)
|
||||||
|
|
||||||
|
$(DEVICE_OUTDIR)/libmemenv.a: $(DEVICE_MEMENVOBJECTS)
|
||||||
|
rm -f $@
|
||||||
|
$(AR) -rs $@ $(DEVICE_MEMENVOBJECTS)
|
||||||
|
|
||||||
|
$(SIMULATOR_OUTDIR)/libmemenv.a: $(SIMULATOR_MEMENVOBJECTS)
|
||||||
|
rm -f $@
|
||||||
|
$(AR) -rs $@ $(SIMULATOR_MEMENVOBJECTS)
|
||||||
|
|
||||||
|
# For iOS, create universal object libraries to be used on both the simulator and
|
||||||
# a device.
|
# a device.
|
||||||
SIMULATORSDK=$(shell xcrun -sdk iphonesimulator --show-sdk-path)
|
$(STATIC_OUTDIR)/libleveldb.a: $(STATIC_OUTDIR) $(DEVICE_OUTDIR)/libleveldb.a $(SIMULATOR_OUTDIR)/libleveldb.a
|
||||||
DEVICESDK=$(shell xcrun -sdk iphoneos --show-sdk-path)
|
lipo -create $(DEVICE_OUTDIR)/libleveldb.a $(SIMULATOR_OUTDIR)/libleveldb.a -output $@
|
||||||
IOSARCH=-arch armv6 -arch armv7 -arch armv7s -arch arm64
|
|
||||||
|
|
||||||
.cc.o:
|
|
||||||
mkdir -p ios-x86/$(dir $@)
|
|
||||||
xcrun -sdk iphonesimulator $(CXX) $(CXXFLAGS) -isysroot "$(SIMULATORSDK)" -arch i686 -arch x86_64 -c $< -o ios-x86/$@
|
|
||||||
mkdir -p ios-arm/$(dir $@)
|
|
||||||
xcrun -sdk iphoneos $(CXX) $(CXXFLAGS) -isysroot "$(DEVICESDK)" $(IOSARCH) -c $< -o ios-arm/$@
|
|
||||||
xcrun lipo ios-x86/$@ ios-arm/$@ -create -output $@
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
mkdir -p ios-x86/$(dir $@)
|
|
||||||
xcrun -sdk iphonesimulator $(CC) $(CFLAGS) -isysroot "$(SIMULATORSDK)" -arch i686 -arch x86_64 -c $< -o ios-x86/$@
|
|
||||||
mkdir -p ios-arm/$(dir $@)
|
|
||||||
xcrun -sdk iphoneos $(CC) $(CFLAGS) -isysroot "$(DEVICESDK)" $(IOSARCH) -c $< -o ios-arm/$@
|
|
||||||
xcrun lipo ios-x86/$@ ios-arm/$@ -create -output $@
|
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/libmemenv.a: $(STATIC_OUTDIR) $(DEVICE_OUTDIR)/libmemenv.a $(SIMULATOR_OUTDIR)/libmemenv.a
|
||||||
|
lipo -create $(DEVICE_OUTDIR)/libmemenv.a $(SIMULATOR_OUTDIR)/libmemenv.a -output $@
|
||||||
else
|
else
|
||||||
.cc.o:
|
$(STATIC_OUTDIR)/libleveldb.a:$(STATIC_LIBOBJECTS)
|
||||||
|
rm -f $@
|
||||||
|
$(AR) -rs $@ $(STATIC_LIBOBJECTS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/libmemenv.a:$(STATIC_MEMENVOBJECTS)
|
||||||
|
rm -f $@
|
||||||
|
$(AR) -rs $@ $(STATIC_MEMENVOBJECTS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(SHARED_MEMENVLIB):$(SHARED_MEMENVOBJECTS)
|
||||||
|
rm -f $@
|
||||||
|
$(AR) -rs $@ $(SHARED_MEMENVOBJECTS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/db_bench:db/db_bench.cc $(STATIC_LIBOBJECTS) $(TESTUTIL)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/db_bench.cc $(STATIC_LIBOBJECTS) $(TESTUTIL) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/db_bench_sqlite3:doc/bench/db_bench_sqlite3.cc $(STATIC_LIBOBJECTS) $(TESTUTIL)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) doc/bench/db_bench_sqlite3.cc $(STATIC_LIBOBJECTS) $(TESTUTIL) -o $@ -lsqlite3 $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/db_bench_tree_db:doc/bench/db_bench_tree_db.cc $(STATIC_LIBOBJECTS) $(TESTUTIL)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) doc/bench/db_bench_tree_db.cc $(STATIC_LIBOBJECTS) $(TESTUTIL) -o $@ -lkyotocabinet $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/leveldbutil:db/leveldbutil.cc $(STATIC_LIBOBJECTS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/leveldbutil.cc $(STATIC_LIBOBJECTS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/arena_test:util/arena_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) util/arena_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/autocompact_test:db/autocompact_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/autocompact_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/bloom_test:util/bloom_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) util/bloom_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/c_test:$(STATIC_OUTDIR)/db/c_test.o $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(STATIC_OUTDIR)/db/c_test.o $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/cache_test:util/cache_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) util/cache_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/coding_test:util/coding_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) util/coding_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/corruption_test:db/corruption_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/corruption_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/crc32c_test:util/crc32c_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) util/crc32c_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/db_test:db/db_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/db_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/dbformat_test:db/dbformat_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/dbformat_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/env_test:util/env_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) util/env_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/fault_injection_test:db/fault_injection_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/fault_injection_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/filename_test:db/filename_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/filename_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/filter_block_test:table/filter_block_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) table/filter_block_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/hash_test:util/hash_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) util/hash_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/issue178_test:issues/issue178_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) issues/issue178_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/issue200_test:issues/issue200_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) issues/issue200_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/log_test:db/log_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/log_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/recovery_test:db/recovery_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/recovery_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/table_test:table/table_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) table/table_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/skiplist_test:db/skiplist_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/skiplist_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/version_edit_test:db/version_edit_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/version_edit_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/version_set_test:db/version_set_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/version_set_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/write_batch_test:db/write_batch_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS)
|
||||||
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) db/write_batch_test.cc $(STATIC_LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/memenv_test:$(STATIC_OUTDIR)/helpers/memenv/memenv_test.o $(STATIC_OUTDIR)/libmemenv.a $(STATIC_OUTDIR)/libleveldb.a $(TESTHARNESS)
|
||||||
|
$(XCRUN) $(CXX) $(LDFLAGS) $(STATIC_OUTDIR)/helpers/memenv/memenv_test.o $(STATIC_OUTDIR)/libmemenv.a $(STATIC_OUTDIR)/libleveldb.a $(TESTHARNESS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(SHARED_OUTDIR)/db_bench:$(SHARED_OUTDIR)/db/db_bench.o $(SHARED_LIBS) $(TESTUTIL)
|
||||||
|
$(XCRUN) $(CXX) $(LDFLAGS) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SHARED_OUTDIR)/db/db_bench.o $(TESTUTIL) $(SHARED_OUTDIR)/$(SHARED_LIB3) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
.PHONY: run-shared
|
||||||
|
run-shared: $(SHARED_OUTDIR)/db_bench
|
||||||
|
LD_LIBRARY_PATH=$(SHARED_OUTDIR) $(SHARED_OUTDIR)/db_bench
|
||||||
|
|
||||||
|
$(SIMULATOR_OUTDIR)/%.o: %.cc
|
||||||
|
xcrun -sdk iphonesimulator $(CXX) $(CXXFLAGS) $(SIMULATOR_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(DEVICE_OUTDIR)/%.o: %.cc
|
||||||
|
xcrun -sdk iphoneos $(CXX) $(CXXFLAGS) $(DEVICE_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(SIMULATOR_OUTDIR)/%.o: %.c
|
||||||
|
xcrun -sdk iphonesimulator $(CC) $(CFLAGS) $(SIMULATOR_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(DEVICE_OUTDIR)/%.o: %.c
|
||||||
|
xcrun -sdk iphoneos $(CC) $(CFLAGS) $(DEVICE_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(STATIC_OUTDIR)/%.o: %.cc
|
||||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
.c.o:
|
$(STATIC_OUTDIR)/%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
endif
|
|
||||||
|
$(SHARED_OUTDIR)/%.o: %.cc
|
||||||
|
$(CXX) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(SHARED_OUTDIR)/%.o: %.c
|
||||||
|
$(CC) $(CFLAGS) $(PLATFORM_SHARED_CFLAGS) -c $< -o $@
|
||||||
|
@ -161,7 +161,7 @@ DIRS="$PREFIX/db $PREFIX/util $PREFIX/table"
|
|||||||
set -f # temporarily disable globbing so that our patterns aren't expanded
|
set -f # temporarily disable globbing so that our patterns aren't expanded
|
||||||
PRUNE_TEST="-name *test*.cc -prune"
|
PRUNE_TEST="-name *test*.cc -prune"
|
||||||
PRUNE_BENCH="-name *_bench.cc -prune"
|
PRUNE_BENCH="-name *_bench.cc -prune"
|
||||||
PRUNE_TOOL="-name leveldb_main.cc -prune"
|
PRUNE_TOOL="-name leveldbutil.cc -prune"
|
||||||
PORTABLE_FILES=`find $DIRS $PRUNE_TEST -o $PRUNE_BENCH -o $PRUNE_TOOL -o -name '*.cc' -print | sort | sed "s,^$PREFIX/,," | tr "\n" " "`
|
PORTABLE_FILES=`find $DIRS $PRUNE_TEST -o $PRUNE_BENCH -o $PRUNE_TOOL -o -name '*.cc' -print | sort | sed "s,^$PREFIX/,," | tr "\n" " "`
|
||||||
|
|
||||||
set +f # re-enable globbing
|
set +f # re-enable globbing
|
||||||
|
Loading…
Reference in New Issue
Block a user