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