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 \ |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 39 | Resource.cpp \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 40 | ResourceFilter.cpp \ |
| 41 | ResourceIdCache.cpp \ |
| 42 | ResourceTable.cpp \ |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 43 | SourcePos.cpp \ |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 44 | StringPool.cpp \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 45 | WorkQueue.cpp \ |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 46 | XMLNode.cpp \ |
Mathias Agopian | 55e3d60 | 2009-06-05 14:56:35 -0700 | [diff] [blame] | 47 | ZipEntry.cpp \ |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [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 \ |
Igor Viarheichyk | cbb1e67 | 2015-05-14 18:47:00 -0700 | [diff] [blame] | 53 | tests/Pseudolocales_test.cpp \ |
Adam Lesinski | beb9e33 | 2015-08-14 13:16:18 -0700 | [diff] [blame] | 54 | tests/ResourceFilter_test.cpp \ |
| 55 | tests/ResourceTable_test.cpp |
Bjorn Bringert | fb903a4 | 2013-03-18 21:17:26 +0000 | [diff] [blame] | 56 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 57 | aaptHostStaticLibs := \ |
| 58 | libandroidfw \ |
| 59 | libpng \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 60 | libutils \ |
Sergio Giro | d90d8d6 | 2016-06-28 18:26:10 +0100 | [diff] [blame] | 61 | liblog \ |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 62 | libcutils \ |
| 63 | libexpat \ |
Colin Cross | 9a1a3bc | 2016-08-26 11:15:17 -0700 | [diff] [blame] | 64 | libziparchive \ |
Narayan Kamath | 9c8ba96 | 2015-04-28 09:23:26 +0100 | [diff] [blame] | 65 | libbase |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 66 | |
Colin Cross | 06e04f7 | 2015-07-16 17:55:31 -0700 | [diff] [blame] | 67 | aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER_FROM_FILE)\" |
Colin Cross | 01f1856 | 2015-04-08 17:29:00 -0700 | [diff] [blame] | 68 | aaptCFlags += -Wall -Werror |
Adam Lesinski | ad75122 | 2014-08-18 14:06:38 -0700 | [diff] [blame] | 69 | |
Dan Willemsen | 4aa679f | 2015-08-19 11:13:56 -0700 | [diff] [blame] | 70 | aaptHostLdLibs_linux := -lrt -ldl -lpthread |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 71 | |
Raphael | 2935553 | 2010-04-13 15:21:32 -0700 | [diff] [blame] | 72 | # Statically link libz for MinGW (Win SDK under Linux), |
| 73 | # and dynamically link for all others. |
Dan Willemsen | 4aa679f | 2015-08-19 11:13:56 -0700 | [diff] [blame] | 74 | aaptHostStaticLibs_windows := libz |
| 75 | aaptHostLdLibs_linux += -lz |
| 76 | aaptHostLdLibs_darwin := -lz |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 78 | |
| 79 | # ========================================================== |
| 80 | # Build the host static library: libaapt |
| 81 | # ========================================================== |
| 82 | include $(CLEAR_VARS) |
| 83 | |
| 84 | LOCAL_MODULE := libaapt |
Dan Willemsen | 4aa679f | 2015-08-19 11:13:56 -0700 | [diff] [blame] | 85 | LOCAL_MODULE_HOST_OS := darwin linux windows |
| 86 | LOCAL_CFLAGS := -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS $(aaptCFlags) |
| 87 | LOCAL_CPPFLAGS := $(aaptCppFlags) |
| 88 | LOCAL_CFLAGS_darwin := -D_DARWIN_UNLIMITED_STREAMS |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 89 | LOCAL_SRC_FILES := $(aaptSources) |
Dan Willemsen | 4aa679f | 2015-08-19 11:13:56 -0700 | [diff] [blame] | 90 | LOCAL_STATIC_LIBRARIES := $(aaptHostStaticLibs) |
| 91 | LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 92 | |
| 93 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 94 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 95 | # ========================================================== |
| 96 | # Build the host executable: aapt |
| 97 | # ========================================================== |
| 98 | include $(CLEAR_VARS) |
| 99 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 100 | LOCAL_MODULE := aapt |
Dan Willemsen | 4aa679f | 2015-08-19 11:13:56 -0700 | [diff] [blame] | 101 | LOCAL_MODULE_HOST_OS := darwin linux windows |
| 102 | LOCAL_CFLAGS := $(aaptCFlags) |
| 103 | LOCAL_CPPFLAGS := $(aaptCppFlags) |
| 104 | LOCAL_LDLIBS_darwin := $(aaptHostLdLibs_darwin) |
| 105 | LOCAL_LDLIBS_linux := $(aaptHostLdLibs_linux) |
Adam Lesinski | 4bf5810 | 2014-11-03 11:21:19 -0800 | [diff] [blame] | 106 | LOCAL_SRC_FILES := $(aaptMain) |
Dan Willemsen | 4aa679f | 2015-08-19 11:13:56 -0700 | [diff] [blame] | 107 | LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs) |
| 108 | LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 109 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 110 | include $(BUILD_HOST_EXECUTABLE) |
| 111 | |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 112 | |
| 113 | # ========================================================== |
| 114 | # Build the host tests: libaapt_tests |
| 115 | # ========================================================== |
| 116 | include $(CLEAR_VARS) |
| 117 | |
| 118 | LOCAL_MODULE := libaapt_tests |
Dan Willemsen | 4aa679f | 2015-08-19 11:13:56 -0700 | [diff] [blame] | 119 | LOCAL_CFLAGS := $(aaptCFlags) |
| 120 | LOCAL_CPPFLAGS := $(aaptCppFlags) |
| 121 | LOCAL_LDLIBS_darwin := $(aaptHostLdLibs_darwin) |
| 122 | LOCAL_LDLIBS_linux := $(aaptHostLdLibs_linux) |
| 123 | LOCAL_SRC_FILES := $(aaptTests) |
| 124 | LOCAL_C_INCLUDES := $(LOCAL_PATH) |
| 125 | LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs) |
| 126 | LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows) |
Adam Lesinski | fab5087 | 2014-04-16 14:40:42 -0700 | [diff] [blame] | 127 | |
| 128 | include $(BUILD_HOST_NATIVE_TEST) |
| 129 | |
| 130 | |
Ying Wang | 74bebf6 | 2014-03-07 15:55:14 -0800 | [diff] [blame] | 131 | endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK |