Android.mk revision 2b1dd6e2532ee041248c3f7c48f28d789713b18b
1# Copyright (C) 2011 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16
17############ some local flags
18# If you change any of those flags, you need to rebuild both libjni_latinime_common_static
19# and the shared library that uses libjni_latinime_common_static.
20FLAG_DBG ?= false
21FLAG_DO_PROFILE ?= false
22
23######################################
24include $(CLEAR_VARS)
25
26LATIN_IME_SRC_DIR := src
27
28LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
29
30LOCAL_CFLAGS += -Werror -Wall -Wextra -Weffc++ -Wformat=2 -Wcast-qual -Wcast-align \
31    -Wwrite-strings -Wfloat-equal -Wpointer-arith -Winit-self -Wredundant-decls -Wno-system-headers
32
33ifeq ($(TARGET_ARCH), arm)
34ifeq ($(TARGET_GCC_VERSION), 4.6)
35LOCAL_CFLAGS += -Winline
36endif # TARGET_GCC_VERSION
37endif # TARGET_ARCH
38
39# To suppress compiler warnings for unused variables/functions used for debug features etc.
40LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
41
42LATIN_IME_JNI_SRC_FILES := \
43    com_android_inputmethod_keyboard_ProximityInfo.cpp \
44    com_android_inputmethod_latin_BinaryDictionary.cpp \
45    com_android_inputmethod_latin_DicTraverseSession.cpp \
46    jni_common.cpp
47
48LATIN_IME_CORE_SRC_FILES := \
49    suggest/core/suggest.cpp \
50    $(addprefix suggest/core/dicnode/, \
51        dic_node.cpp \
52        dic_node_utils.cpp \
53        dic_nodes_cache.cpp) \
54    $(addprefix suggest/core/dictionary/, \
55        bigram_dictionary.cpp \
56        binary_dictionary_format_utils.cpp \
57        binary_dictionary_header.cpp \
58        binary_dictionary_header_reading_utils.cpp \
59        binary_dictionary_terminal_attributes_reading_utils.cpp \
60        bloom_filter.cpp \
61        byte_array_utils.cpp \
62        dictionary.cpp \
63        digraph_utils.cpp \
64        multi_bigram_map.cpp) \
65    $(addprefix suggest/core/layout/, \
66        additional_proximity_chars.cpp \
67        proximity_info.cpp \
68        proximity_info_params.cpp \
69        proximity_info_state.cpp \
70        proximity_info_state_utils.cpp) \
71    suggest/core/policy/weighting.cpp \
72    suggest/core/session/dic_traverse_session.cpp \
73    $(addprefix suggest/policyimpl/dictionary/, \
74        dynamic_patricia_trie_node_reader.cpp \
75        dynamic_patricia_trie_policy.cpp \
76        dynamic_patricia_trie_reading_utils.cpp \
77        patricia_trie_policy.cpp \
78        patricia_trie_reading_utils.cpp) \
79    suggest/policyimpl/gesture/gesture_suggest_policy_factory.cpp \
80    $(addprefix suggest/policyimpl/typing/, \
81        scoring_params.cpp \
82        typing_scoring.cpp \
83        typing_suggest_policy.cpp \
84        typing_traversal.cpp \
85        typing_weighting.cpp) \
86    $(addprefix utils/, \
87        autocorrection_threshold_utils.cpp \
88        char_utils.cpp \
89        log_utils.cpp)
90
91LOCAL_SRC_FILES := \
92    $(LATIN_IME_JNI_SRC_FILES) \
93    $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES))
94
95ifeq ($(FLAG_DO_PROFILE), true)
96    $(warning Making profiling version of native library)
97    LOCAL_CFLAGS += -DFLAG_DO_PROFILE -funwind-tables -fno-inline
98else # FLAG_DO_PROFILE
99ifeq ($(FLAG_DBG), true)
100    $(warning Making debug version of native library)
101    LOCAL_CFLAGS += -DFLAG_DBG -funwind-tables -fno-inline
102ifeq ($(FLAG_FULL_DBG), true)
103    $(warning Making full debug version of native library)
104    LOCAL_CFLAGS += -DFLAG_FULL_DBG
105endif # FLAG_FULL_DBG
106endif # FLAG_DBG
107endif # FLAG_DO_PROFILE
108
109LOCAL_MODULE := libjni_latinime_common_static
110LOCAL_MODULE_TAGS := optional
111
112LOCAL_SDK_VERSION := 14
113LOCAL_NDK_STL_VARIANT := stlport_static
114
115include $(BUILD_STATIC_LIBRARY)
116######################################
117include $(CLEAR_VARS)
118
119# All code in LOCAL_WHOLE_STATIC_LIBRARIES will be built into this shared library.
120LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_common_static
121
122ifeq ($(FLAG_DO_PROFILE), true)
123    $(warning Making profiling version of native library)
124    LOCAL_LDFLAGS += -llog
125else # FLAG_DO_PROFILE
126ifeq ($(FLAG_DBG), true)
127    $(warning Making debug version of native library)
128    LOCAL_LDFLAGS += -llog
129endif # FLAG_DBG
130endif # FLAG_DO_PROFILE
131
132LOCAL_MODULE := libjni_latinime
133LOCAL_MODULE_TAGS := optional
134
135LOCAL_SDK_VERSION := 14
136LOCAL_NDK_STL_VARIANT := stlport_static
137LOCAL_LDFLAGS += -ldl
138
139include $(BUILD_SHARED_LIBRARY)
140
141#################### Clean up the tmp vars
142LATIN_IME_CORE_SRC_FILES :=
143LATIN_IME_JNI_SRC_FILES :=
144LATIN_IME_SRC_DIR :=
145