• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
13minimal_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 := $(minimal_sqlite_flags) \
33    -DSQLITE_ENABLE_ICU \
34    -DUSE_PREAD64 \
35    -Dfdatasync=fdatasync \
36    -DHAVE_MALLOC_H=1 \
37    -DHAVE_MALLOC_USABLE_SIZE
38
39common_src_files := sqlite3.c
40
41# the device library
42include $(CLEAR_VARS)
43
44LOCAL_SRC_FILES := $(common_src_files)
45
46LOCAL_CFLAGS += $(device_sqlite_flags)
47
48LOCAL_SHARED_LIBRARIES := libdl
49
50LOCAL_MODULE:= libsqlite
51
52LOCAL_C_INCLUDES += $(call include-path-for, system-core)/cutils
53
54LOCAL_SHARED_LIBRARIES += liblog \
55            libicuuc \
56            libicui18n \
57            libutils \
58            liblog
59
60# include android specific methods
61LOCAL_WHOLE_STATIC_LIBRARIES := libsqlite3_android
62
63include $(BUILD_SHARED_LIBRARY)
64
65
66include $(CLEAR_VARS)
67LOCAL_SRC_FILES := $(common_src_files)
68LOCAL_LDLIBS += -lpthread -ldl
69LOCAL_CFLAGS += $(minimal_sqlite_flags)
70LOCAL_MODULE:= libsqlite
71LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host
72LOCAL_STATIC_LIBRARIES := liblog libutils libcutils
73
74# include android specific methods
75LOCAL_WHOLE_STATIC_LIBRARIES := libsqlite3_android
76include $(BUILD_HOST_SHARED_LIBRARY)
77
78##
79##
80## Build the device command line tool sqlite3
81##
82##
83ifneq ($(SDK_ONLY),true)  # SDK doesn't need device version of sqlite3
84
85include $(CLEAR_VARS)
86
87LOCAL_SRC_FILES := shell.c
88
89LOCAL_C_INCLUDES := \
90    $(LOCAL_PATH)/../android \
91    $(call include-path-for, system-core)/cutils
92
93LOCAL_SHARED_LIBRARIES := libsqlite \
94            libicuuc \
95            libicui18n \
96            liblog \
97            libutils
98
99LOCAL_STATIC_LIBRARIES := libicuandroid_utils
100
101LOCAL_CFLAGS += $(device_sqlite_flags)
102
103LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
104
105LOCAL_MODULE_TAGS := debug
106
107LOCAL_MODULE := sqlite3
108
109include $(BUILD_EXECUTABLE)
110
111endif # !SDK_ONLY
112
113
114##
115##
116## Build the host command line tool sqlite3
117##
118##
119
120include $(CLEAR_VARS)
121
122LOCAL_SRC_FILES := $(common_src_files) shell.c
123LOCAL_CFLAGS += $(minimal_sqlite_flags) \
124    -DNO_ANDROID_FUNCS=1
125
126# sqlite3MemsysAlarm uses LOG()
127LOCAL_STATIC_LIBRARIES += liblog
128
129LOCAL_LDLIBS_darwin += -lpthread -ldl
130LOCAL_LDLIBS_linux += -lpthread -ldl
131
132LOCAL_MODULE_HOST_OS := darwin linux windows
133
134LOCAL_MODULE := sqlite3
135
136include $(BUILD_HOST_EXECUTABLE)
137
138# Build a minimal version of sqlite3 without any android specific
139# features against the NDK. This is used by libcore's JDBC related
140# unit tests.
141include $(CLEAR_VARS)
142LOCAL_SRC_FILES := $(common_src_files)
143LOCAL_CFLAGS += $(minimal_sqlite_flags)
144LOCAL_MODULE:= libsqlite_static_minimal
145LOCAL_SDK_VERSION := 23
146include $(BUILD_STATIC_LIBRARY)
147
148# Same as libsqlite_static_minimal, except that this is for the host.
149include $(CLEAR_VARS)
150LOCAL_SRC_FILES := $(common_src_files)
151LOCAL_CFLAGS += $(minimal_sqlite_flags)
152LOCAL_MODULE:= libsqlite_static_minimal
153include $(BUILD_HOST_STATIC_LIBRARY)
154