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 | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 85 | cIncludes := \ |
| 86 | external/libpng \ |
| 87 | external/libz |
| 88 | |
Adam Lesinski | feefeb4 | 2015-04-03 12:44:40 -0700 | [diff] [blame] | 89 | hostLdLibs := |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 90 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 91 | hostStaticLibs := \ |
| 92 | libandroidfw \ |
| 93 | libutils \ |
| 94 | liblog \ |
| 95 | libcutils \ |
| 96 | libexpat \ |
Adam Lesinski | 98aa3ad | 2015-04-06 11:46:52 -0700 | [diff] [blame] | 97 | libziparchive-host \ |
Narayan Kamath | 231e054 | 2015-04-29 16:32:23 +0100 | [diff] [blame] | 98 | libpng \ |
| 99 | libbase |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 100 | |
Adam Lesinski | feefeb4 | 2015-04-03 12:44:40 -0700 | [diff] [blame] | 101 | ifneq ($(strip $(USE_MINGW)),) |
| 102 | hostStaticLibs += libz |
| 103 | else |
| 104 | hostLdLibs += -lz |
| 105 | endif |
| 106 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 107 | cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG |
Adam Lesinski | 8c831ca | 2015-05-20 15:24:01 -0700 | [diff] [blame] | 108 | cppFlags := -std=c++11 -Wno-missing-field-initializers -Wno-unused-private-field |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 109 | |
| 110 | # ========================================================== |
| 111 | # Build the host static library: libaapt2 |
| 112 | # ========================================================== |
| 113 | include $(CLEAR_VARS) |
| 114 | LOCAL_MODULE := libaapt2 |
| 115 | |
| 116 | LOCAL_SRC_FILES := $(sources) |
| 117 | LOCAL_C_INCLUDES += $(cIncludes) |
| 118 | LOCAL_CFLAGS += $(cFlags) |
| 119 | LOCAL_CPPFLAGS += $(cppFlags) |
| 120 | |
| 121 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 122 | |
| 123 | |
| 124 | # ========================================================== |
| 125 | # Build the host tests: libaapt2_tests |
| 126 | # ========================================================== |
| 127 | include $(CLEAR_VARS) |
| 128 | LOCAL_MODULE := libaapt2_tests |
| 129 | LOCAL_MODULE_TAGS := tests |
| 130 | |
| 131 | LOCAL_SRC_FILES := $(testSources) |
| 132 | |
| 133 | LOCAL_C_INCLUDES += $(cIncludes) |
| 134 | LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) |
| 135 | LOCAL_LDLIBS += $(hostLdLibs) |
| 136 | LOCAL_CFLAGS += $(cFlags) |
| 137 | LOCAL_CPPFLAGS += $(cppFlags) |
| 138 | |
| 139 | include $(BUILD_HOST_NATIVE_TEST) |
| 140 | |
| 141 | # ========================================================== |
| 142 | # Build the host executable: aapt2 |
| 143 | # ========================================================== |
| 144 | include $(CLEAR_VARS) |
| 145 | LOCAL_MODULE := aapt2 |
| 146 | |
| 147 | LOCAL_SRC_FILES := $(main) |
| 148 | |
| 149 | LOCAL_C_INCLUDES += $(cIncludes) |
| 150 | LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) |
| 151 | LOCAL_LDLIBS += $(hostLdLibs) |
| 152 | LOCAL_CFLAGS += $(cFlags) |
| 153 | LOCAL_CPPFLAGS += $(cppFlags) |
| 154 | |
| 155 | include $(BUILD_HOST_EXECUTABLE) |
| 156 | |
| 157 | endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK |