Home | History | Annotate | Download | only in jni
      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 
     15 LOCAL_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.
     20 FLAG_DBG ?= false
     21 FLAG_DO_PROFILE ?= false
     22 
     23 ######################################
     24 include $(CLEAR_VARS)
     25 
     26 LATIN_IME_SRC_DIR := src
     27 
     28 LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
     29 
     30 LOCAL_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.
     35 LOCAL_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.
     39 ifeq ($(TARGET_ARCH), x86)
     40     LOCAL_CFLAGS += -mstackrealign
     41 endif # x86
     42 
     43 include $(LOCAL_PATH)/NativeFileList.mk
     44 
     45 LOCAL_SRC_FILES := \
     46     $(LATIN_IME_JNI_SRC_FILES) \
     47     $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES))
     48 
     49 ifeq ($(FLAG_DO_PROFILE), true)
     50     $(warning Making profiling version of native library)
     51     LOCAL_CFLAGS += -DFLAG_DO_PROFILE -funwind-tables
     52 else # FLAG_DO_PROFILE
     53 ifeq ($(FLAG_DBG), true)
     54     $(warning Making debug version of native library)
     55     LOCAL_CFLAGS += -DFLAG_DBG -funwind-tables -fno-inline
     56 ifeq ($(FLAG_FULL_DBG), true)
     57     $(warning Making full debug version of native library)
     58     LOCAL_CFLAGS += -DFLAG_FULL_DBG
     59 endif # FLAG_FULL_DBG
     60 endif # FLAG_DBG
     61 endif # FLAG_DO_PROFILE
     62 
     63 LOCAL_MODULE := libjni_latinime_common_static
     64 LOCAL_MODULE_TAGS := optional
     65 
     66 LOCAL_CLANG := true
     67 LOCAL_SDK_VERSION := 14
     68 LOCAL_NDK_STL_VARIANT := c++_static
     69 
     70 include $(BUILD_STATIC_LIBRARY)
     71 ######################################
     72 include $(CLEAR_VARS)
     73 
     74 # All code in LOCAL_WHOLE_STATIC_LIBRARIES will be built into this shared library.
     75 LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_common_static
     76 
     77 ifeq ($(FLAG_DO_PROFILE), true)
     78     $(warning Making profiling version of native library)
     79     LOCAL_LDFLAGS += -llog
     80 else # FLAG_DO_PROFILE
     81 ifeq ($(FLAG_DBG), true)
     82     $(warning Making debug version of native library)
     83     LOCAL_LDFLAGS += -llog
     84 endif # FLAG_DBG
     85 endif # FLAG_DO_PROFILE
     86 
     87 LOCAL_MODULE := libjni_latinime
     88 LOCAL_MODULE_TAGS := optional
     89 
     90 LOCAL_CLANG := true
     91 LOCAL_SDK_VERSION := 14
     92 LOCAL_NDK_STL_VARIANT := c++_static
     93 LOCAL_LDFLAGS += -ldl
     94 
     95 include $(BUILD_SHARED_LIBRARY)
     96 #################### Clean up the tmp vars
     97 include $(LOCAL_PATH)/CleanupNativeFileList.mk
     98 
     99 #################### Unit test on host environment
    100 include $(LOCAL_PATH)/HostUnitTests.mk
    101 
    102 #################### Unit test on target environment
    103 include $(LOCAL_PATH)/TargetUnitTests.mk
    104