blob: 92eb262219053a74a92fe40910f354e7e02655bc [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001#
Adam Lesinskifab50872014-04-16 14:40:42 -07002# 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 Project9066cfe2009-03-03 19:31:44 -080015#
16
Joe Onorato74905e52010-06-10 18:34:55 -070017# This tool is prebuilt if we're doing an app-only build.
Ying Wang74bebf62014-03-07 15:55:14 -080018ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
Joe Onorato74905e52010-06-10 18:34:55 -070019
Adam Lesinskifab50872014-04-16 14:40:42 -070020# ==========================================================
21# Setup some common variables for the different build
22# targets here.
23# ==========================================================
24LOCAL_PATH:= $(call my-dir)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025
Adam Lesinskifab50872014-04-16 14:40:42 -070026aaptMain := Main.cpp
27aaptSources := \
28 AaptAssets.cpp \
29 AaptConfig.cpp \
30 AaptUtil.cpp \
Adam Lesinskiad2d07d2014-08-27 16:21:08 -070031 AaptXml.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070032 ApkBuilder.cpp \
33 Command.cpp \
34 CrunchCache.cpp \
35 FileFinder.cpp \
Adam Lesinski4bf58102014-11-03 11:21:19 -080036 Images.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070037 Package.cpp \
Adam Lesinski4bf58102014-11-03 11:21:19 -080038 pseudolocalize.cpp \
Adam Lesinski4bf58102014-11-03 11:21:19 -080039 Resource.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070040 ResourceFilter.cpp \
41 ResourceIdCache.cpp \
42 ResourceTable.cpp \
Mathias Agopian55e3d602009-06-05 14:56:35 -070043 SourcePos.cpp \
Adam Lesinski4bf58102014-11-03 11:21:19 -080044 StringPool.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070045 WorkQueue.cpp \
Adam Lesinski4bf58102014-11-03 11:21:19 -080046 XMLNode.cpp \
Mathias Agopian55e3d602009-06-05 14:56:35 -070047 ZipEntry.cpp \
Adam Lesinski4bf58102014-11-03 11:21:19 -080048 ZipFile.cpp
Mathias Agopian55e3d602009-06-05 14:56:35 -070049
Adam Lesinskifab50872014-04-16 14:40:42 -070050aaptTests := \
51 tests/AaptConfig_test.cpp \
52 tests/AaptGroupEntry_test.cpp \
Igor Viarheichykcbb1e672015-05-14 18:47:00 -070053 tests/Pseudolocales_test.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070054 tests/ResourceFilter_test.cpp
Bjorn Bringertfb903a42013-03-18 21:17:26 +000055
Adam Lesinskifab50872014-04-16 14:40:42 -070056aaptHostStaticLibs := \
57 libandroidfw \
58 libpng \
59 liblog \
60 libutils \
61 libcutils \
62 libexpat \
Narayan Kamath9c8ba962015-04-28 09:23:26 +010063 libziparchive-host \
64 libbase
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065
Colin Cross06e04f72015-07-16 17:55:31 -070066aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER_FROM_FILE)\"
Colin Cross01f18562015-04-08 17:29:00 -070067aaptCFlags += -Wall -Werror
Adam Lesinskiad751222014-08-18 14:06:38 -070068
Dan Willemsen4aa679f2015-08-19 11:13:56 -070069aaptHostLdLibs_linux := -lrt -ldl -lpthread
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070
Raphael29355532010-04-13 15:21:32 -070071# Statically link libz for MinGW (Win SDK under Linux),
72# and dynamically link for all others.
Dan Willemsen4aa679f2015-08-19 11:13:56 -070073aaptHostStaticLibs_windows := libz
74aaptHostLdLibs_linux += -lz
75aaptHostLdLibs_darwin := -lz
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076
Adam Lesinskifab50872014-04-16 14:40:42 -070077
78# ==========================================================
79# Build the host static library: libaapt
80# ==========================================================
81include $(CLEAR_VARS)
82
83LOCAL_MODULE := libaapt
Dan Willemsen4aa679f2015-08-19 11:13:56 -070084LOCAL_MODULE_HOST_OS := darwin linux windows
85LOCAL_CFLAGS := -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS $(aaptCFlags)
86LOCAL_CPPFLAGS := $(aaptCppFlags)
87LOCAL_CFLAGS_darwin := -D_DARWIN_UNLIMITED_STREAMS
Adam Lesinski4bf58102014-11-03 11:21:19 -080088LOCAL_SRC_FILES := $(aaptSources)
Dan Willemsen4aa679f2015-08-19 11:13:56 -070089LOCAL_STATIC_LIBRARIES := $(aaptHostStaticLibs)
90LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows)
Adam Lesinskifab50872014-04-16 14:40:42 -070091
92include $(BUILD_HOST_STATIC_LIBRARY)
93
Adam Lesinskifab50872014-04-16 14:40:42 -070094# ==========================================================
95# Build the host executable: aapt
96# ==========================================================
97include $(CLEAR_VARS)
98
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099LOCAL_MODULE := aapt
Dan Willemsen4aa679f2015-08-19 11:13:56 -0700100LOCAL_MODULE_HOST_OS := darwin linux windows
101LOCAL_CFLAGS := $(aaptCFlags)
102LOCAL_CPPFLAGS := $(aaptCppFlags)
103LOCAL_LDLIBS_darwin := $(aaptHostLdLibs_darwin)
104LOCAL_LDLIBS_linux := $(aaptHostLdLibs_linux)
Adam Lesinski4bf58102014-11-03 11:21:19 -0800105LOCAL_SRC_FILES := $(aaptMain)
Dan Willemsen4aa679f2015-08-19 11:13:56 -0700106LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs)
107LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows)
Adam Lesinskifab50872014-04-16 14:40:42 -0700108
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109include $(BUILD_HOST_EXECUTABLE)
110
Adam Lesinskifab50872014-04-16 14:40:42 -0700111
112# ==========================================================
113# Build the host tests: libaapt_tests
114# ==========================================================
115include $(CLEAR_VARS)
116
117LOCAL_MODULE := libaapt_tests
Dan Willemsen4aa679f2015-08-19 11:13:56 -0700118LOCAL_CFLAGS := $(aaptCFlags)
119LOCAL_CPPFLAGS := $(aaptCppFlags)
120LOCAL_LDLIBS_darwin := $(aaptHostLdLibs_darwin)
121LOCAL_LDLIBS_linux := $(aaptHostLdLibs_linux)
122LOCAL_SRC_FILES := $(aaptTests)
123LOCAL_C_INCLUDES := $(LOCAL_PATH)
124LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs)
125LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows)
Adam Lesinskifab50872014-04-16 14:40:42 -0700126
127include $(BUILD_HOST_NATIVE_TEST)
128
129
Ying Wang74bebf62014-03-07 15:55:14 -0800130endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK