Android.mk revision 6f6ceb7e1456698b1f33e04536bfb3227f9fcfcb
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 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 53testSources := \ 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 72cIncludes := 73 74hostLdLibs := -lz 75hostStaticLibs := \ 76 libandroidfw \ 77 libutils \ 78 liblog \ 79 libcutils \ 80 libexpat \ 81 libziparchive-host 82 83cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG 84cppFlags := -std=c++11 -Wno-missing-field-initializers 85 86# ========================================================== 87# Build the host static library: libaapt2 88# ========================================================== 89include $(CLEAR_VARS) 90LOCAL_MODULE := libaapt2 91 92LOCAL_SRC_FILES := $(sources) 93LOCAL_C_INCLUDES += $(cIncludes) 94LOCAL_CFLAGS += $(cFlags) 95LOCAL_CPPFLAGS += $(cppFlags) 96 97include $(BUILD_HOST_STATIC_LIBRARY) 98 99 100# ========================================================== 101# Build the host tests: libaapt2_tests 102# ========================================================== 103include $(CLEAR_VARS) 104LOCAL_MODULE := libaapt2_tests 105LOCAL_MODULE_TAGS := tests 106 107LOCAL_SRC_FILES := $(testSources) 108 109LOCAL_C_INCLUDES += $(cIncludes) 110LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) 111LOCAL_LDLIBS += $(hostLdLibs) 112LOCAL_CFLAGS += $(cFlags) 113LOCAL_CPPFLAGS += $(cppFlags) 114 115include $(BUILD_HOST_NATIVE_TEST) 116 117# ========================================================== 118# Build the host executable: aapt2 119# ========================================================== 120include $(CLEAR_VARS) 121LOCAL_MODULE := aapt2 122 123LOCAL_SRC_FILES := $(main) 124 125LOCAL_C_INCLUDES += $(cIncludes) 126LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs) 127LOCAL_LDLIBS += $(hostLdLibs) 128LOCAL_CFLAGS += $(cFlags) 129LOCAL_CPPFLAGS += $(cppFlags) 130 131include $(BUILD_HOST_EXECUTABLE) 132 133endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK 134