# Makefile for building Android.JDBC for DBSQL # @DB_VERSION_FULL_STRING@ # # This Makefile will generate 3 files: # 1. Static libdb_sql library. An internal library and users don't # need it. Just as the base of below two compontents. # 2. Shared Android.JDBC (.so) file. # 3. DBSQL shell. Staticed linking. So that users can use it on # Android directly. ################################################################### LOCAL_PATH := $(call my-dir) ################################################################### # Common variables ################################################################### BDB_TOP := ../../.. BDB_PATH := $(LOCAL_PATH)/$(BDB_TOP) # Common include paths COMMON_C_INCLUDES := $(BDB_PATH)/build_android $(BDB_PATH)/src \ $(BDB_PATH)/build_android/sql $(BDB_PATH)/lang/sql/generated # # 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. # COMMON_CFLAGS := -Wall -DHAVE_USLEEP=1 \ -DSQLITE_DEFAULT_PAGE_SIZE=4096 \ -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 # Required for JDBC building # Most of these are from configured /lang/sql/jdbc/Makefile.in COMMON_CFLAGS += \ -DHAVE_SQLITE2=0 -DHAVE_SQLITE3=1 \ -DHAVE_SQLITE_FUNCTION_TYPE=0 \ -DHAVE_SQLITE_OPEN_AUX_FILE=0 \ -DHAVE_SQLITE_SET_AUTHORIZER=0 \ -DHAVE_SQLITE_TRACE=0 \ -DHAVE_SQLITE_COMPILE=0 \ -DHAVE_SQLITE_PROGRESS_HANDLER=0 \ -DHAVE_SQLITE3_MALLOC=1 \ -DHAVE_SQLITE3_PREPARE_V2=1 \ -DHAVE_SQLITE3_PREPARE16_V2=1 \ -DHAVE_SQLITE3_BIND_ZEROBLOB=1 \ -DHAVE_SQLITE3_CLEAR_BINDINGS=1 \ -DHAVE_SQLITE3_COLUMN_TABLE_NAME16=1 \ -DHAVE_SQLITE3_COLUMN_DATABASE_NAME16=1 \ -DHAVE_SQLITE3_COLUMN_ORIGIN_NAME16=1 \ -DHAVE_SQLITE3_BIND_PARAMETER_COUNT=1 \ -DHAVE_SQLITE3_BIND_PARAMETER_NAME=1 \ -DHAVE_SQLITE3_BIND_PARAMETER_INDEX=1 \ -DHAVE_SQLITE3_RESULT_ZEROBLOB=1 \ -DHAVE_SQLITE3_INCRBLOBIO=1 \ -DHAVE_SQLITE3_KEY=0 \ -DHAVE_SQLITE3_SHARED_CACHE=1 \ -DHAVE_SQLITE3_OPEN_V2=1 \ -DHAVE_SQLITE3_LOAD_EXTENSION=0 \ -DHAVE_SQLITE3_BACKUPAPI=1 \ -DHAVE_SQLITE3_PROFILE=1 \ -DHAVE_SQLITE3_STATUS=1 \ -DHAVE_SQLITE3_DB_STATUS=1 \ -DHAVE_SQLITE3_STMT_STATUS=1 \ -DCANT_PASS_VALIST_AS_CHARPTR=1 \ -DHAVE_ERRNO_H -DHAVE_SQLITE_CONFIG_H \ -DHAVE_SQLITE3_MALLOC -O3 -D_GNU_SOURCE -D_REENTRANT \ -DSQLITE_ENABLE_COLUMN_METADATA=1 ################################################################################ # Build static library libdb_sql -- base of JDBC Driver and DBSQL shell ################################################################################ include $(CLEAR_VARS) LOCAL_MODULE := libdb_sql_static # 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 # Import common flags LOCAL_C_INCLUDES += $(COMMON_C_INCLUDES) LOCAL_CFLAGS += $(COMMON_CFLAGS) # Source files LOCAL_SRC_FILES := \ @SOURCE_FILES@ $(BDB_TOP)/lang/sql/generated/sqlite3.c ifneq ($(TARGET_ARCH),arm) LOCAL_LDLIBS += -lpthread -ldl endif 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 include $(BUILD_STATIC_LIBRARY) ################################################################################ # Build Android.JDBC shared library ################################################################################ include $(CLEAR_VARS) LOCAL_MODULE := oracle-jdbc LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libdb_sql_static # Based on above static library LOCAL_SRC_FILES := $(BDB_TOP)/build_unix/jdbc/native/sqlite_jni.c # Import common flags LOCAL_C_INCLUDES += $(COMMON_C_INCLUDES) LOCAL_CFLAGS += $(COMMON_CFLAGS) # For Android.JDBC native code LOCAL_C_INCLUDES += $(BDB_TOP)/build_unix/jdbc/native include $(BUILD_SHARED_LIBRARY) ################################################################################ ##device commande line tool: dbsql ################################################################################ ifneq ($(SDK_ONLY),true) # SDK doesn't need device version of dbsql include $(CLEAR_VARS) LOCAL_MODULE := dbsql LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libdb_sql_static # Based on above static library LOCAL_SRC_FILES := $(BDB_TOP)/lang/sql/sqlite/src/shell.c # Import common flags LOCAL_C_INCLUDES += $(COMMON_C_INCLUDES) LOCAL_CFLAGS += $(COMMON_CFLAGS) # Add flags for shell.c LOCAL_CFLAGS += -DNO_ANDROID_FUNCS ifneq ($(TARGET_ARCH),arm) LOCAL_LDLIBS += -lpthread -ldl endif LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug include $(BUILD_EXECUTABLE) endif # !SDK_ONLY