Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2015 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 | # ========================================================== |
| 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 | BigBuffer.cpp \ |
| 29 | BinaryResourceParser.cpp \ |
Adam Lesinski | 769de98 | 2015-04-10 19:43:55 -0700 | [diff] [blame] | 30 | BinaryXmlPullParser.cpp \ |
Adam Lesinski | 4d3a987 | 2015-04-09 19:53:22 -0700 | [diff] [blame] | 31 | BindingXmlPullParser.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 32 | ConfigDescription.cpp \ |
| 33 | Files.cpp \ |
Adam Lesinski | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 34 | Flag.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 35 | JavaClassGenerator.cpp \ |
| 36 | Linker.cpp \ |
| 37 | Locale.cpp \ |
| 38 | Logger.cpp \ |
| 39 | ManifestParser.cpp \ |
| 40 | ManifestValidator.cpp \ |
Adam Lesinski | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 41 | Png.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 42 | ResChunkPullParser.cpp \ |
| 43 | Resolver.cpp \ |
| 44 | Resource.cpp \ |
| 45 | ResourceParser.cpp \ |
| 46 | ResourceTable.cpp \ |
| 47 | ResourceValues.cpp \ |
| 48 | SdkConstants.cpp \ |
| 49 | StringPool.cpp \ |
| 50 | TableFlattener.cpp \ |
| 51 | Util.cpp \ |
| 52 | ScopedXmlPullParser.cpp \ |
| 53 | SourceXmlPullParser.cpp \ |
| 54 | XliffXmlPullParser.cpp \ |
Adam Lesinski | 769de98 | 2015-04-10 19:43:55 -0700 | [diff] [blame] | 55 | XmlFlattener.cpp \ |
| 56 | ZipEntry.cpp \ |
| 57 | ZipFile.cpp |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 58 | |
| 59 | testSources := \ |
| 60 | BigBuffer_test.cpp \ |
Adam Lesinski | 4d3a987 | 2015-04-09 19:53:22 -0700 | [diff] [blame] | 61 | BindingXmlPullParser_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 62 | Compat_test.cpp \ |
| 63 | ConfigDescription_test.cpp \ |
| 64 | JavaClassGenerator_test.cpp \ |
| 65 | Linker_test.cpp \ |
| 66 | Locale_test.cpp \ |
| 67 | ManifestParser_test.cpp \ |
| 68 | Maybe_test.cpp \ |
Adam Lesinski | 769de98 | 2015-04-10 19:43:55 -0700 | [diff] [blame] | 69 | NameMangler_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 70 | ResourceParser_test.cpp \ |
| 71 | Resource_test.cpp \ |
| 72 | ResourceTable_test.cpp \ |
| 73 | ScopedXmlPullParser_test.cpp \ |
| 74 | StringPiece_test.cpp \ |
| 75 | StringPool_test.cpp \ |
| 76 | Util_test.cpp \ |
| 77 | XliffXmlPullParser_test.cpp \ |
| 78 | XmlFlattener_test.cpp |
| 79 | |
Adam Lesinski | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 80 | cIncludes := \ |
| 81 | external/libpng \ |
| 82 | external/libz |
| 83 | |
Adam Lesinski | feefeb4 | 2015-04-03 12:44:40 -0700 | [diff] [blame] | 84 | hostLdLibs := |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 85 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 86 | hostStaticLibs := \ |
| 87 | libandroidfw \ |
| 88 | libutils \ |
| 89 | liblog \ |
| 90 | libcutils \ |
| 91 | libexpat \ |
Adam Lesinski | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 92 | libziparchive-host \ |
Narayan Kamath | 231e054 | 2015-04-29 16:32:23 +0100 | [diff] [blame^] | 93 | libpng \ |
| 94 | libbase |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 95 | |
Adam Lesinski | feefeb4 | 2015-04-03 12:44:40 -0700 | [diff] [blame] | 96 | ifneq ($(strip $(USE_MINGW)),) |
| 97 | hostStaticLibs += libz |
| 98 | else |
| 99 | hostLdLibs += -lz |
| 100 | endif |
| 101 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 102 | cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG |
| 103 | cppFlags := -std=c++11 -Wno-missing-field-initializers |
| 104 | |
| 105 | # ========================================================== |
| 106 | # Build the host static library: libaapt2 |
| 107 | # ========================================================== |
| 108 | include $(CLEAR_VARS) |
| 109 | LOCAL_MODULE := libaapt2 |
| 110 | |
| 111 | LOCAL_SRC_FILES := $(sources) |
| 112 | LOCAL_C_INCLUDES += $(cIncludes) |
| 113 | LOCAL_CFLAGS += $(cFlags) |
| 114 | LOCAL_CPPFLAGS += $(cppFlags) |
| 115 | |
| 116 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 117 | |
| 118 | |
| 119 | # ========================================================== |
| 120 | # Build the host tests: libaapt2_tests |
| 121 | # ========================================================== |
| 122 | include $(CLEAR_VARS) |
| 123 | LOCAL_MODULE := libaapt2_tests |
| 124 | LOCAL_MODULE_TAGS := tests |
| 125 | |
| 126 | LOCAL_SRC_FILES := $(testSources) |
| 127 | |
| 128 | LOCAL_C_INCLUDES += $(cIncludes) |
| 129 | LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) |
| 130 | LOCAL_LDLIBS += $(hostLdLibs) |
| 131 | LOCAL_CFLAGS += $(cFlags) |
| 132 | LOCAL_CPPFLAGS += $(cppFlags) |
| 133 | |
| 134 | include $(BUILD_HOST_NATIVE_TEST) |
| 135 | |
| 136 | # ========================================================== |
| 137 | # Build the host executable: aapt2 |
| 138 | # ========================================================== |
| 139 | include $(CLEAR_VARS) |
| 140 | LOCAL_MODULE := aapt2 |
| 141 | |
| 142 | LOCAL_SRC_FILES := $(main) |
| 143 | |
| 144 | LOCAL_C_INCLUDES += $(cIncludes) |
| 145 | LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) |
| 146 | LOCAL_LDLIBS += $(hostLdLibs) |
| 147 | LOCAL_CFLAGS += $(cFlags) |
| 148 | LOCAL_CPPFLAGS += $(cppFlags) |
| 149 | |
| 150 | include $(BUILD_HOST_EXECUTABLE) |
| 151 | |
| 152 | endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK |