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