Android.mk revision cbb1e676b56677ae3585c067f29646dddffb4857
1# 2# Copyright (C) 2014 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 26aaptMain := Main.cpp 27aaptSources := \ 28 AaptAssets.cpp \ 29 AaptConfig.cpp \ 30 AaptUtil.cpp \ 31 AaptXml.cpp \ 32 ApkBuilder.cpp \ 33 Command.cpp \ 34 CrunchCache.cpp \ 35 FileFinder.cpp \ 36 Images.cpp \ 37 Package.cpp \ 38 pseudolocalize.cpp \ 39 Resource.cpp \ 40 ResourceFilter.cpp \ 41 ResourceIdCache.cpp \ 42 ResourceTable.cpp \ 43 SourcePos.cpp \ 44 StringPool.cpp \ 45 WorkQueue.cpp \ 46 XMLNode.cpp \ 47 ZipEntry.cpp \ 48 ZipFile.cpp 49 50aaptTests := \ 51 tests/AaptConfig_test.cpp \ 52 tests/AaptGroupEntry_test.cpp \ 53 tests/Pseudolocales_test.cpp \ 54 tests/ResourceFilter_test.cpp 55 56aaptCIncludes := \ 57 system/core/base/include \ 58 external/libpng \ 59 external/zlib 60 61aaptHostLdLibs := 62aaptHostStaticLibs := \ 63 libandroidfw \ 64 libpng \ 65 liblog \ 66 libutils \ 67 libcutils \ 68 libexpat \ 69 libziparchive-host \ 70 libbase 71 72aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER)\" 73aaptCFlags += -Wall -Werror 74 75ifeq ($(HOST_OS),linux) 76 aaptHostLdLibs += -lrt -ldl -lpthread 77endif 78 79# Statically link libz for MinGW (Win SDK under Linux), 80# and dynamically link for all others. 81ifneq ($(strip $(USE_MINGW)),) 82 aaptHostStaticLibs += libz 83else 84 aaptHostLdLibs += -lz 85endif 86 87 88# ========================================================== 89# Build the host static library: libaapt 90# ========================================================== 91include $(CLEAR_VARS) 92 93LOCAL_MODULE := libaapt 94LOCAL_CFLAGS += -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS $(aaptCFlags) 95LOCAL_CPPFLAGS += $(aaptCppFlags) 96ifeq (darwin,$(HOST_OS)) 97LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS 98endif 99LOCAL_C_INCLUDES += $(aaptCIncludes) 100LOCAL_SRC_FILES := $(aaptSources) 101 102include $(BUILD_HOST_STATIC_LIBRARY) 103 104# ========================================================== 105# Build the host executable: aapt 106# ========================================================== 107include $(CLEAR_VARS) 108 109LOCAL_MODULE := aapt 110LOCAL_CFLAGS += $(aaptCFlags) 111LOCAL_CPPFLAGS += $(aaptCppFlags) 112LOCAL_LDLIBS += $(aaptHostLdLibs) 113LOCAL_SRC_FILES := $(aaptMain) 114LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs) 115 116include $(BUILD_HOST_EXECUTABLE) 117 118 119# ========================================================== 120# Build the host tests: libaapt_tests 121# ========================================================== 122include $(CLEAR_VARS) 123LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 124 125LOCAL_MODULE := libaapt_tests 126LOCAL_CFLAGS += $(aaptCFlags) 127LOCAL_CPPFLAGS += $(aaptCppFlags) 128LOCAL_LDLIBS += $(aaptHostLdLibs) 129LOCAL_SRC_FILES += $(aaptTests) 130LOCAL_C_INCLUDES += $(LOCAL_PATH) 131LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs) 132 133include $(BUILD_HOST_NATIVE_TEST) 134 135 136endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK 137