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.
17ifneq ($(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.
20LATINIME_HOST_OSNAME := $(shell uname -s)
21ifeq ($(LATINIME_HOST_OSNAME), Darwin) # TODO: Remove this
22$(warning dicttool_aosp is not supported on $(LATINIME_HOST_OSNAME))
23else # TODO: Remove this
24
25LATINIME_DICTTOOL_AOSP_LOCAL_PATH := $(call my-dir)
26LOCAL_PATH := $(LATINIME_DICTTOOL_AOSP_LOCAL_PATH)
27LATINIME_HOST_NATIVE_LIBNAME := liblatinime-aosp-dicttool-host
28include $(LOCAL_PATH)/NativeLib.mk
29
30######################################
31LOCAL_PATH := $(LATINIME_DICTTOOL_AOSP_LOCAL_PATH)
32include $(CLEAR_VARS)
33
34LATINIME_LOCAL_DIR := ../..
35LATINIME_BASE_SRC_DIR := $(LATINIME_LOCAL_DIR)/java/src/com/android/inputmethod
36LATINIME_BASE_OVERRIDABLE_SRC_DIR := \
37        $(LATINIME_LOCAL_DIR)/java-overridable/src/com/android/inputmethod
38MAKEDICT_CORE_SRC_DIR := $(LATINIME_BASE_SRC_DIR)/latin/makedict
39LATINIME_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.
44LATINIME_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
55LATINIME_OVERRIDABLE_SRC_FILES_FOR_DICTTOOL := \
56        latin/define/DebugFlags.java
57
58LATINIME_TEST_SRC_FILES_FOR_DICTTOOL := \
59        utils/ByteArrayDictBuffer.java
60
61USED_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
67DICTTOOL_ONDEVICE_TESTS_DIR := \
68        $(LATINIME_LOCAL_DIR)/tests/src/com/android/inputmethod/latin/makedict/
69DICTTOOL_COMPAT_TESTS_DIR := compat
70
71LOCAL_MAIN_SRC_FILES := $(call all-java-files-under, $(MAKEDICT_CORE_SRC_DIR))
72LOCAL_TOOL_SRC_FILES := $(call all-java-files-under, src)
73
74LOCAL_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
80LOCAL_JAVA_LIBRARIES := junit
81LOCAL_STATIC_JAVA_LIBRARIES := jsr305lib latinime-common-host
82LOCAL_REQUIRED_MODULES := $(LATINIME_HOST_NATIVE_LIBNAME)
83LOCAL_JAR_MANIFEST := etc/manifest.txt
84LOCAL_MODULE := dicttool_aosp
85
86include $(BUILD_HOST_JAVA_LIBRARY)
87include $(LOCAL_PATH)/etc/Android.mk
88
89endif # Darwin - TODO: Remove this
90
91# Clear our private variables
92LATINIME_DICTTOOL_AOSP_LOCAL_PATH :=
93LATINIME_LOCAL_DIR :=
94LATINIME_HOST_OSNAME :=
95
96endif
97