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 \ |
Adam Lesinski | ad2d07d | 2014-08-27 16:21:08 -0700 | [diff] [blame] | 31 | AaptXml.cpp \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 32 | ApkBuilder.cpp \ |
| 33 | Command.cpp \ |
| 34 | CrunchCache.cpp \ |
| 35 | FileFinder.cpp \ |
| 36 | Package.cpp \ |
| 37 | StringPool.cpp \ |
| 38 | XMLNode.cpp \ |
| 39 | ResourceFilter.cpp \ |
| 40 | ResourceIdCache.cpp \ |
| 41 | ResourceTable.cpp \ |
| 42 | Images.cpp \ |
| 43 | Resource.cpp \ |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 44 | pseudolocalize.cpp \ |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 45 | SourcePos.cpp \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 46 | WorkQueue.cpp \ |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 47 | ZipEntry.cpp \ |
Dima Zavin | 823abb6 | 2013-05-06 23:17:58 -0700 | [diff] [blame] | 48 | ZipFile.cpp \ |
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)\" |
Andreas Gampe | 87332a7 | 2014-10-01 22:03:58 -0700 | [diff] [blame^] | 70 | aaptCFLAGS += -Wall -Werror |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 71 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 72 | ifeq ($(HOST_OS),linux) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 73 | aaptHostLdLibs += -lrt -ldl -lpthread |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 74 | endif |
| 75 | |
Raphael | 2935553 | 2010-04-13 15:21:32 -0700 | [diff] [blame] | 76 | # Statically link libz for MinGW (Win SDK under Linux), |
| 77 | # and dynamically link for all others. |
| 78 | ifneq ($(strip $(USE_MINGW)),) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 79 | aaptHostStaticLibs += libz |
Raphael | 2935553 | 2010-04-13 15:21:32 -0700 | [diff] [blame] | 80 | else |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 81 | aaptHostLdLibs += -lz |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | endif |
| 83 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 84 | |
| 85 | # ========================================================== |
| 86 | # Build the host static library: libaapt |
| 87 | # ========================================================== |
| 88 | include $(CLEAR_VARS) |
| 89 | |
| 90 | LOCAL_MODULE := libaapt |
| 91 | |
| 92 | LOCAL_SRC_FILES := $(aaptSources) |
| 93 | LOCAL_C_INCLUDES += $(aaptCIncludes) |
| 94 | |
| 95 | LOCAL_CFLAGS += -Wno-format-y2k |
| 96 | LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 97 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 98 | ifeq (darwin,$(HOST_OS)) |
| 99 | LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS |
| 100 | endif |
| 101 | |
| 102 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 103 | |
| 104 | |
| 105 | # ========================================================== |
| 106 | # Build the host executable: aapt |
| 107 | # ========================================================== |
| 108 | include $(CLEAR_VARS) |
| 109 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 110 | LOCAL_MODULE := aapt |
| 111 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 112 | LOCAL_SRC_FILES := $(aaptMain) |
| 113 | |
| 114 | LOCAL_STATIC_LIBRARIES += \ |
| 115 | libaapt \ |
| 116 | $(aaptHostStaticLibs) |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 117 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 118 | LOCAL_LDLIBS += $(aaptHostLdLibs) |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 119 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 120 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 121 | include $(BUILD_HOST_EXECUTABLE) |
| 122 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 123 | |
| 124 | # ========================================================== |
| 125 | # Build the host tests: libaapt_tests |
| 126 | # ========================================================== |
| 127 | include $(CLEAR_VARS) |
Dan Albert | 88ba339 | 2014-09-11 16:20:16 -0700 | [diff] [blame] | 128 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 129 | |
| 130 | LOCAL_MODULE := libaapt_tests |
| 131 | |
| 132 | LOCAL_SRC_FILES += $(aaptTests) |
| 133 | LOCAL_C_INCLUDES += $(LOCAL_PATH) |
| 134 | |
| 135 | LOCAL_STATIC_LIBRARIES += \ |
| 136 | libaapt \ |
| 137 | $(aaptHostStaticLibs) |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 138 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 139 | LOCAL_LDLIBS += $(aaptHostLdLibs) |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 140 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 141 | |
| 142 | include $(BUILD_HOST_NATIVE_TEST) |
| 143 | |
| 144 | |
| 145 | # ========================================================== |
| 146 | # Build the device executable: aapt |
| 147 | # ========================================================== |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 148 | ifneq ($(SDK_ONLY),true) |
| 149 | include $(CLEAR_VARS) |
| 150 | |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 151 | LOCAL_MODULE := aapt |
| 152 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 153 | LOCAL_SRC_FILES := $(aaptSources) $(aaptMain) |
| 154 | LOCAL_C_INCLUDES += \ |
| 155 | $(aaptCIncludes) \ |
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 | libexpat_static |
| 167 | |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 168 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 169 | LOCAL_CPPFLAGS += -Wno-non-virtual-dtor |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 170 | |
Dan Albert | 88ba339 | 2014-09-11 16:20:16 -0700 | [diff] [blame] | 171 | include external/stlport/libstlport.mk |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 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 |