blob: 700afa1d570d7e46ecfe0d614d036637e6adcc11 [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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069ifeq ($(HOST_OS),linux)
Adam Lesinskifab50872014-04-16 14:40:42 -070070 aaptHostLdLibs += -lrt -ldl -lpthread
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071endif
72
Raphael29355532010-04-13 15:21:32 -070073# Statically link libz for MinGW (Win SDK under Linux),
74# and dynamically link for all others.
75ifneq ($(strip $(USE_MINGW)),)
Adam Lesinskifab50872014-04-16 14:40:42 -070076 aaptHostStaticLibs += libz
Raphael29355532010-04-13 15:21:32 -070077else
Adam Lesinskifab50872014-04-16 14:40:42 -070078 aaptHostLdLibs += -lz
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079endif
80
Adam Lesinskifab50872014-04-16 14:40:42 -070081
82# ==========================================================
83# Build the host static library: libaapt
84# ==========================================================
85include $(CLEAR_VARS)
86
87LOCAL_MODULE := libaapt
88
89LOCAL_SRC_FILES := $(aaptSources)
90LOCAL_C_INCLUDES += $(aaptCIncludes)
91
92LOCAL_CFLAGS += -Wno-format-y2k
93LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS
94ifeq (darwin,$(HOST_OS))
95LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS
96endif
97
98include $(BUILD_HOST_STATIC_LIBRARY)
99
100
101# ==========================================================
102# Build the host executable: aapt
103# ==========================================================
104include $(CLEAR_VARS)
105
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106LOCAL_MODULE := aapt
107
Adam Lesinskifab50872014-04-16 14:40:42 -0700108LOCAL_SRC_FILES := $(aaptMain)
109
110LOCAL_STATIC_LIBRARIES += \
111 libaapt \
112 $(aaptHostStaticLibs)
113LOCAL_LDLIBS += $(aaptHostLdLibs)
114
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)
122
123LOCAL_MODULE := libaapt_tests
124
125LOCAL_SRC_FILES += $(aaptTests)
126LOCAL_C_INCLUDES += $(LOCAL_PATH)
127
128LOCAL_STATIC_LIBRARIES += \
129 libaapt \
130 $(aaptHostStaticLibs)
131LOCAL_LDLIBS += $(aaptHostLdLibs)
132
133include $(BUILD_HOST_NATIVE_TEST)
134
135
136# ==========================================================
137# Build the device executable: aapt
138# ==========================================================
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000139ifneq ($(SDK_ONLY),true)
140include $(CLEAR_VARS)
141
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000142LOCAL_MODULE := aapt
143
Adam Lesinskifab50872014-04-16 14:40:42 -0700144LOCAL_SRC_FILES := $(aaptSources) $(aaptMain)
145LOCAL_C_INCLUDES += \
146 $(aaptCIncludes) \
147 bionic \
148 external/stlport/stlport
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000149
Stephen Hines5675b972013-06-26 17:27:35 -0700150LOCAL_SHARED_LIBRARIES := \
Adam Lesinskifab50872014-04-16 14:40:42 -0700151 libandroidfw \
152 libutils \
153 libcutils \
154 libpng \
155 liblog \
156 libz
Stephen Hines5675b972013-06-26 17:27:35 -0700157
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000158LOCAL_STATIC_LIBRARIES := \
Adam Lesinskifab50872014-04-16 14:40:42 -0700159 libstlport_static \
160 libexpat_static
161
162LOCAL_CPPFLAGS += -Wno-non-virtual-dtor
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000163
164include $(BUILD_EXECUTABLE)
Adam Lesinskifab50872014-04-16 14:40:42 -0700165
166endif # Not SDK_ONLY
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000167
Ying Wang74bebf62014-03-07 15:55:14 -0800168endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK