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