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 \ |
| 30 | ConfigDescription.cpp \ |
| 31 | Files.cpp \ |
| 32 | JavaClassGenerator.cpp \ |
| 33 | Linker.cpp \ |
| 34 | Locale.cpp \ |
| 35 | Logger.cpp \ |
| 36 | ManifestParser.cpp \ |
| 37 | ManifestValidator.cpp \ |
| 38 | ResChunkPullParser.cpp \ |
| 39 | Resolver.cpp \ |
| 40 | Resource.cpp \ |
| 41 | ResourceParser.cpp \ |
| 42 | ResourceTable.cpp \ |
| 43 | ResourceValues.cpp \ |
| 44 | SdkConstants.cpp \ |
| 45 | StringPool.cpp \ |
| 46 | TableFlattener.cpp \ |
| 47 | Util.cpp \ |
| 48 | ScopedXmlPullParser.cpp \ |
| 49 | SourceXmlPullParser.cpp \ |
| 50 | XliffXmlPullParser.cpp \ |
| 51 | XmlFlattener.cpp |
| 52 | |
| 53 | testSources := \ |
| 54 | BigBuffer_test.cpp \ |
| 55 | Compat_test.cpp \ |
| 56 | ConfigDescription_test.cpp \ |
| 57 | JavaClassGenerator_test.cpp \ |
| 58 | Linker_test.cpp \ |
| 59 | Locale_test.cpp \ |
| 60 | ManifestParser_test.cpp \ |
| 61 | Maybe_test.cpp \ |
| 62 | ResourceParser_test.cpp \ |
| 63 | Resource_test.cpp \ |
| 64 | ResourceTable_test.cpp \ |
| 65 | ScopedXmlPullParser_test.cpp \ |
| 66 | StringPiece_test.cpp \ |
| 67 | StringPool_test.cpp \ |
| 68 | Util_test.cpp \ |
| 69 | XliffXmlPullParser_test.cpp \ |
| 70 | XmlFlattener_test.cpp |
| 71 | |
| 72 | cIncludes := |
| 73 | |
| 74 | hostLdLibs := -lz |
| 75 | hostStaticLibs := \ |
| 76 | libandroidfw \ |
| 77 | libutils \ |
| 78 | liblog \ |
| 79 | libcutils \ |
| 80 | libexpat \ |
| 81 | libziparchive-host |
| 82 | |
| 83 | cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG |
| 84 | cppFlags := -std=c++11 -Wno-missing-field-initializers |
| 85 | |
| 86 | # ========================================================== |
| 87 | # Build the host static library: libaapt2 |
| 88 | # ========================================================== |
| 89 | include $(CLEAR_VARS) |
| 90 | LOCAL_MODULE := libaapt2 |
| 91 | |
| 92 | LOCAL_SRC_FILES := $(sources) |
| 93 | LOCAL_C_INCLUDES += $(cIncludes) |
| 94 | LOCAL_CFLAGS += $(cFlags) |
| 95 | LOCAL_CPPFLAGS += $(cppFlags) |
| 96 | |
| 97 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 98 | |
| 99 | |
| 100 | # ========================================================== |
| 101 | # Build the host tests: libaapt2_tests |
| 102 | # ========================================================== |
| 103 | include $(CLEAR_VARS) |
| 104 | LOCAL_MODULE := libaapt2_tests |
| 105 | LOCAL_MODULE_TAGS := tests |
| 106 | |
| 107 | LOCAL_SRC_FILES := $(testSources) |
| 108 | |
| 109 | LOCAL_C_INCLUDES += $(cIncludes) |
| 110 | LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) |
| 111 | LOCAL_LDLIBS += $(hostLdLibs) |
| 112 | LOCAL_CFLAGS += $(cFlags) |
| 113 | LOCAL_CPPFLAGS += $(cppFlags) |
| 114 | |
| 115 | include $(BUILD_HOST_NATIVE_TEST) |
| 116 | |
| 117 | # ========================================================== |
| 118 | # Build the host executable: aapt2 |
| 119 | # ========================================================== |
| 120 | include $(CLEAR_VARS) |
| 121 | LOCAL_MODULE := aapt2 |
| 122 | |
| 123 | LOCAL_SRC_FILES := $(main) |
| 124 | |
| 125 | LOCAL_C_INCLUDES += $(cIncludes) |
| 126 | LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) |
| 127 | LOCAL_LDLIBS += $(hostLdLibs) |
| 128 | LOCAL_CFLAGS += $(cFlags) |
| 129 | LOCAL_CPPFLAGS += $(cppFlags) |
| 130 | |
| 131 | include $(BUILD_HOST_EXECUTABLE) |
| 132 | |
| 133 | endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK |