# Makefile for building a drop-in replacement of SQLite using
# @DB_VERSION_FULL_STRING@
###################################################################
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
###################################################################
# build libsqlite replacement
LOCAL_MODULE := libsqlite
# BDB_TOP will change with release numbers
BDB_TOP := db-@DB_VERSION@
BDB_PATH := $(LOCAL_PATH)/$(BDB_TOP)/src
# This directive results in arm (vs thumb) code. It's necessary to
# allow some BDB assembler code (for mutexes) to compile.
LOCAL_ARM_MODE := arm
# basic includes for BDB 11gR2
LOCAL_C_INCLUDES := $(BDB_PATH) $(LOCAL_PATH)/$(BDB_TOP)/build_android \
$(LOCAL_PATH)/$(BDB_TOP)/lang/sql/generated $(BDB_TOP)/src
# this is needed for sqlite3.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(BDB_TOP)/build_android/sql
# Source files
LOCAL_SRC_FILES := \
@SOURCE_FILES@
$(BDB_TOP)/lang/sql/generated/sqlite3.c
ifneq ($(TARGET_ARCH),arm)
LOCAL_LDLIBS += -lpthread -ldl
endif
#
# flags -- most of these are from the SQLite build, some are not.
# Here are some that may be changed for tuning or behavior:
# SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -- default size of BDB log file in bytes
# SQLITE_DEFAULT_PAGE_SIZE -- explicit control over page size for cache
# and databases
# SQLITE_DEFAULT_CACHE_SIZE -- sizes the BDB cache, in pages
# BDBSQL_SHARE_PRIVATE -- uses private environments but still shares databases
# among processes using external synchronization.
# BDBSQL_CONVERT_SQLITE -- define this to convert SQLite databases to BDB SQL
# format -- this has other requirements so do not do this without consulting
# Oracle.
#
LOCAL_CFLAGS += -Wall -DHAVE_USLEEP=1 \
-DSQLITE_DEFAULT_PAGE_SIZE=4096 \
-DBDBSQL_SHARE_PRIVATE=1 \
-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=524288 \
-DSQLITE_DEFAULT_CACHE_SIZE=128 \
-DSQLITE_THREADSAFE=1 -DNDEBUG=1 -DSQLITE_TEMP_STORE=3 \
-DSQLITE_OMIT_TRUNCATE_OPTIMIZATION -DSQLITE_OS_UNIX=1 \
-D_HAVE_SQLITE_CONFIG_H -DSQLITE_THREAD_OVERRIDE_LOCK=-1 \
-DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_BACKWARDS -Dfdatasync=fsync
# LOCAL_CFLAGS that are not used at this time
# -DSQLITE_ENABLE_POISON
# -DSQLITE_ENABLE_MEMORY_MANAGEMENT
ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SHARED_LIBRARIES := libdl
endif
LOCAL_C_INCLUDES += $(call include-path-for, system-core)/cutils
LOCAL_SHARED_LIBRARIES += liblog libicuuc libicui18n libutils
# This links in some static symbols from Android
LOCAL_WHOLE_STATIC_LIBRARIES := libsqlite3_android
include $(BUILD_SHARED_LIBRARY)
################################################################################
##device commande line tool:sqlite3
################################################################################
ifneq ($(SDK_ONLY),true) # SDK doesn't need device version of sqlite3
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES := $(BDB_TOP)/lang/sql/sqlite/src/shell.c
LOCAL_SHARED_LIBRARIES := libsqlite
LOCAL_C_INCLUDES := $(BDB_PATH) $(LOCAL_PATH)/$(BDB_TOP)/build_android\
$(LOCAL_PATH)/$(BDB_TOP)/lang/sql/generated $(LOCAL_PATH)/../android
ifneq ($(TARGET_ARCH),arm)
LOCAL_LDLIBS += -lpthread -ldl
endif
LOCAL_CFLAGS += -DHAVE_USLEEP=1 -DTHREADSAFE=1 -DNDEBUG=1
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := sqlite3
include $(BUILD_EXECUTABLE)
endif # !SDK_ONLY