blob: b991d55dc343b067a7a398d773f57f5965539369 [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 \
Igor Viarheichyk729ffa22015-05-14 18:47:00 -070053 tests/Pseudolocales_test.cpp \
Adam Lesinskibeb9e332015-08-14 13:16:18 -070054 tests/ResourceFilter_test.cpp \
55 tests/ResourceTable_test.cpp
Bjorn Bringertfb903a42013-03-18 21:17:26 +000056
Adam Lesinskifab50872014-04-16 14:40:42 -070057aaptCIncludes := \
Igor Viarheichyk729ffa22015-05-14 18:47:00 -070058 system/core/base/include \
Adam Lesinskifab50872014-04-16 14:40:42 -070059 external/libpng \
60 external/zlib
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061
Adam Lesinskifab50872014-04-16 14:40:42 -070062aaptHostLdLibs :=
63aaptHostStaticLibs := \
64 libandroidfw \
65 libpng \
66 liblog \
67 libutils \
68 libcutils \
69 libexpat \
Narayan Kamath9c8ba962015-04-28 09:23:26 +010070 libziparchive-host \
71 libbase
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072
Adam Lesinskiad751222014-08-18 14:06:38 -070073aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER)\"
Colin Cross01f18562015-04-08 17:29:00 -070074aaptCFlags += -Wall -Werror
Adam Lesinskiad751222014-08-18 14:06:38 -070075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076ifeq ($(HOST_OS),linux)
Adam Lesinskifab50872014-04-16 14:40:42 -070077 aaptHostLdLibs += -lrt -ldl -lpthread
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078endif
79
Raphael29355532010-04-13 15:21:32 -070080# Statically link libz for MinGW (Win SDK under Linux),
81# and dynamically link for all others.
82ifneq ($(strip $(USE_MINGW)),)
Adam Lesinskifab50872014-04-16 14:40:42 -070083 aaptHostStaticLibs += libz
Raphael29355532010-04-13 15:21:32 -070084else
Adam Lesinskifab50872014-04-16 14:40:42 -070085 aaptHostLdLibs += -lz
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086endif
87
Adam Lesinskifab50872014-04-16 14:40:42 -070088
89# ==========================================================
90# Build the host static library: libaapt
91# ==========================================================
92include $(CLEAR_VARS)
93
94LOCAL_MODULE := libaapt
Adam Lesinski4bf58102014-11-03 11:21:19 -080095LOCAL_CFLAGS += -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS $(aaptCFlags)
96LOCAL_CPPFLAGS += $(aaptCppFlags)
Adam Lesinskifab50872014-04-16 14:40:42 -070097ifeq (darwin,$(HOST_OS))
98LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS
99endif
Adam Lesinski4bf58102014-11-03 11:21:19 -0800100LOCAL_C_INCLUDES += $(aaptCIncludes)
101LOCAL_SRC_FILES := $(aaptSources)
Adam Lesinskifab50872014-04-16 14:40:42 -0700102
103include $(BUILD_HOST_STATIC_LIBRARY)
104
Adam Lesinskifab50872014-04-16 14:40:42 -0700105# ==========================================================
106# Build the host executable: aapt
107# ==========================================================
108include $(CLEAR_VARS)
109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110LOCAL_MODULE := aapt
Adam Lesinskiad751222014-08-18 14:06:38 -0700111LOCAL_CFLAGS += $(aaptCFlags)
Adam Lesinski4bf58102014-11-03 11:21:19 -0800112LOCAL_CPPFLAGS += $(aaptCppFlags)
113LOCAL_LDLIBS += $(aaptHostLdLibs)
114LOCAL_SRC_FILES := $(aaptMain)
115LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs)
Adam Lesinskifab50872014-04-16 14:40:42 -0700116
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117include $(BUILD_HOST_EXECUTABLE)
118
Adam Lesinskifab50872014-04-16 14:40:42 -0700119
120# ==========================================================
121# Build the host tests: libaapt_tests
122# ==========================================================
123include $(CLEAR_VARS)
Dan Albert88ba3392014-09-11 16:20:16 -0700124LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Adam Lesinskifab50872014-04-16 14:40:42 -0700125
126LOCAL_MODULE := libaapt_tests
Adam Lesinski4bf58102014-11-03 11:21:19 -0800127LOCAL_CFLAGS += $(aaptCFlags)
128LOCAL_CPPFLAGS += $(aaptCppFlags)
129LOCAL_LDLIBS += $(aaptHostLdLibs)
Adam Lesinskifab50872014-04-16 14:40:42 -0700130LOCAL_SRC_FILES += $(aaptTests)
131LOCAL_C_INCLUDES += $(LOCAL_PATH)
Adam Lesinski4bf58102014-11-03 11:21:19 -0800132LOCAL_STATIC_LIBRARIES += libaapt $(aaptHostStaticLibs)
Adam Lesinskifab50872014-04-16 14:40:42 -0700133
134include $(BUILD_HOST_NATIVE_TEST)
135
136
Ying Wang74bebf62014-03-07 15:55:14 -0800137endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK