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