blob: dc48ea8b698bf1ad787c52fb2a056cd1ad822cee [file] [log] [blame]
Adam Lesinski40e8eef2014-09-16 14:43:29 -07001#
2# Copyright (C) 2014 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
17# This tool is prebuilt if we're doing an app-only build.
18ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
19
Adam Lesinski40e8eef2014-09-16 14:43:29 -070020# ==========================================================
21# Setup some common variables for the different build
22# targets here.
23# ==========================================================
24LOCAL_PATH:= $(call my-dir)
25
26main := Main.cpp
27sources := \
28 Abi.cpp \
29 Grouper.cpp \
30 Rule.cpp \
31 RuleGenerator.cpp \
32 SplitDescription.cpp
33
34testSources := \
35 Grouper_test.cpp \
36 Rule_test.cpp \
37 RuleGenerator_test.cpp
38
39cIncludes := \
40 external/zlib \
41 frameworks/base/tools
42
43hostLdLibs :=
44hostStaticLibs := \
45 libaapt \
46 libandroidfw \
47 libpng \
48 liblog \
49 libutils \
50 libcutils \
51 libexpat \
52 libziparchive-host
53
Adam Lesinskic3dc0b52014-11-03 12:05:15 -080054cFlags := -Wall -Werror
Adam Lesinski40e8eef2014-09-16 14:43:29 -070055
56ifeq ($(HOST_OS),linux)
57 hostLdLibs += -lrt -ldl -lpthread
58endif
59
60# Statically link libz for MinGW (Win SDK under Linux),
61# and dynamically link for all others.
62ifneq ($(strip $(USE_MINGW)),)
63 hostStaticLibs += libz
64else
65 hostLdLibs += -lz
66endif
67
68
69# ==========================================================
70# Build the host static library: libsplit-select
71# ==========================================================
72include $(CLEAR_VARS)
73LOCAL_MODULE := libsplit-select
74
75LOCAL_SRC_FILES := $(sources)
76
77LOCAL_C_INCLUDES += $(cIncludes)
78LOCAL_CFLAGS += $(cFlags) -D_DARWIN_UNLIMITED_STREAMS
79
80include $(BUILD_HOST_STATIC_LIBRARY)
81
82
83# ==========================================================
84# Build the host tests: libsplit-select_tests
85# ==========================================================
86include $(CLEAR_VARS)
87LOCAL_MODULE := libsplit-select_tests
88LOCAL_MODULE_TAGS := tests
89
90LOCAL_SRC_FILES := $(testSources)
91
92LOCAL_C_INCLUDES += $(cIncludes)
93LOCAL_STATIC_LIBRARIES += libsplit-select $(hostStaticLibs)
94LOCAL_LDLIBS += $(hostLdLibs)
95LOCAL_CFLAGS += $(cFlags)
96
97include $(BUILD_HOST_NATIVE_TEST)
98
99# ==========================================================
100# Build the host executable: split-select
101# ==========================================================
102include $(CLEAR_VARS)
103LOCAL_MODULE := split-select
104
105LOCAL_SRC_FILES := $(main)
106
107LOCAL_C_INCLUDES += $(cIncludes)
108LOCAL_STATIC_LIBRARIES += libsplit-select $(hostStaticLibs)
109LOCAL_LDLIBS += $(hostLdLibs)
110LOCAL_CFLAGS += $(cFlags)
111
112include $(BUILD_HOST_EXECUTABLE)
113
Adam Lesinski40e8eef2014-09-16 14:43:29 -0700114endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK