1##
2##
3## Build the library
4##
5##
6
7LOCAL_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
13common_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
32device_sqlite_flags := $(common_sqlite_flags) \
33    -DSQLITE_ENABLE_ICU \
34    -DUSE_PREAD64 \
35    -Dfdatasync=fdatasync \
36    -DHAVE_MALLOC_USABLE_SIZE
37
38host_sqlite_flags := $(common_sqlite_flags)
39
40common_src_files := sqlite3.c
41
42# the device library
43include $(CLEAR_VARS)
44
45LOCAL_SRC_FILES := $(common_src_files)
46
47LOCAL_CFLAGS += $(device_sqlite_flags)
48
49LOCAL_SHARED_LIBRARIES := libdl
50
51LOCAL_MODULE:= libsqlite
52
53LOCAL_C_INCLUDES += \
54    $(call include-path-for, system-core)/cutils \
55    external/icu/icu4c/source/i18n \
56    external/icu/icu4c/source/common
57
58LOCAL_SHARED_LIBRARIES += liblog \
59            libicuuc \
60            libicui18n \
61            libutils \
62            liblog
63
64# include android specific methods
65LOCAL_WHOLE_STATIC_LIBRARIES := libsqlite3_android
66
67include $(BUILD_SHARED_LIBRARY)
68
69
70include $(CLEAR_VARS)
71LOCAL_SRC_FILES := $(common_src_files)
72LOCAL_LDLIBS += -lpthread -ldl
73LOCAL_CFLAGS += $(host_sqlite_flags)
74LOCAL_MODULE:= libsqlite
75LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host
76LOCAL_STATIC_LIBRARIES := liblog libutils libcutils
77
78# include android specific methods
79LOCAL_WHOLE_STATIC_LIBRARIES := libsqlite3_android
80include $(BUILD_HOST_SHARED_LIBRARY)
81
82##
83##
84## Build the device command line tool sqlite3
85##
86##
87ifneq ($(SDK_ONLY),true)  # SDK doesn't need device version of sqlite3
88
89include $(CLEAR_VARS)
90
91LOCAL_SRC_FILES := shell.c
92
93LOCAL_C_INCLUDES := \
94    $(LOCAL_PATH)/../android \
95    $(call include-path-for, system-core)/cutils \
96    external/icu4c/i18n \
97    external/icu4c/common
98
99LOCAL_SHARED_LIBRARIES := libsqlite \
100            libicuuc \
101            libicui18n \
102            libutils
103
104LOCAL_CFLAGS += $(device_sqlite_flags)
105
106LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
107
108LOCAL_MODULE_TAGS := debug
109
110LOCAL_MODULE := sqlite3
111
112include $(BUILD_EXECUTABLE)
113
114endif # !SDK_ONLY
115
116
117##
118##
119## Build the host command line tool sqlite3
120##
121##
122
123include $(CLEAR_VARS)
124
125LOCAL_SRC_FILES := $(common_src_files) shell.c
126
127LOCAL_CFLAGS += $(host_sqlite_flags) \
128    -DNO_ANDROID_FUNCS=1
129
130# sqlite3MemsysAlarm uses LOG()
131LOCAL_STATIC_LIBRARIES += liblog
132
133ifeq ($(strip $(USE_MINGW)),)
134LOCAL_LDLIBS += -lpthread
135ifneq ($(HOST_OS),freebsd)
136LOCAL_LDLIBS += -ldl
137endif
138endif
139
140LOCAL_MODULE := sqlite3
141
142include $(BUILD_HOST_EXECUTABLE)
143