blob: dc3ad255be04ac94ee723ba25ee5357f8f651bfd [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 \
53 tests/ResourceFilter_test.cpp
Bjorn Bringertfb903a42013-03-18 21:17:26 +000054
Adam Lesinskifab50872014-04-16 14:40:42 -070055aaptCIncludes := \
56 external/libpng \
57 external/zlib
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058
Adam Lesinskifab50872014-04-16 14:40:42 -070059aaptHostLdLibs :=
60aaptHostStaticLibs := \
61 libandroidfw \
62 libpng \
63 liblog \
64 libutils \
65 libcutils \
66 libexpat \
Narayan Kamath9c8ba962015-04-28 09:23:26 +010067 libziparchive-host \
68 libbase
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069
Adam Lesinskiad751222014-08-18 14:06:38 -070070aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER)\"
Colin Cross01f18562015-04-08 17:29:00 -070071aaptCFlags += -Wall -Werror
Adam Lesinskiad751222014-08-18 14:06:38 -070072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073ifeq ($(HOST_OS),linux)
Adam Lesinskifab50872014-04-16 14:40:42 -070074 aaptHostLdLibs += -lrt -ldl -lpthread
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075endif
76
Raphael29355532010-04-13 15:21:32 -070077# Statically link libz for MinGW (Win SDK under Linux),
78# and dynamically link for all others.
79ifneq ($(strip $(USE_MINGW)),)
Adam Lesinskifab50872014-04-16 14:40:42 -070080 aaptHostStaticLibs += libz
Raphael29355532010-04-13 15:21:32 -070081else
Adam Lesinskifab50872014-04-16 14:40:42 -070082 aaptHostLdLibs += -lz
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083endif
84
Adam Lesinskifab50872014-04-16 14:40:42 -070085
86# ==========================================================
87# Build the host static library: libaapt
88# ==========================================================
89include $(CLEAR_VARS)
90
91LOCAL_MODULE := libaapt
Adam Lesinski4bf58102014-11-03 11:21:19 -080092LOCAL_CFLAGS += -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS $(aaptCFlags)
93LOCAL_CPPFLAGS += $(aaptCppFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -070094ifeq (darwin,$(HOST_OS))
95LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS
96endif
Adam Lesinski4bf58102014-11-03 11:21:19 -080097LOCAL_C_INCLUDES += $(aaptCIncludes)
98LOCAL_SRC_FILES := $(aaptSources)
Adam Lesinskifab50872014-04-16 14:40:42 -070099
100include $(BUILD_HOST_STATIC_LIBRARY)
101
102
103# ==========================================================
104# Build the host executable: aapt
105# ==========================================================
106include $(CLEAR_VARS)
107
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108LOCAL_MODULE := aapt
Adam Lesinskiad751222014-08-18 14:06:38 -0700109LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinski4bf58102014-11-03 11:21:19 -0800110LOCAL_CPPFLAGS += $(aaptCppFlags)
111LOCAL_LDLIBS += $(aaptHostLdLibs)
112LOCAL_SRC_FILES := $(aaptMain)
113LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs)
Adam Lesinskifab50872014-04-16 14:40:42 -0700114
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115include $(BUILD_HOST_EXECUTABLE)
116
Adam Lesinskifab50872014-04-16 14:40:42 -0700117
118# ==========================================================
119# Build the host tests: libaapt_tests
120# ==========================================================
121include $(CLEAR_VARS)
Dan Albert88ba3392014-09-11 16:20:16 -0700122LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Adam Lesinskifab50872014-04-16 14:40:42 -0700123
124LOCAL_MODULE := libaapt_tests
Adam Lesinski4bf58102014-11-03 11:21:19 -0800125LOCAL_CFLAGS += $(aaptCFlags)
126LOCAL_CPPFLAGS += $(aaptCppFlags)
127LOCAL_LDLIBS += $(aaptHostLdLibs)
Adam Lesinskifab50872014-04-16 14:40:42 -0700128LOCAL_SRC_FILES += $(aaptTests)
129LOCAL_C_INCLUDES += $(LOCAL_PATH)
Adam Lesinski4bf58102014-11-03 11:21:19 -0800130LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs)
Adam Lesinskifab50872014-04-16 14:40:42 -0700131
132include $(BUILD_HOST_NATIVE_TEST)
133
134
135# ==========================================================
136# Build the device executable: aapt
137# ==========================================================
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000138ifneq ($(SDK_ONLY),true)
139include $(CLEAR_VARS)
140
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000141LOCAL_MODULE := aapt
Adam Lesinski4bf58102014-11-03 11:21:19 -0800142LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -0700143LOCAL_SRC_FILES := $(aaptSources) $(aaptMain)
Adam Lesinski3fd34002014-11-03 18:03:53 -0800144LOCAL_C_INCLUDES += $(aaptCIncludes)
Stephen Hines5675b972013-06-26 17:27:35 -0700145LOCAL_SHARED_LIBRARIES := \
Adam Lesinskifab50872014-04-16 14:40:42 -0700146 libandroidfw \
147 libutils \
148 libcutils \
149 libpng \
150 liblog \
151 libz
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000152LOCAL_STATIC_LIBRARIES := \
Adam Lesinskifab50872014-04-16 14:40:42 -0700153 libexpat_static
154
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000155include $(BUILD_EXECUTABLE)
Adam Lesinskifab50872014-04-16 14:40:42 -0700156
157endif # Not SDK_ONLY
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000158
Ying Wang74bebf62014-03-07 15:55:14 -0800159endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK