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