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