blob: 275476cb20813b767e1365bf23a76ed01b3da90f [file] [log] [blame]
Adam Lesinski6f6ceb72014-11-14 14:48:12 -08001#
2# Copyright (C) 2015 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.
15#
16
17# This tool is prebuilt if we're doing an app-only build.
18ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
19
20# ==========================================================
21# Setup some common variables for the different build
22# targets here.
23# ==========================================================
24LOCAL_PATH:= $(call my-dir)
25
26main := Main.cpp
27sources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070028 compile/IdAssigner.cpp \
29 compile/Png.cpp \
30 compile/XmlIdCollector.cpp \
31 flatten/Archive.cpp \
32 flatten/TableFlattener.cpp \
33 flatten/XmlFlattener.cpp \
34 link/AutoVersioner.cpp \
35 link/PrivateAttributeMover.cpp \
36 link/ReferenceLinker.cpp \
37 link/TableMerger.cpp \
38 link/XmlReferenceLinker.cpp \
39 process/SymbolTable.cpp \
40 unflatten/BinaryResourceParser.cpp \
41 unflatten/ResChunkPullParser.cpp \
42 util/BigBuffer.cpp \
43 util/Files.cpp \
44 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080045 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070046 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070047 Flags.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080048 JavaClassGenerator.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080049 Locale.cpp \
Adam Lesinskia1ad4a82015-06-08 11:41:09 -070050 ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080051 Resource.cpp \
52 ResourceParser.cpp \
53 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070054 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080055 ResourceValues.cpp \
56 SdkConstants.cpp \
57 StringPool.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070058 XmlDom.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070059 XmlPullParser.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080060
61testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070062 compile/IdAssigner_test.cpp \
63 compile/XmlIdCollector_test.cpp \
64 flatten/FileExportWriter_test.cpp \
65 flatten/TableFlattener_test.cpp \
66 flatten/XmlFlattener_test.cpp \
67 link/AutoVersioner_test.cpp \
68 link/PrivateAttributeMover_test.cpp \
69 link/ReferenceLinker_test.cpp \
70 link/TableMerger_test.cpp \
71 link/XmlReferenceLinker_test.cpp \
72 process/SymbolTable_test.cpp \
73 unflatten/FileExportHeaderReader_test.cpp \
74 util/BigBuffer_test.cpp \
75 util/Maybe_test.cpp \
76 util/StringPiece_test.cpp \
77 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080078 ConfigDescription_test.cpp \
79 JavaClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080080 Locale_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080081 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070082 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080083 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070084 ResourceUtils_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080085 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070086 ValueVisitor_test.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070087 XmlDom_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070088 XmlPullParser_test.cpp
89
90toolSources := \
91 compile/Compile.cpp \
92 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080093
Adam Lesinskifeefeb42015-04-03 12:44:40 -070094hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080095
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080096hostStaticLibs := \
97 libandroidfw \
98 libutils \
99 liblog \
100 libcutils \
101 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700102 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100103 libpng \
104 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800105
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700106ifneq ($(strip $(USE_MINGW)),)
107 hostStaticLibs += libz
108else
109 hostLdLibs += -lz
110endif
111
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800112cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700113cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800114
115# ==========================================================
116# Build the host static library: libaapt2
117# ==========================================================
118include $(CLEAR_VARS)
119LOCAL_MODULE := libaapt2
120
121LOCAL_SRC_FILES := $(sources)
Elliott Hughes51348d22015-07-21 11:39:21 -0700122LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800123LOCAL_CFLAGS += $(cFlags)
124LOCAL_CPPFLAGS += $(cppFlags)
125
126include $(BUILD_HOST_STATIC_LIBRARY)
127
128
129# ==========================================================
130# Build the host tests: libaapt2_tests
131# ==========================================================
132include $(CLEAR_VARS)
133LOCAL_MODULE := libaapt2_tests
134LOCAL_MODULE_TAGS := tests
135
136LOCAL_SRC_FILES := $(testSources)
137
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800138LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
139LOCAL_LDLIBS += $(hostLdLibs)
140LOCAL_CFLAGS += $(cFlags)
141LOCAL_CPPFLAGS += $(cppFlags)
142
143include $(BUILD_HOST_NATIVE_TEST)
144
145# ==========================================================
146# Build the host executable: aapt2
147# ==========================================================
148include $(CLEAR_VARS)
149LOCAL_MODULE := aapt2
150
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700151LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800152
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800153LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
154LOCAL_LDLIBS += $(hostLdLibs)
155LOCAL_CFLAGS += $(cFlags)
156LOCAL_CPPFLAGS += $(cppFlags)
157
158include $(BUILD_HOST_EXECUTABLE)
159
160endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK