1 ## 2 ## 3 ## Build the library 4 ## 5 ## 6 7 LOCAL_PATH:= $(call my-dir) 8 9 # NOTE the following flags, 10 # SQLITE_TEMP_STORE=3 causes all TEMP files to go into RAM. and thats the behavior we want 11 # SQLITE_ENABLE_FTS3 enables usage of FTS3 - NOT FTS1 or 2. 12 # SQLITE_DEFAULT_AUTOVACUUM=1 causes the databases to be subject to auto-vacuum 13 common_sqlite_flags := \ 14 -DNDEBUG=1 \ 15 -DHAVE_USLEEP=1 \ 16 -DSQLITE_HAVE_ISNAN \ 17 -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \ 18 -DSQLITE_THREADSAFE=2 \ 19 -DSQLITE_TEMP_STORE=3 \ 20 -DSQLITE_POWERSAFE_OVERWRITE=1 \ 21 -DSQLITE_DEFAULT_FILE_FORMAT=4 \ 22 -DSQLITE_DEFAULT_AUTOVACUUM=1 \ 23 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 \ 24 -DSQLITE_ENABLE_FTS3 \ 25 -DSQLITE_ENABLE_FTS3_BACKWARDS \ 26 -DSQLITE_ENABLE_FTS4 \ 27 -DSQLITE_OMIT_BUILTIN_TEST \ 28 -DSQLITE_OMIT_COMPILEOPTION_DIAGS \ 29 -DSQLITE_OMIT_LOAD_EXTENSION \ 30 -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600 31 32 device_sqlite_flags := $(common_sqlite_flags) \ 33 -DSQLITE_ENABLE_ICU \ 34 -DUSE_PREAD64 \ 35 -Dfdatasync=fdatasync \ 36 -DHAVE_MALLOC_USABLE_SIZE 37 38 host_sqlite_flags := $(common_sqlite_flags) 39 40 common_src_files := sqlite3.c 41 42 # the device library 43 include $(CLEAR_VARS) 44 45 LOCAL_SRC_FILES := $(common_src_files) 46 47 LOCAL_CFLAGS += $(device_sqlite_flags) 48 49 LOCAL_SHARED_LIBRARIES := libdl 50 51 LOCAL_MODULE:= libsqlite 52 53 LOCAL_C_INCLUDES += \ 54 $(call include-path-for, system-core)/cutils \ 55 external/icu/icu4c/source/i18n \ 56 external/icu/icu4c/source/common 57 58 LOCAL_SHARED_LIBRARIES += liblog \ 59 libicuuc \ 60 libicui18n \ 61 libutils \ 62 liblog 63 64 # include android specific methods 65 LOCAL_WHOLE_STATIC_LIBRARIES := libsqlite3_android 66 67 include $(BUILD_SHARED_LIBRARY) 68 69 70 include $(CLEAR_VARS) 71 LOCAL_SRC_FILES := $(common_src_files) 72 LOCAL_LDLIBS += -lpthread -ldl 73 LOCAL_CFLAGS += $(host_sqlite_flags) 74 LOCAL_MODULE:= libsqlite 75 LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host 76 LOCAL_STATIC_LIBRARIES := liblog libutils libcutils 77 78 # include android specific methods 79 LOCAL_WHOLE_STATIC_LIBRARIES := libsqlite3_android 80 include $(BUILD_HOST_SHARED_LIBRARY) 81 82 ## 83 ## 84 ## Build the device command line tool sqlite3 85 ## 86 ## 87 ifneq ($(SDK_ONLY),true) # SDK doesn't need device version of sqlite3 88 89 include $(CLEAR_VARS) 90 91 LOCAL_SRC_FILES := shell.c 92 93 LOCAL_C_INCLUDES := \ 94 $(LOCAL_PATH)/../android \ 95 $(call include-path-for, system-core)/cutils \ 96 external/icu4c/i18n \ 97 external/icu4c/common 98 99 LOCAL_SHARED_LIBRARIES := libsqlite \ 100 libicuuc \ 101 libicui18n \ 102 libutils 103 104 LOCAL_CFLAGS += $(device_sqlite_flags) 105 106 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) 107 108 LOCAL_MODULE_TAGS := debug 109 110 LOCAL_MODULE := sqlite3 111 112 include $(BUILD_EXECUTABLE) 113 114 endif # !SDK_ONLY 115 116 117 ## 118 ## 119 ## Build the host command line tool sqlite3 120 ## 121 ## 122 123 include $(CLEAR_VARS) 124 125 LOCAL_SRC_FILES := $(common_src_files) shell.c 126 127 LOCAL_CFLAGS += $(host_sqlite_flags) \ 128 -DNO_ANDROID_FUNCS=1 129 130 # sqlite3MemsysAlarm uses LOG() 131 LOCAL_STATIC_LIBRARIES += liblog 132 133 ifeq ($(strip $(USE_MINGW)),) 134 LOCAL_LDLIBS += -lpthread 135 ifneq ($(HOST_OS),freebsd) 136 LOCAL_LDLIBS += -ldl 137 endif 138 endif 139 140 LOCAL_MODULE := sqlite3 141 142 include $(BUILD_HOST_EXECUTABLE) 143