• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
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_SDK_VERSION := 14
67LOCAL_NDK_STL_VARIANT := c++_static
68
69include $(BUILD_STATIC_LIBRARY)
70######################################
71include $(CLEAR_VARS)
72
73# All code in LOCAL_WHOLE_STATIC_LIBRARIES will be built into this shared library.
74LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_common_static
75
76ifeq ($(FLAG_DO_PROFILE), true)
77    $(warning Making profiling version of native library)
78    LOCAL_LDFLAGS += -llog
79else # FLAG_DO_PROFILE
80ifeq ($(FLAG_DBG), true)
81    $(warning Making debug version of native library)
82    LOCAL_LDFLAGS += -llog
83endif # FLAG_DBG
84endif # FLAG_DO_PROFILE
85
86LOCAL_MODULE := libjni_latinime
87LOCAL_MODULE_TAGS := optional
88
89LOCAL_SDK_VERSION := 14
90LOCAL_NDK_STL_VARIANT := c++_static
91LOCAL_CFLAGS := -Wall -Werror
92LOCAL_LDFLAGS += -ldl
93
94include $(BUILD_SHARED_LIBRARY)
95#################### Clean up the tmp vars
96include $(LOCAL_PATH)/CleanupNativeFileList.mk
97
98#################### Unit test on host environment
99include $(LOCAL_PATH)/HostUnitTests.mk
100
101#################### Unit test on target environment
102include $(LOCAL_PATH)/TargetUnitTests.mk
103//LOCAL_CFLAGS += -Wall -Werror
104