blob: bc9c1f70b8c623869e649481bdfa7598f56259e3 [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 \
39 qsort_r_compat.c \
40 Resource.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070041 ResourceFilter.cpp \
42 ResourceIdCache.cpp \
43 ResourceTable.cpp \
Mathias Agopian55e3d602009-06-05 14:56:35 -070044 SourcePos.cpp \
Adam Lesinski4bf58102014-11-03 11:21:19 -080045 StringPool.cpp \
Adam Lesinskifab50872014-04-16 14:40:42 -070046 WorkQueue.cpp \
Adam Lesinski4bf58102014-11-03 11:21:19 -080047 XMLNode.cpp \
Mathias Agopian55e3d602009-06-05 14:56:35 -070048 ZipEntry.cpp \
Adam Lesinski4bf58102014-11-03 11:21:19 -080049 ZipFile.cpp
Mathias Agopian55e3d602009-06-05 14:56:35 -070050
Adam Lesinskifab50872014-04-16 14:40:42 -070051aaptTests := \
52 tests/AaptConfig_test.cpp \
53 tests/AaptGroupEntry_test.cpp \
54 tests/ResourceFilter_test.cpp
Bjorn Bringertfb903a42013-03-18 21:17:26 +000055
Adam Lesinskifab50872014-04-16 14:40:42 -070056aaptCIncludes := \
57 external/libpng \
58 external/zlib
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080059
Adam Lesinskifab50872014-04-16 14:40:42 -070060aaptHostLdLibs :=
61aaptHostStaticLibs := \
62 libandroidfw \
63 libpng \
64 liblog \
65 libutils \
66 libcutils \
67 libexpat \
68 libziparchive-host
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069
Adam Lesinskiad751222014-08-18 14:06:38 -070070aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER)\"
71
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
Adam Lesinski4bf58102014-11-03 11:21:19 -080091LOCAL_CFLAGS += -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS $(aaptCFlags)
92LOCAL_CPPFLAGS += $(aaptCppFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -070093ifeq (darwin,$(HOST_OS))
94LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS
95endif
Adam Lesinski4bf58102014-11-03 11:21:19 -080096LOCAL_C_INCLUDES += $(aaptCIncludes)
97LOCAL_SRC_FILES := $(aaptSources)
Adam Lesinskifab50872014-04-16 14:40:42 -070098
99include $(BUILD_HOST_STATIC_LIBRARY)
100
101
102# ==========================================================
103# Build the host executable: aapt
104# ==========================================================
105include $(CLEAR_VARS)
106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107LOCAL_MODULE := aapt
Adam Lesinskiad751222014-08-18 14:06:38 -0700108LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinski4bf58102014-11-03 11:21:19 -0800109LOCAL_CPPFLAGS += $(aaptCppFlags)
110LOCAL_LDLIBS += $(aaptHostLdLibs)
111LOCAL_SRC_FILES := $(aaptMain)
112LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs)
Adam Lesinskifab50872014-04-16 14:40:42 -0700113
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114include $(BUILD_HOST_EXECUTABLE)
115
Adam Lesinskifab50872014-04-16 14:40:42 -0700116
117# ==========================================================
118# Build the host tests: libaapt_tests
119# ==========================================================
120include $(CLEAR_VARS)
121
122LOCAL_MODULE := libaapt_tests
Adam Lesinski4bf58102014-11-03 11:21:19 -0800123LOCAL_CFLAGS += $(aaptCFlags)
124LOCAL_CPPFLAGS += $(aaptCppFlags)
125LOCAL_LDLIBS += $(aaptHostLdLibs)
Adam Lesinskifab50872014-04-16 14:40:42 -0700126LOCAL_SRC_FILES += $(aaptTests)
127LOCAL_C_INCLUDES += $(LOCAL_PATH)
Adam Lesinski4bf58102014-11-03 11:21:19 -0800128LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs)
Adam Lesinskifab50872014-04-16 14:40:42 -0700129
130include $(BUILD_HOST_NATIVE_TEST)
131
132
133# ==========================================================
134# Build the device executable: aapt
135# ==========================================================
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000136ifneq ($(SDK_ONLY),true)
137include $(CLEAR_VARS)
138
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000139LOCAL_MODULE := aapt
Adam Lesinski4bf58102014-11-03 11:21:19 -0800140LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -0700141LOCAL_SRC_FILES := $(aaptSources) $(aaptMain)
142LOCAL_C_INCLUDES += \
143 $(aaptCIncludes) \
144 bionic \
145 external/stlport/stlport
Stephen Hines5675b972013-06-26 17:27:35 -0700146LOCAL_SHARED_LIBRARIES := \
Adam Lesinskifab50872014-04-16 14:40:42 -0700147 libandroidfw \
148 libutils \
149 libcutils \
150 libpng \
151 liblog \
152 libz
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000153LOCAL_STATIC_LIBRARIES := \
Adam Lesinskifab50872014-04-16 14:40:42 -0700154 libstlport_static \
155 libexpat_static
156
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000157include $(BUILD_EXECUTABLE)
Adam Lesinskifab50872014-04-16 14:40:42 -0700158
159endif # Not SDK_ONLY
Bjorn Bringertfb903a42013-03-18 21:17:26 +0000160
Ying Wang74bebf62014-03-07 15:55:14 -0800161endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK