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 \ |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 36 | Images.cpp \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 37 | Package.cpp \ |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 38 | pseudolocalize.cpp \ |
| 39 | qsort_r_compat.c \ |
| 40 | Resource.cpp \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 41 | ResourceFilter.cpp \ |
| 42 | ResourceIdCache.cpp \ |
| 43 | ResourceTable.cpp \ |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 44 | SourcePos.cpp \ |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 45 | StringPool.cpp \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 46 | WorkQueue.cpp \ |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 47 | XMLNode.cpp \ |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 48 | ZipEntry.cpp \ |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 49 | ZipFile.cpp |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 50 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 51 | aaptTests := \ |
| 52 | tests/AaptConfig_test.cpp \ |
| 53 | tests/AaptGroupEntry_test.cpp \ |
| 54 | tests/ResourceFilter_test.cpp |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 55 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 56 | aaptCIncludes := \ |
| 57 | external/libpng \ |
| 58 | external/zlib |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 59 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 60 | aaptHostLdLibs := |
| 61 | aaptHostStaticLibs := \ |
| 62 | libandroidfw \ |
| 63 | libpng \ |
| 64 | liblog \ |
| 65 | libutils \ |
| 66 | libcutils \ |
| 67 | libexpat \ |
| 68 | libziparchive-host |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 70 | aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER)\" |
| 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 |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 91 | LOCAL_CFLAGS += -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS $(aaptCFlags) |
| 92 | LOCAL_CPPFLAGS += $(aaptCppFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 93 | ifeq (darwin,$(HOST_OS)) |
| 94 | LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS |
| 95 | endif |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 96 | LOCAL_C_INCLUDES += $(aaptCIncludes) |
| 97 | LOCAL_SRC_FILES := $(aaptSources) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 98 | |
| 99 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 100 | |
| 101 | |
| 102 | # ========================================================== |
| 103 | # Build the host executable: aapt |
| 104 | # ========================================================== |
| 105 | include $(CLEAR_VARS) |
| 106 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 107 | LOCAL_MODULE := aapt |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 108 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 109 | LOCAL_CPPFLAGS += $(aaptCppFlags) |
| 110 | LOCAL_LDLIBS += $(aaptHostLdLibs) |
| 111 | LOCAL_SRC_FILES := $(aaptMain) |
| 112 | LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 113 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 114 | include $(BUILD_HOST_EXECUTABLE) |
| 115 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 116 | |
| 117 | # ========================================================== |
| 118 | # Build the host tests: libaapt_tests |
| 119 | # ========================================================== |
| 120 | include $(CLEAR_VARS) |
| 121 | |
| 122 | LOCAL_MODULE := libaapt_tests |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 123 | LOCAL_CFLAGS += $(aaptCFlags) |
| 124 | LOCAL_CPPFLAGS += $(aaptCppFlags) |
| 125 | LOCAL_LDLIBS += $(aaptHostLdLibs) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 126 | LOCAL_SRC_FILES += $(aaptTests) |
| 127 | LOCAL_C_INCLUDES += $(LOCAL_PATH) |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 128 | LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 129 | |
| 130 | include $(BUILD_HOST_NATIVE_TEST) |
| 131 | |
| 132 | |
| 133 | # ========================================================== |
| 134 | # Build the device executable: aapt |
| 135 | # ========================================================== |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 136 | ifneq ($(SDK_ONLY),true) |
| 137 | include $(CLEAR_VARS) |
| 138 | |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 139 | LOCAL_MODULE := aapt |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 140 | LOCAL_CFLAGS += $(aaptCFlags) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 141 | LOCAL_SRC_FILES := $(aaptSources) $(aaptMain) |
| 142 | LOCAL_C_INCLUDES += \ |
| 143 | $(aaptCIncludes) \ |
| 144 | bionic \ |
| 145 | external/stlport/stlport |
Stephen Hines | 5675b97 | 2013-06-26 17:27:35 -0700 | [diff] [blame] | 146 | LOCAL_SHARED_LIBRARIES := \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 147 | libandroidfw \ |
| 148 | libutils \ |
| 149 | libcutils \ |
| 150 | libpng \ |
| 151 | liblog \ |
| 152 | libz |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 153 | LOCAL_STATIC_LIBRARIES := \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 154 | libstlport_static \ |
| 155 | libexpat_static |
| 156 | |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 157 | include $(BUILD_EXECUTABLE) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 158 | |
| 159 | endif # Not SDK_ONLY |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 160 | |
Ying Wang | 74bebf6 | 2014-03-07 15:55:14 -0800 | [diff] [blame] | 161 | endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK |