|
|
@ -2,8 +2,10 @@ |
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
|
|
|
|
# Inherit some settings from environment variables, if available
|
|
|
|
CXX ?= g++ |
|
|
|
CC ?= gcc |
|
|
|
INSTALL_PATH ?= $(CURDIR) |
|
|
|
|
|
|
|
#-----------------------------------------------
|
|
|
|
# Uncomment exactly one of the lines labelled (A), (B), and (C) below
|
|
|
@ -19,8 +21,8 @@ $(shell sh ./build_detect_platform) |
|
|
|
# this file is generated by build_detect_platform to set build flags and sources
|
|
|
|
include build_config.mk |
|
|
|
|
|
|
|
CFLAGS += -c -I. -I./include $(PLATFORM_CCFLAGS) $(OPT) |
|
|
|
CXXFLAGS += -c -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) |
|
|
|
CFLAGS += -I. -I./include $(PLATFORM_CCFLAGS) $(OPT) |
|
|
|
CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) |
|
|
|
|
|
|
|
LDFLAGS += $(PLATFORM_LDFLAGS) |
|
|
|
|
|
|
@ -55,15 +57,33 @@ BENCHMARKS = db_bench_sqlite3 db_bench_tree_db |
|
|
|
LIBRARY = libleveldb.a |
|
|
|
MEMENVLIBRARY = libmemenv.a |
|
|
|
|
|
|
|
all: $(LIBRARY) |
|
|
|
default: all |
|
|
|
|
|
|
|
# Should we build shared libraries?
|
|
|
|
ifneq ($(PLATFORM_SHARED_EXT),) |
|
|
|
# Update db.h if you change these.
|
|
|
|
SHARED_MAJOR = 1 |
|
|
|
SHARED_MINOR = 3 |
|
|
|
SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT) |
|
|
|
SHARED2 = $(SHARED1).$(SHARED_MAJOR) |
|
|
|
SHARED3 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR) |
|
|
|
SHARED = $(SHARED1) $(SHARED2) $(SHARED3) |
|
|
|
$(SHARED3): |
|
|
|
$(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(INSTALL_PATH)/$(SHARED2) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3) |
|
|
|
$(SHARED2): $(SHARED3) |
|
|
|
ln -fs $(SHARED3) $(SHARED2) |
|
|
|
$(SHARED1): $(SHARED3) |
|
|
|
ln -fs $(SHARED3) $(SHARED1) |
|
|
|
endif |
|
|
|
|
|
|
|
all: $(SHARED) $(LIBRARY) |
|
|
|
|
|
|
|
check: $(PROGRAMS) $(TESTS) |
|
|
|
check: all $(PROGRAMS) $(TESTS) |
|
|
|
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done |
|
|
|
|
|
|
|
clean: |
|
|
|
-rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o |
|
|
|
-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 build_config.mk |
|
|
|
|
|
|
|
$(LIBRARY): $(LIBOBJECTS) |
|
|
|
rm -f $@ |
|
|
@ -142,22 +162,22 @@ IOSVERSION=$(shell defaults read /Developer/Platforms/iPhoneOS.platform/version |
|
|
|
|
|
|
|
.cc.o: |
|
|
|
mkdir -p ios-x86/$(dir $@) |
|
|
|
$(SIMULATORROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 $< -o ios-x86/$@ |
|
|
|
$(SIMULATORROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -c $< -o ios-x86/$@ |
|
|
|
mkdir -p ios-arm/$(dir $@) |
|
|
|
$(DEVICEROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 $< -o ios-arm/$@ |
|
|
|
$(DEVICEROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 -c $< -o ios-arm/$@ |
|
|
|
lipo ios-x86/$@ ios-arm/$@ -create -output $@ |
|
|
|
|
|
|
|
.c.o: |
|
|
|
mkdir -p ios-x86/$(dir $@) |
|
|
|
$(SIMULATORROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 $< -o ios-x86/$@ |
|
|
|
$(SIMULATORROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -c $< -o ios-x86/$@ |
|
|
|
mkdir -p ios-arm/$(dir $@) |
|
|
|
$(DEVICEROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 $< -o ios-arm/$@ |
|
|
|
$(DEVICEROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 -c $< -o ios-arm/$@ |
|
|
|
lipo ios-x86/$@ ios-arm/$@ -create -output $@ |
|
|
|
|
|
|
|
else |
|
|
|
.cc.o: |
|
|
|
$(CXX) $(CXXFLAGS) $< -o $@ |
|
|
|
$(CXX) $(CXXFLAGS) -c $< -o $@ |
|
|
|
|
|
|
|
.c.o: |
|
|
|
$(CC) $(CFLAGS) $< -o $@ |
|
|
|
$(CC) $(CFLAGS) -c $< -o $@ |
|
|
|
endif |