The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | # |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 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. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 15 | # |
| 16 | |
Joe Onorato | 74905e5 | 2010-06-10 18:34:55 -0700 | [diff] [blame] | 17 | # This tool is prebuilt if we're doing an app-only build. |
Ying Wang | 74bebf6 | 2014-03-07 15:55:14 -0800 | [diff] [blame] | 18 | ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),) |
Joe Onorato | 74905e5 | 2010-06-10 18:34:55 -0700 | [diff] [blame] | 19 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 20 | # ========================================================== |
| 21 | # Setup some common variables for the different build |
| 22 | # targets here. |
| 23 | # ========================================================== |
| 24 | LOCAL_PATH:= $(call my-dir) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 26 | aaptMain := Main.cpp |
| 27 | aaptSources := \ |
| 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 \ |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 43 | pseudolocalize.cpp \ |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 44 | SourcePos.cpp \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 45 | WorkQueue.cpp \ |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 46 | ZipEntry.cpp \ |
Dima Zavin | 823abb6 | 2013-05-06 23:17:58 -0700 | [diff] [blame] | 47 | ZipFile.cpp \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 48 | qsort_r_compat.c |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 49 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 50 | aaptTests := \ |
| 51 | tests/AaptConfig_test.cpp \ |
| 52 | tests/AaptGroupEntry_test.cpp \ |
| 53 | tests/ResourceFilter_test.cpp |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 54 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 55 | aaptCIncludes := \ |
| 56 | external/libpng \ |
| 57 | external/zlib |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 59 | aaptHostLdLibs := |
| 60 | aaptHostStaticLibs := \ |
| 61 | libandroidfw \ |
| 62 | libpng \ |
| 63 | liblog \ |
| 64 | libutils \ |
| 65 | libcutils \ |
| 66 | libexpat \ |
| 67 | libziparchive-host |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 68 | |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 69 | aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER)\" |
| 70 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 71 | ifeq ($(HOST_OS),linux) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 72 | aaptHostLdLibs += -lrt -ldl -lpthread |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 73 | endif |
| 74 | |
Raphael | 2935553 | 2010-04-13 15:21:32 -0700 | [diff] [blame] | 75 | # Statically link libz for MinGW (Win SDK under Linux), |
| 76 | # and dynamically link for all others. |
| 77 | ifneq ($(strip $(USE_MINGW)),) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 78 | aaptHostStaticLibs += libz |
Raphael | 2935553 | 2010-04-13 15:21:32 -0700 | [diff] [blame] | 79 | else |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 80 | aaptHostLdLibs += -lz |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | endif |
| 82 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 83 | |
| 84 | # ========================================================== |
| 85 | # Build the host static library: libaapt |
| 86 | # ========================================================== |
| 87 | include $(CLEAR_VARS) |
| 88 | |
| 89 | LOCAL_MODULE := libaapt |
| 90 | |
| 91 | LOCAL_SRC_FILES := $(aaptSources) |
| 92 | LOCAL_C_INCLUDES += $(aaptCIncludes) |
| 93 | |
| 94 | LOCAL_CFLAGS += -Wno-format-y2k |
| 95 | LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 96 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 97 | ifeq (darwin,$(HOST_OS)) |
| 98 | LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS |
| 99 | endif |
| 100 | |
| 101 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 102 | |
| 103 | |
| 104 | # ========================================================== |
| 105 | # Build the host executable: aapt |
| 106 | # ========================================================== |
| 107 | include $(CLEAR_VARS) |
| 108 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 109 | LOCAL_MODULE := aapt |
| 110 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 111 | LOCAL_SRC_FILES := $(aaptMain) |
| 112 | |
| 113 | LOCAL_STATIC_LIBRARIES += \ |
| 114 | libaapt \ |
| 115 | $(aaptHostStaticLibs) |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 116 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 117 | LOCAL_LDLIBS += $(aaptHostLdLibs) |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 118 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 119 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 120 | include $(BUILD_HOST_EXECUTABLE) |
| 121 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 122 | |
| 123 | # ========================================================== |
| 124 | # Build the host tests: libaapt_tests |
| 125 | # ========================================================== |
| 126 | include $(CLEAR_VARS) |
| 127 | |
| 128 | LOCAL_MODULE := libaapt_tests |
| 129 | |
| 130 | LOCAL_SRC_FILES += $(aaptTests) |
| 131 | LOCAL_C_INCLUDES += $(LOCAL_PATH) |
| 132 | |
| 133 | LOCAL_STATIC_LIBRARIES += \ |
| 134 | libaapt \ |
| 135 | $(aaptHostStaticLibs) |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 136 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 137 | LOCAL_LDLIBS += $(aaptHostLdLibs) |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 138 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 139 | |
| 140 | include $(BUILD_HOST_NATIVE_TEST) |
| 141 | |
| 142 | |
| 143 | # ========================================================== |
| 144 | # Build the device executable: aapt |
| 145 | # ========================================================== |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 146 | ifneq ($(SDK_ONLY),true) |
| 147 | include $(CLEAR_VARS) |
| 148 | |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 149 | LOCAL_MODULE := aapt |
| 150 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 151 | LOCAL_SRC_FILES := $(aaptSources) $(aaptMain) |
| 152 | LOCAL_C_INCLUDES += \ |
| 153 | $(aaptCIncludes) \ |
| 154 | bionic \ |
| 155 | external/stlport/stlport |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 156 | |
Stephen Hines | 5675b97 | 2013-06-26 17:27:35 -0700 | [diff] [blame] | 157 | LOCAL_SHARED_LIBRARIES := \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 158 | libandroidfw \ |
| 159 | libutils \ |
| 160 | libcutils \ |
| 161 | libpng \ |
| 162 | liblog \ |
| 163 | libz |
Stephen Hines | 5675b97 | 2013-06-26 17:27:35 -0700 | [diff] [blame] | 164 | |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 165 | LOCAL_STATIC_LIBRARIES := \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 166 | libstlport_static \ |
| 167 | libexpat_static |
| 168 | |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 169 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 170 | LOCAL_CPPFLAGS += -Wno-non-virtual-dtor |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 171 | |
| 172 | include $(BUILD_EXECUTABLE) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 173 | |
| 174 | endif # Not SDK_ONLY |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 175 | |
Ying Wang | 74bebf6 | 2014-03-07 15:55:14 -0800 | [diff] [blame] | 176 | endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK |