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 := \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 28 | compile/IdAssigner.cpp \ |
| 29 | compile/Png.cpp \ |
Adam Lesinski | 393b5f0 | 2015-12-17 13:03:11 -0800 | [diff] [blame] | 30 | compile/PseudolocaleGenerator.cpp \ |
| 31 | compile/Pseudolocalizer.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 32 | compile/XmlIdCollector.cpp \ |
Adam Lesinski | 6a00817 | 2016-02-02 17:02:58 -0800 | [diff] [blame] | 33 | filter/ConfigFilter.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 34 | flatten/Archive.cpp \ |
| 35 | flatten/TableFlattener.cpp \ |
| 36 | flatten/XmlFlattener.cpp \ |
Adam Lesinski | a6fe345 | 2015-12-09 15:20:52 -0800 | [diff] [blame] | 37 | io/FileSystem.cpp \ |
| 38 | io/ZipArchive.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 39 | link/AutoVersioner.cpp \ |
Adam Lesinski | 2ae4a87 | 2015-11-02 16:10:55 -0800 | [diff] [blame] | 40 | link/ManifestFixer.cpp \ |
Adam Lesinski | e4bb9eb | 2016-02-12 22:18:51 -0800 | [diff] [blame^] | 41 | link/ProductFilter.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 42 | link/PrivateAttributeMover.cpp \ |
| 43 | link/ReferenceLinker.cpp \ |
| 44 | link/TableMerger.cpp \ |
| 45 | link/XmlReferenceLinker.cpp \ |
| 46 | process/SymbolTable.cpp \ |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 47 | proto/ProtoHelpers.cpp \ |
| 48 | proto/TableProtoDeserializer.cpp \ |
| 49 | proto/TableProtoSerializer.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 50 | unflatten/BinaryResourceParser.cpp \ |
| 51 | unflatten/ResChunkPullParser.cpp \ |
| 52 | util/BigBuffer.cpp \ |
| 53 | util/Files.cpp \ |
| 54 | util/Util.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 55 | ConfigDescription.cpp \ |
Adam Lesinski | 330edcd | 2015-05-04 17:40:56 -0700 | [diff] [blame] | 56 | Debug.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 57 | Flags.cpp \ |
Adam Lesinski | ca5638f | 2015-10-21 14:42:43 -0700 | [diff] [blame] | 58 | java/AnnotationProcessor.cpp \ |
| 59 | java/JavaClassGenerator.cpp \ |
| 60 | java/ManifestClassGenerator.cpp \ |
| 61 | java/ProguardRules.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 62 | Locale.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 63 | Resource.cpp \ |
| 64 | ResourceParser.cpp \ |
| 65 | ResourceTable.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 66 | ResourceUtils.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 67 | ResourceValues.cpp \ |
| 68 | SdkConstants.cpp \ |
| 69 | StringPool.cpp \ |
Adam Lesinski | 467f171 | 2015-11-16 17:35:44 -0800 | [diff] [blame] | 70 | xml/XmlDom.cpp \ |
| 71 | xml/XmlPullParser.cpp \ |
| 72 | xml/XmlUtil.cpp |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 73 | |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 74 | sources += Format.proto |
| 75 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 76 | testSources := \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 77 | compile/IdAssigner_test.cpp \ |
Adam Lesinski | 393b5f0 | 2015-12-17 13:03:11 -0800 | [diff] [blame] | 78 | compile/PseudolocaleGenerator_test.cpp \ |
| 79 | compile/Pseudolocalizer_test.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 80 | compile/XmlIdCollector_test.cpp \ |
Adam Lesinski | 6a00817 | 2016-02-02 17:02:58 -0800 | [diff] [blame] | 81 | filter/ConfigFilter_test.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 82 | flatten/TableFlattener_test.cpp \ |
| 83 | flatten/XmlFlattener_test.cpp \ |
| 84 | link/AutoVersioner_test.cpp \ |
Adam Lesinski | 2ae4a87 | 2015-11-02 16:10:55 -0800 | [diff] [blame] | 85 | link/ManifestFixer_test.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 86 | link/PrivateAttributeMover_test.cpp \ |
Adam Lesinski | e4bb9eb | 2016-02-12 22:18:51 -0800 | [diff] [blame^] | 87 | link/ProductFilter_test.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 88 | link/ReferenceLinker_test.cpp \ |
| 89 | link/TableMerger_test.cpp \ |
| 90 | link/XmlReferenceLinker_test.cpp \ |
| 91 | process/SymbolTable_test.cpp \ |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 92 | proto/TableProtoSerializer_test.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 93 | util/BigBuffer_test.cpp \ |
| 94 | util/Maybe_test.cpp \ |
| 95 | util/StringPiece_test.cpp \ |
| 96 | util/Util_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 97 | ConfigDescription_test.cpp \ |
Adam Lesinski | b274e35 | 2015-11-06 15:14:35 -0800 | [diff] [blame] | 98 | java/AnnotationProcessor_test.cpp \ |
Adam Lesinski | ca5638f | 2015-10-21 14:42:43 -0700 | [diff] [blame] | 99 | java/JavaClassGenerator_test.cpp \ |
| 100 | java/ManifestClassGenerator_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 101 | Locale_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 102 | Resource_test.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 103 | ResourceParser_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 104 | ResourceTable_test.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 105 | ResourceUtils_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 106 | StringPool_test.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 107 | ValueVisitor_test.cpp \ |
Adam Lesinski | 467f171 | 2015-11-16 17:35:44 -0800 | [diff] [blame] | 108 | xml/XmlDom_test.cpp \ |
| 109 | xml/XmlPullParser_test.cpp \ |
| 110 | xml/XmlUtil_test.cpp |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 111 | |
| 112 | toolSources := \ |
| 113 | compile/Compile.cpp \ |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 114 | dump/Dump.cpp \ |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 115 | link/Link.cpp |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 116 | |
Adam Lesinski | feefeb4 | 2015-04-03 12:44:40 -0700 | [diff] [blame] | 117 | hostLdLibs := |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 118 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 119 | hostStaticLibs := \ |
| 120 | libandroidfw \ |
| 121 | libutils \ |
| 122 | liblog \ |
| 123 | libcutils \ |
| 124 | libexpat \ |
Adam Lesinski | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 125 | libziparchive-host \ |
Narayan Kamath | 231e054 | 2015-04-29 16:32:23 +0100 | [diff] [blame] | 126 | libpng \ |
| 127 | libbase |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 128 | |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 129 | hostSharedLibs := \ |
| 130 | libprotobuf-cpp-lite |
| 131 | |
Adam Lesinski | feefeb4 | 2015-04-03 12:44:40 -0700 | [diff] [blame] | 132 | ifneq ($(strip $(USE_MINGW)),) |
| 133 | hostStaticLibs += libz |
| 134 | else |
| 135 | hostLdLibs += -lz |
| 136 | endif |
| 137 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 138 | cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG |
Adam Lesinski | 2ae4a87 | 2015-11-02 16:10:55 -0800 | [diff] [blame] | 139 | cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 140 | protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST) |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 141 | |
| 142 | # ========================================================== |
| 143 | # Build the host static library: libaapt2 |
| 144 | # ========================================================== |
| 145 | include $(CLEAR_VARS) |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 146 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 147 | LOCAL_MODULE := libaapt2 |
| 148 | |
| 149 | LOCAL_SRC_FILES := $(sources) |
Elliott Hughes | 51348d2 | 2015-07-21 11:39:21 -0700 | [diff] [blame] | 150 | LOCAL_STATIC_LIBRARIES += $(hostStaticLibs) |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 151 | LOCAL_CFLAGS += $(cFlags) |
| 152 | LOCAL_CPPFLAGS += $(cppFlags) |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 153 | LOCAL_C_INCLUDES += $(protoIncludes) |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 154 | |
| 155 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 156 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 157 | # ========================================================== |
| 158 | # Build the host tests: libaapt2_tests |
| 159 | # ========================================================== |
| 160 | include $(CLEAR_VARS) |
| 161 | LOCAL_MODULE := libaapt2_tests |
| 162 | LOCAL_MODULE_TAGS := tests |
| 163 | |
| 164 | LOCAL_SRC_FILES := $(testSources) |
| 165 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 166 | LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 167 | LOCAL_SHARED_LIBRARIES += $(hostSharedLibs) |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 168 | LOCAL_LDLIBS += $(hostLdLibs) |
| 169 | LOCAL_CFLAGS += $(cFlags) |
| 170 | LOCAL_CPPFLAGS += $(cppFlags) |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 171 | LOCAL_C_INCLUDES += $(protoIncludes) |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 172 | |
| 173 | include $(BUILD_HOST_NATIVE_TEST) |
| 174 | |
| 175 | # ========================================================== |
| 176 | # Build the host executable: aapt2 |
| 177 | # ========================================================== |
| 178 | include $(CLEAR_VARS) |
| 179 | LOCAL_MODULE := aapt2 |
| 180 | |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 181 | LOCAL_SRC_FILES := $(main) $(toolSources) |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 182 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 183 | LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 184 | LOCAL_SHARED_LIBRARIES += $(hostSharedLibs) |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 185 | LOCAL_LDLIBS += $(hostLdLibs) |
| 186 | LOCAL_CFLAGS += $(cFlags) |
| 187 | LOCAL_CPPFLAGS += $(cppFlags) |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 188 | LOCAL_C_INCLUDES += $(protoIncludes) |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 189 | |
| 190 | include $(BUILD_HOST_EXECUTABLE) |
| 191 | |
| 192 | endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK |