Android.mk revision fab50875b98e8274ac8ee44b38ba42521bbbf1f9
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 ApkBuilder.cpp \ 32 Command.cpp \ 33 CrunchCache.cpp \ 34 FileFinder.cpp \ 35 Package.cpp \ 36 StringPool.cpp \ 37 XMLNode.cpp \ 38 ResourceFilter.cpp \ 39 ResourceIdCache.cpp \ 40 ResourceTable.cpp \ 41 Images.cpp \ 42 Resource.cpp \ 43 pseudolocalize.cpp \ 44 SourcePos.cpp \ 45 WorkQueue.cpp \ 46 ZipEntry.cpp \ 47 ZipFile.cpp \ 48 qsort_r_compat.c 49 50aaptTests := \ 51 tests/AaptConfig_test.cpp \ 52 tests/AaptGroupEntry_test.cpp \ 53 tests/ResourceFilter_test.cpp 54 55aaptCIncludes := \ 56 external/libpng \ 57 external/zlib 58 59aaptHostLdLibs := 60aaptHostStaticLibs := \ 61 libandroidfw \ 62 libpng \ 63 liblog \ 64 libutils \ 65 libcutils \ 66 libexpat \ 67 libziparchive-host 68 69ifeq ($(HOST_OS),linux) 70 aaptHostLdLibs += -lrt -ldl -lpthread 71endif 72 73# Statically link libz for MinGW (Win SDK under Linux), 74# and dynamically link for all others. 75ifneq ($(strip $(USE_MINGW)),) 76 aaptHostStaticLibs += libz 77else 78 aaptHostLdLibs += -lz 79endif 80 81 82# ========================================================== 83# Build the host static library: libaapt 84# ========================================================== 85include $(CLEAR_VARS) 86 87LOCAL_MODULE := libaapt 88 89LOCAL_SRC_FILES := $(aaptSources) 90LOCAL_C_INCLUDES += $(aaptCIncludes) 91 92LOCAL_CFLAGS += -Wno-format-y2k 93LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS 94ifeq (darwin,$(HOST_OS)) 95LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS 96endif 97 98include $(BUILD_HOST_STATIC_LIBRARY) 99 100 101# ========================================================== 102# Build the host executable: aapt 103# ========================================================== 104include $(CLEAR_VARS) 105 106LOCAL_MODULE := aapt 107 108LOCAL_SRC_FILES := $(aaptMain) 109 110LOCAL_STATIC_LIBRARIES += \ 111 libaapt \ 112 $(aaptHostStaticLibs) 113LOCAL_LDLIBS += $(aaptHostLdLibs) 114 115include $(BUILD_HOST_EXECUTABLE) 116 117 118# ========================================================== 119# Build the host tests: libaapt_tests 120# ========================================================== 121include $(CLEAR_VARS) 122 123LOCAL_MODULE := libaapt_tests 124 125LOCAL_SRC_FILES += $(aaptTests) 126LOCAL_C_INCLUDES += $(LOCAL_PATH) 127 128LOCAL_STATIC_LIBRARIES += \ 129 libaapt \ 130 $(aaptHostStaticLibs) 131LOCAL_LDLIBS += $(aaptHostLdLibs) 132 133include $(BUILD_HOST_NATIVE_TEST) 134 135 136# ========================================================== 137# Build the device executable: aapt 138# ========================================================== 139ifneq ($(SDK_ONLY),true) 140include $(CLEAR_VARS) 141 142LOCAL_MODULE := aapt 143 144LOCAL_SRC_FILES := $(aaptSources) $(aaptMain) 145LOCAL_C_INCLUDES += \ 146 $(aaptCIncludes) \ 147 bionic \ 148 external/stlport/stlport 149 150LOCAL_SHARED_LIBRARIES := \ 151 libandroidfw \ 152 libutils \ 153 libcutils \ 154 libpng \ 155 liblog \ 156 libz 157 158LOCAL_STATIC_LIBRARIES := \ 159 libstlport_static \ 160 libexpat_static 161 162LOCAL_CPPFLAGS += -Wno-non-virtual-dtor 163 164include $(BUILD_EXECUTABLE) 165 166endif # Not SDK_ONLY 167 168endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK 169