blob: 0ccf0f50d3b2506ce62c711b7fc586615bda0729 [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 \
36 Package.cpp \
37 StringPool.cpp \
38 XMLNode.cpp \
39 ResourceFilter.cpp \
40 ResourceIdCache.cpp \
41 ResourceTable.cpp \
42 Images.cpp \
43 Resource.cpp \
Bjorn Bringertfb903a42013-03-18 21:17:26 +000044 pseudolocalize.cpp \
Mathias Agopian55e3d602009-06-05 14:56:35 -070045 SourcePos.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070046 WorkQueue.cpp \
Mathias Agopian55e3d602009-06-05 14:56:35 -070047 ZipEntry.cpp \
Dima Zavin823abb62013-05-06 23:17:58 -070048 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 \
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)\"
Andreas Gampe87332a72014-10-01 22:03:58 -070070aaptCFLAGS += -Wall -Werror
Adam Lesinskiad751222014-08-18 14:06:38 -070071
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072ifeq ($(HOST_OS),linux)
Adam Lesinskifab50872014-04-16 14:40:42 -070073 aaptHostLdLibs += -lrt -ldl -lpthread
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074endif
75
Raphael29355532010-04-13 15:21:32 -070076# Statically link libz for MinGW (Win SDK under Linux),
77# and dynamically link for all others.
78ifneq ($(strip $(USE_MINGW)),)
Adam Lesinskifab50872014-04-16 14:40:42 -070079 aaptHostStaticLibs += libz
Raphael29355532010-04-13 15:21:32 -070080else
Adam Lesinskifab50872014-04-16 14:40:42 -070081 aaptHostLdLibs += -lz
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082endif
83
Adam Lesinskifab50872014-04-16 14:40:42 -070084
85# ==========================================================
86# Build the host static library: libaapt
87# ==========================================================
88include $(CLEAR_VARS)
89
90LOCAL_MODULE := libaapt
91
92LOCAL_SRC_FILES := $(aaptSources)
93LOCAL_C_INCLUDES += $(aaptCIncludes)
94
95LOCAL_CFLAGS += -Wno-format-y2k
96LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS
Adam Lesinskiad751222014-08-18 14:06:38 -070097LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -070098ifeq (darwin,$(HOST_OS))
99LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS
100endif
101
102include $(BUILD_HOST_STATIC_LIBRARY)
103
104
105# ==========================================================
106# Build the host executable: aapt
107# ==========================================================
108include $(CLEAR_VARS)
109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110LOCAL_MODULE := aapt
111
Adam Lesinskifab50872014-04-16 14:40:42 -0700112LOCAL_SRC_FILES := $(aaptMain)
113
114LOCAL_STATIC_LIBRARIES += \
115 libaapt \
116 $(aaptHostStaticLibs)
Adam Lesinskiad751222014-08-18 14:06:38 -0700117
Adam Lesinskifab50872014-04-16 14:40:42 -0700118LOCAL_LDLIBS += $(aaptHostLdLibs)
Adam Lesinskiad751222014-08-18 14:06:38 -0700119LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -0700120
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121include $(BUILD_HOST_EXECUTABLE)
122
Adam Lesinskifab50872014-04-16 14:40:42 -0700123
124# ==========================================================
125# Build the host tests: libaapt_tests
126# ==========================================================
127include $(CLEAR_VARS)
Dan Albert88ba3392014-09-11 16:20:16 -0700128LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Adam Lesinskifab50872014-04-16 14:40:42 -0700129
130LOCAL_MODULE := libaapt_tests
131
132LOCAL_SRC_FILES += $(aaptTests)
133LOCAL_C_INCLUDES += $(LOCAL_PATH)
134
135LOCAL_STATIC_LIBRARIES += \
136 libaapt \
137 $(aaptHostStaticLibs)
Adam Lesinskiad751222014-08-18 14:06:38 -0700138
Adam Lesinskifab50872014-04-16 14:40:42 -0700139LOCAL_LDLIBS += $(aaptHostLdLibs)
Adam Lesinskiad751222014-08-18 14:06:38 -0700140LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -0700141
142include $(BUILD_HOST_NATIVE_TEST)
143
144
145# ==========================================================
146# Build the device executable: aapt
147# ==========================================================
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000148ifneq ($(SDK_ONLY),true)
149include $(CLEAR_VARS)
150
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000151LOCAL_MODULE := aapt
152
Adam Lesinskifab50872014-04-16 14:40:42 -0700153LOCAL_SRC_FILES := $(aaptSources) $(aaptMain)
154LOCAL_C_INCLUDES += \
155 $(aaptCIncludes) \
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 libexpat_static
167
Adam Lesinskiad751222014-08-18 14:06:38 -0700168LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -0700169LOCAL_CPPFLAGS += -Wno-non-virtual-dtor
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000170
Dan Albert88ba3392014-09-11 16:20:16 -0700171include external/stlport/libstlport.mk
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000172include $(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