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 := \ |
| 28 | BigBuffer.cpp \ |
| 29 | BinaryResourceParser.cpp \ |
Adam Lesinski | 4d3a987 | 2015-04-09 19:53:22 -0700 | [diff] [blame] | 30 | BindingXmlPullParser.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 31 | ConfigDescription.cpp \ |
Adam Lesinski | 330edcd | 2015-05-04 17:40:56 -0700 | [diff] [blame] | 32 | Debug.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 33 | Files.cpp \ |
Adam Lesinski | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 34 | Flag.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 35 | JavaClassGenerator.cpp \ |
| 36 | Linker.cpp \ |
| 37 | Locale.cpp \ |
| 38 | Logger.cpp \ |
Adam Lesinski | 8c831ca | 2015-05-20 15:24:01 -0700 | [diff] [blame] | 39 | ManifestMerger.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 40 | ManifestParser.cpp \ |
| 41 | ManifestValidator.cpp \ |
Adam Lesinski | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 42 | Png.cpp \ |
Adam Lesinski | a1ad4a8 | 2015-06-08 11:41:09 -0700 | [diff] [blame] | 43 | ProguardRules.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 44 | ResChunkPullParser.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 45 | Resource.cpp \ |
| 46 | ResourceParser.cpp \ |
| 47 | ResourceTable.cpp \ |
Adam Lesinski | 24aad16 | 2015-04-24 19:19:30 -0700 | [diff] [blame] | 48 | ResourceTableResolver.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 49 | ResourceValues.cpp \ |
| 50 | SdkConstants.cpp \ |
| 51 | StringPool.cpp \ |
| 52 | TableFlattener.cpp \ |
| 53 | Util.cpp \ |
| 54 | ScopedXmlPullParser.cpp \ |
| 55 | SourceXmlPullParser.cpp \ |
| 56 | XliffXmlPullParser.cpp \ |
Adam Lesinski | 75f3a55 | 2015-06-03 14:54:23 -0700 | [diff] [blame] | 57 | XmlDom.cpp \ |
Adam Lesinski | 769de98 | 2015-04-10 19:43:55 -0700 | [diff] [blame] | 58 | XmlFlattener.cpp \ |
| 59 | ZipEntry.cpp \ |
| 60 | ZipFile.cpp |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 61 | |
| 62 | testSources := \ |
| 63 | BigBuffer_test.cpp \ |
Adam Lesinski | 4d3a987 | 2015-04-09 19:53:22 -0700 | [diff] [blame] | 64 | BindingXmlPullParser_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 65 | Compat_test.cpp \ |
| 66 | ConfigDescription_test.cpp \ |
| 67 | JavaClassGenerator_test.cpp \ |
| 68 | Linker_test.cpp \ |
| 69 | Locale_test.cpp \ |
Adam Lesinski | 8c831ca | 2015-05-20 15:24:01 -0700 | [diff] [blame] | 70 | ManifestMerger_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 71 | ManifestParser_test.cpp \ |
| 72 | Maybe_test.cpp \ |
Adam Lesinski | 769de98 | 2015-04-10 19:43:55 -0700 | [diff] [blame] | 73 | NameMangler_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 74 | ResourceParser_test.cpp \ |
| 75 | Resource_test.cpp \ |
| 76 | ResourceTable_test.cpp \ |
| 77 | ScopedXmlPullParser_test.cpp \ |
| 78 | StringPiece_test.cpp \ |
| 79 | StringPool_test.cpp \ |
| 80 | Util_test.cpp \ |
| 81 | XliffXmlPullParser_test.cpp \ |
Adam Lesinski | 75f3a55 | 2015-06-03 14:54:23 -0700 | [diff] [blame] | 82 | XmlDom_test.cpp \ |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 83 | XmlFlattener_test.cpp |
| 84 | |
Adam Lesinski | feefeb4 | 2015-04-03 12:44:40 -0700 | [diff] [blame] | 85 | hostLdLibs := |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 86 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 87 | hostStaticLibs := \ |
| 88 | libandroidfw \ |
| 89 | libutils \ |
| 90 | liblog \ |
| 91 | libcutils \ |
| 92 | libexpat \ |
Adam Lesinski | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 93 | libziparchive-host \ |
Narayan Kamath | 231e054 | 2015-04-29 16:32:23 +0100 | [diff] [blame] | 94 | libpng \ |
| 95 | libbase |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 96 | |
Adam Lesinski | feefeb4 | 2015-04-03 12:44:40 -0700 | [diff] [blame] | 97 | ifneq ($(strip $(USE_MINGW)),) |
| 98 | hostStaticLibs += libz |
| 99 | else |
| 100 | hostLdLibs += -lz |
| 101 | endif |
| 102 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 103 | cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG |
Adam Lesinski | 8c831ca | 2015-05-20 15:24:01 -0700 | [diff] [blame] | 104 | cppFlags := -std=c++11 -Wno-missing-field-initializers -Wno-unused-private-field |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 105 | |
| 106 | # ========================================================== |
| 107 | # Build the host static library: libaapt2 |
| 108 | # ========================================================== |
| 109 | include $(CLEAR_VARS) |
| 110 | LOCAL_MODULE := libaapt2 |
| 111 | |
| 112 | LOCAL_SRC_FILES := $(sources) |
Elliott Hughes | d149c9e | 2015-07-21 11:39:21 -0700 | [diff] [blame] | 113 | LOCAL_STATIC_LIBRARIES += $(hostStaticLibs) |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 114 | LOCAL_CFLAGS += $(cFlags) |
| 115 | LOCAL_CPPFLAGS += $(cppFlags) |
| 116 | |
| 117 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 118 | |
| 119 | |
| 120 | # ========================================================== |
| 121 | # Build the host tests: libaapt2_tests |
| 122 | # ========================================================== |
| 123 | include $(CLEAR_VARS) |
| 124 | LOCAL_MODULE := libaapt2_tests |
| 125 | LOCAL_MODULE_TAGS := tests |
| 126 | |
| 127 | LOCAL_SRC_FILES := $(testSources) |
| 128 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 129 | LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) |
| 130 | LOCAL_LDLIBS += $(hostLdLibs) |
| 131 | LOCAL_CFLAGS += $(cFlags) |
| 132 | LOCAL_CPPFLAGS += $(cppFlags) |
| 133 | |
| 134 | include $(BUILD_HOST_NATIVE_TEST) |
| 135 | |
| 136 | # ========================================================== |
| 137 | # Build the host executable: aapt2 |
| 138 | # ========================================================== |
| 139 | include $(CLEAR_VARS) |
| 140 | LOCAL_MODULE := aapt2 |
| 141 | |
| 142 | LOCAL_SRC_FILES := $(main) |
| 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_EXECUTABLE) |
| 150 | |
| 151 | endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK |