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