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