Android.mk revision d1808401ca3bfd6b6b9a975c1e739b194d18f849
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. 18ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),) 19 20# ========================================================== 21# Setup some common variables for the different build 22# targets here. 23# ========================================================== 24LOCAL_PATH:= $(call my-dir) 25 26main := Main.cpp 27sources := \ 28 BigBuffer.cpp \ 29 BinaryResourceParser.cpp \ 30 BinaryXmlPullParser.cpp \ 31 BindingXmlPullParser.cpp \ 32 ConfigDescription.cpp \ 33 Files.cpp \ 34 Flag.cpp \ 35 JavaClassGenerator.cpp \ 36 Linker.cpp \ 37 Locale.cpp \ 38 Logger.cpp \ 39 ManifestParser.cpp \ 40 ManifestValidator.cpp \ 41 Png.cpp \ 42 ResChunkPullParser.cpp \ 43 Resource.cpp \ 44 ResourceParser.cpp \ 45 ResourceTable.cpp \ 46 ResourceTableResolver.cpp \ 47 ResourceValues.cpp \ 48 SdkConstants.cpp \ 49 StringPool.cpp \ 50 TableFlattener.cpp \ 51 Util.cpp \ 52 ScopedXmlPullParser.cpp \ 53 SourceXmlPullParser.cpp \ 54 XliffXmlPullParser.cpp \ 55 XmlFlattener.cpp \ 56 ZipEntry.cpp \ 57 ZipFile.cpp 58 59testSources := \ 60 BigBuffer_test.cpp \ 61 BindingXmlPullParser_test.cpp \ 62 Compat_test.cpp \ 63 ConfigDescription_test.cpp \ 64 JavaClassGenerator_test.cpp \ 65 Linker_test.cpp \ 66 Locale_test.cpp \ 67 ManifestParser_test.cpp \ 68 Maybe_test.cpp \ 69 NameMangler_test.cpp \ 70 ResourceParser_test.cpp \ 71 Resource_test.cpp \ 72 ResourceTable_test.cpp \ 73 ScopedXmlPullParser_test.cpp \ 74 StringPiece_test.cpp \ 75 StringPool_test.cpp \ 76 Util_test.cpp \ 77 XliffXmlPullParser_test.cpp \ 78 XmlFlattener_test.cpp 79 80cIncludes := \ 81 external/libpng \ 82 external/libz 83 84hostLdLibs := 85 86hostStaticLibs := \ 87 libandroidfw \ 88 libutils \ 89 liblog \ 90 libcutils \ 91 libexpat \ 92 libziparchive-host \ 93 libpng \ 94 libbase 95 96ifneq ($(strip $(USE_MINGW)),) 97 hostStaticLibs += libz 98else 99 hostLdLibs += -lz 100endif 101 102cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG 103cppFlags := -std=c++11 -Wno-missing-field-initializers 104 105# ========================================================== 106# Build the host static library: libaapt2 107# ========================================================== 108include $(CLEAR_VARS) 109LOCAL_MODULE := libaapt2 110 111LOCAL_SRC_FILES := $(sources) 112LOCAL_C_INCLUDES += $(cIncludes) 113LOCAL_CFLAGS += $(cFlags) 114LOCAL_CPPFLAGS += $(cppFlags) 115 116include $(BUILD_HOST_STATIC_LIBRARY) 117 118 119# ========================================================== 120# Build the host tests: libaapt2_tests 121# ========================================================== 122include $(CLEAR_VARS) 123LOCAL_MODULE := libaapt2_tests 124LOCAL_MODULE_TAGS := tests 125 126LOCAL_SRC_FILES := $(testSources) 127 128LOCAL_C_INCLUDES += $(cIncludes) 129LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) 130LOCAL_LDLIBS += $(hostLdLibs) 131LOCAL_CFLAGS += $(cFlags) 132LOCAL_CPPFLAGS += $(cppFlags) 133 134include $(BUILD_HOST_NATIVE_TEST) 135 136# ========================================================== 137# Build the host executable: aapt2 138# ========================================================== 139include $(CLEAR_VARS) 140LOCAL_MODULE := aapt2 141 142LOCAL_SRC_FILES := $(main) 143 144LOCAL_C_INCLUDES += $(cIncludes) 145LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) 146LOCAL_LDLIBS += $(hostLdLibs) 147LOCAL_CFLAGS += $(cFlags) 148LOCAL_CPPFLAGS += $(cppFlags) 149 150include $(BUILD_HOST_EXECUTABLE) 151 152endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK 153