blob: 4ce504544b91ea491964859353cd81144436a104 [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 \
31 ApkBuilder.cpp \
32 Command.cpp \
33 CrunchCache.cpp \
34 FileFinder.cpp \
35 Package.cpp \
36 StringPool.cpp \
37 XMLNode.cpp \
38 ResourceFilter.cpp \
39 ResourceIdCache.cpp \
40 ResourceTable.cpp \
41 Images.cpp \
42 Resource.cpp \
Bjorn Bringertfb903a42013-03-18 21:17:26 +000043 pseudolocalize.cpp \
Mathias Agopian55e3d602009-06-05 14:56:35 -070044 SourcePos.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070045 WorkQueue.cpp \
Mathias Agopian55e3d602009-06-05 14:56:35 -070046 ZipEntry.cpp \
Dima Zavin823abb62013-05-06 23:17:58 -070047 ZipFile.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070048 qsort_r_compat.c
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 \
67 libziparchive-host
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068
Adam Lesinskiad751222014-08-18 14:06:38 -070069aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER)\"
70
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071ifeq ($(HOST_OS),linux)
Adam Lesinskifab50872014-04-16 14:40:42 -070072 aaptHostLdLibs += -lrt -ldl -lpthread
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073endif
74
Raphael29355532010-04-13 15:21:32 -070075# Statically link libz for MinGW (Win SDK under Linux),
76# and dynamically link for all others.
77ifneq ($(strip $(USE_MINGW)),)
Adam Lesinskifab50872014-04-16 14:40:42 -070078 aaptHostStaticLibs += libz
Raphael29355532010-04-13 15:21:32 -070079else
Adam Lesinskifab50872014-04-16 14:40:42 -070080 aaptHostLdLibs += -lz
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081endif
82
Adam Lesinskifab50872014-04-16 14:40:42 -070083
84# ==========================================================
85# Build the host static library: libaapt
86# ==========================================================
87include $(CLEAR_VARS)
88
89LOCAL_MODULE := libaapt
90
91LOCAL_SRC_FILES := $(aaptSources)
92LOCAL_C_INCLUDES += $(aaptCIncludes)
93
94LOCAL_CFLAGS += -Wno-format-y2k
95LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS
Adam Lesinskiad751222014-08-18 14:06:38 -070096LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -070097ifeq (darwin,$(HOST_OS))
98LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS
99endif
100
101include $(BUILD_HOST_STATIC_LIBRARY)
102
103
104# ==========================================================
105# Build the host executable: aapt
106# ==========================================================
107include $(CLEAR_VARS)
108
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109LOCAL_MODULE := aapt
110
Adam Lesinskifab50872014-04-16 14:40:42 -0700111LOCAL_SRC_FILES := $(aaptMain)
112
113LOCAL_STATIC_LIBRARIES += \
114 libaapt \
115 $(aaptHostStaticLibs)
Adam Lesinskiad751222014-08-18 14:06:38 -0700116
Adam Lesinskifab50872014-04-16 14:40:42 -0700117LOCAL_LDLIBS += $(aaptHostLdLibs)
Adam Lesinskiad751222014-08-18 14:06:38 -0700118LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -0700119
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120include $(BUILD_HOST_EXECUTABLE)
121
Adam Lesinskifab50872014-04-16 14:40:42 -0700122
123# ==========================================================
124# Build the host tests: libaapt_tests
125# ==========================================================
126include $(CLEAR_VARS)
127
128LOCAL_MODULE := libaapt_tests
129
130LOCAL_SRC_FILES += $(aaptTests)
131LOCAL_C_INCLUDES += $(LOCAL_PATH)
132
133LOCAL_STATIC_LIBRARIES += \
134 libaapt \
135 $(aaptHostStaticLibs)
Adam Lesinskiad751222014-08-18 14:06:38 -0700136
Adam Lesinskifab50872014-04-16 14:40:42 -0700137LOCAL_LDLIBS += $(aaptHostLdLibs)
Adam Lesinskiad751222014-08-18 14:06:38 -0700138LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -0700139
140include $(BUILD_HOST_NATIVE_TEST)
141
142
143# ==========================================================
144# Build the device executable: aapt
145# ==========================================================
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000146ifneq ($(SDK_ONLY),true)
147include $(CLEAR_VARS)
148
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000149LOCAL_MODULE := aapt
150
Adam Lesinskifab50872014-04-16 14:40:42 -0700151LOCAL_SRC_FILES := $(aaptSources) $(aaptMain)
152LOCAL_C_INCLUDES += \
153 $(aaptCIncludes) \
154 bionic \
155 external/stlport/stlport
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000156
Stephen Hines5675b972013-06-26 17:27:35 -0700157LOCAL_SHARED_LIBRARIES := \
Adam Lesinskifab50872014-04-16 14:40:42 -0700158 libandroidfw \
159 libutils \
160 libcutils \
161 libpng \
162 liblog \
163 libz
Stephen Hines5675b972013-06-26 17:27:35 -0700164
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000165LOCAL_STATIC_LIBRARIES := \
Adam Lesinskifab50872014-04-16 14:40:42 -0700166 libstlport_static \
167 libexpat_static
168
Adam Lesinskiad751222014-08-18 14:06:38 -0700169LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -0700170LOCAL_CPPFLAGS += -Wno-non-virtual-dtor
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000171
172include $(BUILD_EXECUTABLE)
Adam Lesinskifab50872014-04-16 14:40:42 -0700173
174endif # Not SDK_ONLY
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000175
Ying Wang74bebf62014-03-07 15:55:14 -0800176endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK