Android.mk revision 81a48d47d1a6960169fa39edfaa710ffa687721f
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 \
32    -Woverloaded-virtual -Wsign-promo -Wno-system-headers
33
34# To suppress compiler warnings for unused variables/functions used for debug features etc.
35LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
36
37# HACK: -mstackrealign is required for x86 builds running on pre-KitKat devices to avoid crashes
38# with SSE instructions.
39ifeq ($(TARGET_ARCH), x86)
40    LOCAL_CFLAGS += -mstackrealign
41endif # x86
42
43include $(LOCAL_PATH)/NativeFileList.mk
44
45LOCAL_SRC_FILES := \
46    $(LATIN_IME_JNI_SRC_FILES) \
47    $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES))
48
49ifeq ($(FLAG_DO_PROFILE), true)
50    $(warning Making profiling version of native library)
51    LOCAL_CFLAGS += -DFLAG_DO_PROFILE -funwind-tables -fno-inline
52else # FLAG_DO_PROFILE
53ifeq ($(FLAG_DBG), true)
54    $(warning Making debug version of native library)
55    LOCAL_CFLAGS += -DFLAG_DBG -funwind-tables -fno-inline
56ifeq ($(FLAG_FULL_DBG), true)
57    $(warning Making full debug version of native library)
58    LOCAL_CFLAGS += -DFLAG_FULL_DBG
59endif # FLAG_FULL_DBG
60endif # FLAG_DBG
61endif # FLAG_DO_PROFILE
62
63LOCAL_MODULE := libjni_latinime_common_static
64LOCAL_MODULE_TAGS := optional
65
66LOCAL_CLANG := true
67LOCAL_SDK_VERSION := 14
68LOCAL_NDK_STL_VARIANT := c++_static
69
70include $(BUILD_STATIC_LIBRARY)
71######################################
72include $(CLEAR_VARS)
73
74# All code in LOCAL_WHOLE_STATIC_LIBRARIES will be built into this shared library.
75LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_common_static
76
77ifeq ($(FLAG_DO_PROFILE), true)
78    $(warning Making profiling version of native library)
79    LOCAL_LDFLAGS += -llog
80else # FLAG_DO_PROFILE
81ifeq ($(FLAG_DBG), true)
82    $(warning Making debug version of native library)
83    LOCAL_LDFLAGS += -llog
84endif # FLAG_DBG
85endif # FLAG_DO_PROFILE
86
87LOCAL_MODULE := libjni_latinime
88LOCAL_MODULE_TAGS := optional
89
90LOCAL_CLANG := true
91LOCAL_SDK_VERSION := 14
92LOCAL_NDK_STL_VARIANT := c++_static
93LOCAL_LDFLAGS += -ldl -fuse-ld=mcld
94
95include $(BUILD_SHARED_LIBRARY)
96#################### Clean up the tmp vars
97include $(LOCAL_PATH)/CleanupNativeFileList.mk
98
99#################### Unit test on host environment
100include $(LOCAL_PATH)/HostUnitTests.mk
101
102#################### Unit test on target environment
103include $(LOCAL_PATH)/TargetUnitTests.mk
104