@ -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
i n c l u d e b u i l d _ c o n f i g . m k
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)
CXXFLAGS += -I. -I./include $( PLATFORM_CXXFLAGS) $( OPT)
LDFLAGS += $( PLATFORM_LDFLAGS)
LIBS += $( PLATFORM_LIBS)
LIBOBJECTS = $( SOURCES:.cc= .o)
MEMENVOBJECTS = $( MEMENV_SOURCES:.cc= .o)
TESTUTIL = ./util/testutil.o
TESTHARNESS = ./util/testharness.o $( TESTUTIL)
SIMULATOR_OUTDIR = out-ios-x86
DEVICE_OUTDIR = out-ios-arm
# Note: iOS should probably be using libtool, not ar.
i f e q ( $( PLATFORM ) , I O S )
# Note: iOS should probably be using libtool, not 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
e l s e
STATIC_OUTDIR = out-static
SHARED_OUTDIR = out-shared
STATIC_PROGRAMS := $( addprefix $( STATIC_OUTDIR) /, $( PROGNAMES) )
SHARED_PROGRAMS := $( addprefix $( SHARED_OUTDIR) /, db_bench)
e n d i f
TESTS = \
arena_test \
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)
BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
LIBRARY = libleveldb.a
MEMENVLIBRARY = libmemenv.a
STATIC_LIBOBJECTS := $( addprefix $( STATIC_OUTDIR) /, $( SOURCES:.cc= .o) )
STATIC_MEMENVOBJECTS := $( addprefix $( STATIC_OUTDIR) /, $( MEMENV_SOURCES:.cc= .o) )
DEVICE_LIBOBJECTS := $( addprefix $( DEVICE_OUTDIR) /, $( SOURCES:.cc= .o) )
DEVICE_MEMENVOBJECTS := $( addprefix $( DEVICE_OUTDIR) /, $( MEMENV_SOURCES:.cc= .o) )
SIMULATOR_LIBOBJECTS := $( addprefix $( SIMULATOR_OUTDIR) /, $( SOURCES:.cc= .o) )
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
# Should we build shared libraries?
i f n e q ( $( 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)
i f n e q ( $( PLATFORM_SHARED_VERSIONED ) , t r u e )
SHARED1 = libleveldb.$( PLATFORM_SHARED_EXT)
SHARED2 = $( SHARED1)
SHARED3 = $( SHARED1)
SHARED = $( SHARED1)
SHARED_LIB1 = libleveldb.$( PLATFORM_SHARED_EXT)
SHARED_LIB2 = $( SHARED_LIB1)
SHARED_LIB3 = $( SHARED_LIB1)
SHARED_LIBS = $( SHARED_LIB1)
SHARED_MEMENVLIB = $( SHARED_OUTDIR) /libmemenv.a
e l s e
# Update db.h if you change these.
SHARED_MAJOR = 1
SHARED_MINOR = 18
SHARED1 = libleveldb.$( PLATFORM_SHARED_EXT)
SHARED2 = $( SHARED1) .$( SHARED_MAJOR)
SHARED3 = $( SHARED1) .$( SHARED_MAJOR) .$( SHARED_MINOR)
SHARED = $( SHARED1) $( SHARED2) $( SHARED3)
$(SHARED1) : $( SHARED 3)
ln -fs $( SHARED3) $( SHARED1)
$(SHARED2) : $( SHARED 3)
ln -fs $( SHARED3) $( SHARED2)
SHARED_VERSION_MAJOR = 1
SHARED_VERSION_MINOR = 18
SHARED_LIB1 = libleveldb.$( PLATFORM_SHARED_EXT)
SHARED_LIB2 = $( SHARED_LIB1) .$( SHARED_VERSION_MAJOR)
SHARED_LIB3 = $( SHARED_LIB1) .$( SHARED_VERSION_MAJOR) .$( SHARED_VERSION_MINOR)
SHARED_LIBS = $( SHARED_OUTDIR) /$( SHARED_LIB1) $( SHARED_OUTDIR) /$( SHARED_LIB2) $( SHARED_OUTDIR) /$( SHARED_LIB3)
$(SHARED_OUTDIR)/$(SHARED_LIB1) : $( SHARED_OUTDIR ) /$( SHARED_LIB 3)
ln -fs $( SHARED_LIB3) $( SHARED_OUTDIR) /$( SHARED_LIB1)
$(SHARED_OUTDIR)/$(SHARED_LIB2) : $( SHARED_OUTDIR ) /$( SHARED_LIB 3)
ln -fs $( SHARED_LIB3) $( SHARED_OUTDIR) /$( SHARED_LIB2)
SHARED_MEMENVLIB = $( SHARED_OUTDIR) /libmemenv.a
e n d i f
$(SHARED3) :
$( CXX) $( LDFLAGS) $( PLATFORM_SHARED_LDFLAGS) $( SHARED2) $( CXXFLAGS) $( PLATFORM_SHARED_CFLAGS) $( SOURCES) -o $( SHARED 3) $( LIBS)
$(SHARED_OUTDIR)/$(SHARED_LIB 3) : $( SHARED_LIBOBJECTS )
$( CXX) $( LDFLAGS) $( PLATFORM_SHARED_LDFLAGS) $( SHARED_LIB 2) $( SHARED_LIBOBJECTS) -o $( SHARED_OUTDIR) /$( SHARED_LIB 3) $( LIBS)
e n d i f # 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 )
for t in $( TESTS) ; do echo " ***** Running $$ t " ; . /$$ t || exit 1; done
check : $( STATIC_ PROGRAMS)
for t in $( notdir $( TESTS) ) ; do echo " ***** Running $$ t " ; $( STATIC_OUTDIR) /$$ t || exit 1; done
clean :
-rm -f $( PROGRAMS) $( BENCHMARKS) $( LIBRARY) $( SHARED) $( MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o build_config.mk
-rm -rf ios-x86/* ios-arm/*
-rm -rf out-static out-shared out-ios-x86 out-ios-arm out-ios-universal
-rm -f build_config.mk
-rm -rf ios-x86 ios-arm
$(LIBRARY) : $( LIBOBJECTS )
rm -f $@
$( AR) -rs $@ $( LIBOBJECTS)
$(STATIC_OUTDIR) :
mkdir $@
db_bench : db /db_bench .o $( LIBOBJECTS ) $( TESTUTIL )
$( CXX) $( LDFLAGS) db/db_bench.o $( LIBOBJECTS) $( TESTUTIL) -o $@ $( LIBS)
$(STATIC_OUTDIR)/db : | $( STATIC_OUTDIR )
mkdir $@
db_bench_sqlite3 : doc /bench /db_bench_sqlite 3.o $( LIBOBJECTS ) $( TESTUTIL )
$( CXX) $( LDFLAGS) doc/bench/db_bench_sqlite3.o $( LIBOBJECTS) $( TESTUTIL) -o $@ -lsqlite3 $( LIBS)
$(STATIC_OUTDIR)/helpers/memenv : | $( STATIC_OUTDIR )
mkdir -p $@
db_bench_tree_db : doc /bench /db_bench_tree_db .o $( LIBOBJECTS ) $( TESTUTIL )
$( CXX) $( LDFLAGS) doc/bench/db_bench_tree_db.o $( LIBOBJECTS) $( TESTUTIL) -o $@ -lkyotocabinet $( LIBS)
$(STATIC_OUTDIR)/port : | $( STATIC_OUTDIR )
mkdir $@
leveldbutil : db /leveldb_main .o $( LIBOBJECTS )
$( CXX) $( LDFLAGS) db/leveldb_main.o $( LIBOBJECTS) -o $@ $( LIBS)
$(STATIC_OUTDIR)/table : | $( STATIC_OUTDIR )
mkdir $@
arena_test : util /arena_test .o $( LIBOBJECTS ) $( TE STH ARNESS )
$( CXX) $( LDFLAGS) util/arena_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(STATIC_OUTDIR)/util : | $( STATIC_OUTDI R )
mkdir $@
autocompact_test : db /autocompact_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/autocompact_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
.PHONY : STATIC_OBJDIRS
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 )
$( CXX) $( LDFLAGS) util/bloom_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SHARED_OUTDIR) :
mkdir $@
c_test : db /c_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/c_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SHARED_OUTDIR)/db : | $( SHARED_OUTDIR )
mkdir $@
cache_test : util /cache_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) util/cache_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SHARED_OUTDIR)/helpers/memenv : | $( SHARED_OUTDIR )
mkdir -p $@
coding_test : util /coding_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) util/coding_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SHARED_OUTDIR)/port : | $( SHARED_OUTDIR )
mkdir $@
corruption_test : db /corruption_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/corruption_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SHARED_OUTDIR)/table : | $( SHARED_OUTDIR )
mkdir $@
crc32c_test : util /crc 32c_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) util/crc32c_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SHARED_OUTDIR)/util : | $( SHARED_OUTDIR )
mkdir $@
db_test : db /db_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/db_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
.PHONY : SHARED_OBJDIRS
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 )
$( CXX) $( LDFLAGS) db/dbformat_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(DEVICE_OUTDIR) :
mkdir $@
env_test : util /env_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) util/env_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(DEVICE_OUTDIR)/db : | $( DEVICE_OUTDIR )
mkdir $@
fault_injection_test : db /fault_injection_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/fault_injection_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(DEVICE_OUTDIR)/helpers/memenv : | $( DEVICE_OUTDIR )
mkdir -p $@
filename_test : db /filename_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/filename_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(DEVICE_OUTDIR)/port : | $( DEVICE_OUTDIR )
mkdir $@
filter_block_test : table /filter_block_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) table/filter_block_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(DEVICE_OUTDIR)/table : | $( DEVICE_OUTDIR )
mkdir $@
hash_test : util /hash_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) util/hash_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(DEVICE_OUTDIR)/util : | $( DEVICE_OUTDIR )
mkdir $@
issue178_test : issues /issue 178_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) issues/issue178_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
.PHONY : DEVICE_OBJDIRS
DEVICE_OBJDIRS : \
$( DEVICE_OUTDIR) /db \
$( DEVICE_OUTDIR) /port \
$( DEVICE_OUTDIR) /table \
$( DEVICE_OUTDIR) /util \
$( DEVICE_OUTDIR) /helpers/memenv
issue200_test : issues /issue 200_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) issues/issue200_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SIMULATOR_OUTDIR) :
mkdir $@
log_test : db /log_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/log_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SIMULATOR_OUTDIR)/db : | $( SIMULATOR_OUTDIR )
mkdir $@
recovery_test : db /recovery_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/recovery_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SIMULATOR_OUTDIR)/helpers/memenv : | $( SIMULATOR_OUTDIR )
mkdir -p $@
table_test : table /table_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) table/table_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SIMULATOR_OUTDIR)/port : | $( SIMULATOR_OUTDIR )
mkdir $@
skiplist_test : db /skiplist_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/skiplist_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SIMULATOR_OUTDIR)/table : | $( SIMULATOR_OUTDIR )
mkdir $@
version_edit_test : db /version_edit_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/version_edit_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(SIMULATOR_OUTDIR)/util : | $( SIMULATOR_OUTDIR )
mkdir $@
version_set_test : db /version_set_test .o $( LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) db/version_set_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
.PHONY : SIMULATOR_OBJDIRS
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 )
$( CXX) $( LDFLAGS) db/write_batch_test.o $( LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(STATIC_ALLOBJS) : | STATIC_OBJDIRS
$(DEVICE_ALLOBJS) : | DEVICE_OBJDIRS
$(SIMULATOR_ALLOBJS) : | SIMULATOR_OBJDIRS
$(SHARED_ALLOBJS) : | SHARED_OBJDIRS
$(MEMENVLIBRARY) : $( MEMENVOBJECTS )
i f e q ( $( PLATFORM ) , I O S )
$(DEVICE_OUTDIR)/libleveldb.a : $( DEVICE_LIBOBJECTS )
rm -f $@
$( AR) -rs $@ $( MEMENV OBJECTS)
$( AR) -rs $@ $( DEVICE_LIB OBJECTS)
memenv_test : helpers /memenv /memenv_test .o $( MEMENVLIBRARY ) $( LIBRARY ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) helpers/memenv/memenv_test.o $( MEMENVLIBRARY) $( LIBRARY) $( TESTHARNESS) -o $@ $( LIBS)
$(SIMULATOR_OUTDIR)/libleveldb.a : $( SIMULATOR_LIBOBJECTS )
rm -f $@
$( AR) -rs $@ $( SIMULATOR_LIBOBJECTS)
i f e q ( $( PLATFORM ) , I O S )
# For iOS, create universal object files to be used on both the simulator and
$(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.
SIMULATORSDK = $( shell xcrun -sdk iphonesimulator --show-sdk-path)
DEVICESDK = $( shell xcrun -sdk iphoneos --show-sdk-path)
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)/libleveldb.a : $( STATIC_OUTDIR ) $( DEVICE_OUTDIR ) /libleveldb .a $( SIMULATOR_OUTDIR ) /libleveldb .a
lipo -create $( DEVICE_OUTDIR) /libleveldb.a $( SIMULATOR_OUTDIR) /libleveldb.a -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 $@
e l s e
.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)
e n d i f
$(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_sqlite 3.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 /crc 32c_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 /issue 178_test .cc $( STATIC_LIBOBJECTS ) $( TESTHARNESS )
$( CXX) $( LDFLAGS) $( CXXFLAGS) issues/issue178_test.cc $( STATIC_LIBOBJECTS) $( TESTHARNESS) -o $@ $( LIBS)
$(STATIC_OUTDIR)/issue200_test : issues /issue 200_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 $@
.c.o :
$(STATIC_OUTDIR)/%.o : %.c
$( CC) $( CFLAGS) -c $< -o $@
e n d i f
$(SHARED_OUTDIR)/%.o : %.cc
$( CXX) $( CXXFLAGS) $( PLATFORM_SHARED_CFLAGS) -c $< -o $@
$(SHARED_OUTDIR)/%.o : %.c
$( CC) $( CFLAGS) $( PLATFORM_SHARED_CFLAGS) -c $< -o $@