Home | History | Annotate | Download | only in dicttool
      1 #
      2 # Copyright (C) 2012 The Android Open Source Project
      3 #
      4 # Licensed under the Apache License, Version 2.0 (the "License");
      5 # you may not use this file except in compliance with the License.
      6 # You may obtain a copy of the License at
      7 #
      8 #      http://www.apache.org/licenses/LICENSE-2.0
      9 #
     10 # Unless required by applicable law or agreed to in writing, software
     11 # distributed under the License is distributed on an "AS IS" BASIS,
     12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 # See the License for the specific language governing permissions and
     14 # limitations under the License.
     15 
     16 # Only build if it's explicitly requested, or running mm/mmm.
     17 ifneq ($(ONE_SHOT_MAKEFILE)$(filter $(MAKECMDGOALS),dicttool_aosp),)
     18 
     19 # HACK: Temporarily disable host tool build on Mac until the build system is ready for C++11.
     20 LATINIME_HOST_OSNAME := $(shell uname -s)
     21 ifeq ($(LATINIME_HOST_OSNAME), Darwin) # TODO: Remove this
     22 $(warning dicttool_aosp is not supported on $(LATINIME_HOST_OSNAME))
     23 else # TODO: Remove this
     24 
     25 LATINIME_DICTTOOL_AOSP_LOCAL_PATH := $(call my-dir)
     26 LOCAL_PATH := $(LATINIME_DICTTOOL_AOSP_LOCAL_PATH)
     27 LATINIME_HOST_NATIVE_LIBNAME := liblatinime-aosp-dicttool-host
     28 include $(LOCAL_PATH)/NativeLib.mk
     29 
     30 ######################################
     31 LOCAL_PATH := $(LATINIME_DICTTOOL_AOSP_LOCAL_PATH)
     32 include $(CLEAR_VARS)
     33 
     34 LATINIME_LOCAL_DIR := ../..
     35 LATINIME_BASE_SRC_DIR := $(LATINIME_LOCAL_DIR)/java/src/com/android/inputmethod
     36 LATINIME_BASE_OVERRIDABLE_SRC_DIR := \
     37         $(LATINIME_LOCAL_DIR)/java-overridable/src/com/android/inputmethod
     38 MAKEDICT_CORE_SRC_DIR := $(LATINIME_BASE_SRC_DIR)/latin/makedict
     39 LATINIME_TESTS_SRC_DIR := $(LATINIME_LOCAL_DIR)/tests/src/com/android/inputmethod/latin
     40 
     41 # Dependencies for Dicttool. Most of these files are needed by BinaryDictionary.java. Note that
     42 # a significant part of the dependencies are mocked in the compat/ directory, with empty or
     43 # nearly-empty implementations, for parts that we don't use in Dicttool.
     44 LATINIME_SRC_FILES_FOR_DICTTOOL := \
     45         latin/BinaryDictionary.java \
     46         latin/DicTraverseSession.java \
     47         latin/Dictionary.java \
     48         latin/NgramContext.java \
     49         latin/SuggestedWords.java \
     50         latin/settings/SettingsValuesForSuggestion.java \
     51         latin/utils/BinaryDictionaryUtils.java \
     52         latin/utils/CombinedFormatUtils.java \
     53         latin/utils/JniUtils.java
     54 
     55 LATINIME_OVERRIDABLE_SRC_FILES_FOR_DICTTOOL := \
     56         latin/define/DebugFlags.java
     57 
     58 LATINIME_TEST_SRC_FILES_FOR_DICTTOOL := \
     59         utils/ByteArrayDictBuffer.java
     60 
     61 USED_TARGETED_SRC_FILES := \
     62         $(addprefix $(LATINIME_BASE_SRC_DIR)/, $(LATINIME_SRC_FILES_FOR_DICTTOOL)) \
     63         $(addprefix $(LATINIME_BASE_OVERRIDABLE_SRC_DIR)/, \
     64                 $(LATINIME_OVERRIDABLE_SRC_FILES_FOR_DICTTOOL)) \
     65         $(addprefix $(LATINIME_TESTS_SRC_DIR)/, $(LATINIME_TEST_SRC_FILES_FOR_DICTTOOL))
     66 
     67 DICTTOOL_ONDEVICE_TESTS_DIR := \
     68         $(LATINIME_LOCAL_DIR)/tests/src/com/android/inputmethod/latin/makedict/
     69 DICTTOOL_COMPAT_TESTS_DIR := compat
     70 
     71 LOCAL_MAIN_SRC_FILES := $(call all-java-files-under, $(MAKEDICT_CORE_SRC_DIR))
     72 LOCAL_TOOL_SRC_FILES := $(call all-java-files-under, src)
     73 
     74 LOCAL_SRC_FILES := $(LOCAL_TOOL_SRC_FILES) \
     75         $(filter-out $(addprefix %/, $(notdir $(LOCAL_TOOL_SRC_FILES))), $(LOCAL_MAIN_SRC_FILES)) \
     76         $(USED_TARGETED_SRC_FILES) \
     77         $(call all-java-files-under, \
     78                 tests $(DICTTOOL_COMPAT_TESTS_DIR) $(DICTTOOL_ONDEVICE_TESTS_DIR))
     79 
     80 LOCAL_JAVA_LIBRARIES := junit
     81 LOCAL_STATIC_JAVA_LIBRARIES := jsr305lib latinime-common-host
     82 LOCAL_REQUIRED_MODULES := $(LATINIME_HOST_NATIVE_LIBNAME)
     83 LOCAL_JAR_MANIFEST := etc/manifest.txt
     84 LOCAL_MODULE := dicttool_aosp
     85 
     86 include $(BUILD_HOST_JAVA_LIBRARY)
     87 include $(LOCAL_PATH)/etc/Android.mk
     88 
     89 endif # Darwin - TODO: Remove this
     90 
     91 # Clear our private variables
     92 LATINIME_DICTTOOL_AOSP_LOCAL_PATH :=
     93 LATINIME_LOCAL_DIR :=
     94 LATINIME_HOST_OSNAME :=
     95 
     96 endif
     97