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