blob: 013e570fc35e016a92ee11ced57fb1b1647f3e65 [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 \
Adam Lesinski42eea272015-01-15 17:01:39 -080032 SplitDescription.cpp \
33 SplitSelector.cpp
Adam Lesinski40e8eef2014-09-16 14:43:29 -070034
35testSources := \
36 Grouper_test.cpp \
37 Rule_test.cpp \
Adam Lesinskidcdfe9f2014-11-06 12:54:36 -080038 RuleGenerator_test.cpp \
Adam Lesinski42eea272015-01-15 17:01:39 -080039 SplitSelector_test.cpp \
Adam Lesinskidcdfe9f2014-11-06 12:54:36 -080040 TestRules.cpp
Adam Lesinski40e8eef2014-09-16 14:43:29 -070041
42cIncludes := \
43 external/zlib \
44 frameworks/base/tools
45
46hostLdLibs :=
47hostStaticLibs := \
48 libaapt \
49 libandroidfw \
50 libpng \
51 liblog \
52 libutils \
53 libcutils \
54 libexpat \
55 libziparchive-host
56
Adam Lesinskic3dc0b52014-11-03 12:05:15 -080057cFlags := -Wall -Werror
Adam Lesinski40e8eef2014-09-16 14:43:29 -070058
59ifeq ($(HOST_OS),linux)
60 hostLdLibs += -lrt -ldl -lpthread
61endif
62
63# Statically link libz for MinGW (Win SDK under Linux),
64# and dynamically link for all others.
65ifneq ($(strip $(USE_MINGW)),)
66 hostStaticLibs += libz
67else
68 hostLdLibs += -lz
69endif
70
71
72# ==========================================================
73# Build the host static library: libsplit-select
74# ==========================================================
75include $(CLEAR_VARS)
76LOCAL_MODULE := libsplit-select
77
78LOCAL_SRC_FILES := $(sources)
79
80LOCAL_C_INCLUDES += $(cIncludes)
81LOCAL_CFLAGS += $(cFlags) -D_DARWIN_UNLIMITED_STREAMS
82
83include $(BUILD_HOST_STATIC_LIBRARY)
84
85
86# ==========================================================
87# Build the host tests: libsplit-select_tests
88# ==========================================================
89include $(CLEAR_VARS)
90LOCAL_MODULE := libsplit-select_tests
91LOCAL_MODULE_TAGS := tests
92
93LOCAL_SRC_FILES := $(testSources)
94
95LOCAL_C_INCLUDES += $(cIncludes)
96LOCAL_STATIC_LIBRARIES += libsplit-select $(hostStaticLibs)
97LOCAL_LDLIBS += $(hostLdLibs)
98LOCAL_CFLAGS += $(cFlags)
99
100include $(BUILD_HOST_NATIVE_TEST)
101
102# ==========================================================
103# Build the host executable: split-select
104# ==========================================================
105include $(CLEAR_VARS)
106LOCAL_MODULE := split-select
107
108LOCAL_SRC_FILES := $(main)
109
110LOCAL_C_INCLUDES += $(cIncludes)
111LOCAL_STATIC_LIBRARIES += libsplit-select $(hostStaticLibs)
112LOCAL_LDLIBS += $(hostLdLibs)
113LOCAL_CFLAGS += $(cFlags)
114
115include $(BUILD_HOST_EXECUTABLE)
116
Adam Lesinski40e8eef2014-09-16 14:43:29 -0700117endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK