Android.mk revision 0336ec4e123f61931bb74a94bc8a920d0883bb77
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_static
19# and the shared library.
20FLAG_DBG ?= false
21FLAG_DO_PROFILE ?= false
22
23######################################
24include $(CLEAR_VARS)
25
26LATIN_IME_SRC_DIR := src
27LATIN_IME_SRC_FULLPATH_DIR := $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
28
29LOCAL_C_INCLUDES += $(LATIN_IME_SRC_FULLPATH_DIR) $(LATIN_IME_SRC_FULLPATH_DIR)/gesture
30
31LOCAL_CFLAGS += -Werror -Wall
32
33# To suppress compiler warnings for unused variables/functions used for debug features etc.
34LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
35
36LATIN_IME_JNI_SRC_FILES := \
37    com_android_inputmethod_keyboard_ProximityInfo.cpp \
38    com_android_inputmethod_latin_BinaryDictionary.cpp \
39    com_android_inputmethod_latin_NativeUtils.cpp \
40    jni_common.cpp
41
42LATIN_IME_CORE_SRC_FILES := \
43    additional_proximity_chars.cpp \
44    basechars.cpp \
45    bigram_dictionary.cpp \
46    char_utils.cpp \
47    correction.cpp \
48    dictionary.cpp \
49    proximity_info.cpp \
50    proximity_info_state.cpp \
51    unigram_dictionary.cpp \
52    gesture/incremental_decoder_interface.cpp
53
54LOCAL_SRC_FILES := \
55    $(LATIN_IME_JNI_SRC_FILES) \
56    $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES))
57
58ifeq ($(FLAG_DO_PROFILE), true)
59    $(warning Making profiling version of native library)
60    LOCAL_CFLAGS += -DFLAG_DO_PROFILE
61else # FLAG_DO_PROFILE
62ifeq ($(FLAG_DBG), true)
63    $(warning Making debug version of native library)
64    LOCAL_CFLAGS += -DFLAG_DBG
65endif # FLAG_DBG
66endif # FLAG_DO_PROFILE
67
68LOCAL_MODULE := libjni_latinime_common_static
69LOCAL_MODULE_TAGS := optional
70
71ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system
72include external/stlport/libstlport.mk
73else # In the NDK build system
74LOCAL_C_INCLUDES += external/stlport/stlport bionic
75endif
76
77include $(BUILD_STATIC_LIBRARY)
78######################################
79include $(CLEAR_VARS)
80
81LOCAL_C_INCLUDES += $(LATIN_IME_SRC_FULLPATH_DIR) \
82    $(addprefix $(LATIN_IME_SRC_FULLPATH_DIR)/, gesture gesture/impl)
83
84LOCAL_CFLAGS += -Werror -Wall
85
86# To suppress compiler warnings for unused variables/functions used for debug features etc.
87LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
88
89LATIN_IME_GESTURE_IMPL_SRC_FILES := \
90    gesture/impl/gesture_decoder_impl.cpp \
91    gesture/impl/incremental_decoder_impl.cpp \
92    gesture/impl/token_beam_impl.cpp \
93    gesture/impl/token_impl.cpp
94
95LOCAL_SRC_FILES := $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_GESTURE_IMPL_SRC_FILES))
96
97ifeq ($(FLAG_DO_PROFILE), true)
98    $(warning Making profiling version of native library)
99    LOCAL_CFLAGS += -DFLAG_DO_PROFILE
100else # FLAG_DO_PROFILE
101ifeq ($(FLAG_DBG), true)
102    $(warning Making debug version of native library)
103    LOCAL_CFLAGS += -DFLAG_DBG
104endif # FLAG_DBG
105endif # FLAG_DO_PROFILE
106
107# TODO: Can remove this static library from AOSP completely?
108LOCAL_MODULE := libjni_latinime_gesture_impl_aosp_static
109LOCAL_MODULE_TAGS := optional
110
111ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system
112include external/stlport/libstlport.mk
113else # In the NDK build system
114LOCAL_C_INCLUDES += external/stlport/stlport bionic
115endif
116
117include $(BUILD_STATIC_LIBRARY)
118######################################
119include $(CLEAR_VARS)
120
121# All code in LOCAL_WHOLE_STATIC_LIBRARIES will be built into this shared library.
122LOCAL_WHOLE_STATIC_LIBRARIES := \
123    libjni_latinime_common_static libjni_latinime_gesture_impl_aosp_static
124
125ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system
126LOCAL_SHARED_LIBRARIES := libstlport
127else # In the NDK build system
128LOCAL_SHARED_LIBRARIES := libstlport_static
129endif
130
131ifeq ($(FLAG_DO_PROFILE), true)
132    $(warning Making profiling version of native library)
133    LOCAL_SHARED_LIBRARIES += libcutils libutils
134else # FLAG_DO_PROFILE
135ifeq ($(FLAG_DBG), true)
136    $(warning Making debug version of native library)
137    LOCAL_SHARED_LIBRARIES += libcutils libutils
138endif # FLAG_DBG
139endif # FLAG_DO_PROFILE
140
141LOCAL_MODULE := libjni_latinime
142LOCAL_MODULE_TAGS := optional
143
144ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system
145include external/stlport/libstlport.mk
146endif
147
148include $(BUILD_SHARED_LIBRARY)
149
150#################### Clean up the tmp vars
151LATIN_IME_CORE_SRC_FILES :=
152LATIN_IME_JNI_SRC_FILES :=
153LATIN_IME_GESTURE_IMPL_SRC_FILES :=
154LATIN_IME_SRC_DIR :=
155LATIN_IME_SRC_FULLPATH_DIR :=
156