blob: a4f4ba92885538332aad5421a2d1f6a12459f606 [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 \
Adam Lesinski393b5f02015-12-17 13:03:11 -080030 compile/PseudolocaleGenerator.cpp \
31 compile/Pseudolocalizer.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070032 compile/XmlIdCollector.cpp \
33 flatten/Archive.cpp \
34 flatten/TableFlattener.cpp \
35 flatten/XmlFlattener.cpp \
Adam Lesinskia6fe3452015-12-09 15:20:52 -080036 io/FileSystem.cpp \
37 io/ZipArchive.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070038 link/AutoVersioner.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080039 link/ManifestFixer.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070040 link/PrivateAttributeMover.cpp \
41 link/ReferenceLinker.cpp \
42 link/TableMerger.cpp \
43 link/XmlReferenceLinker.cpp \
44 process/SymbolTable.cpp \
45 unflatten/BinaryResourceParser.cpp \
46 unflatten/ResChunkPullParser.cpp \
47 util/BigBuffer.cpp \
48 util/Files.cpp \
49 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080050 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070051 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070052 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070053 java/AnnotationProcessor.cpp \
54 java/JavaClassGenerator.cpp \
55 java/ManifestClassGenerator.cpp \
56 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080057 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080058 Resource.cpp \
59 ResourceParser.cpp \
60 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070061 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080062 ResourceValues.cpp \
63 SdkConstants.cpp \
64 StringPool.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080065 xml/XmlDom.cpp \
66 xml/XmlPullParser.cpp \
67 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080068
69testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070070 compile/IdAssigner_test.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080071 compile/PseudolocaleGenerator_test.cpp \
72 compile/Pseudolocalizer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070073 compile/XmlIdCollector_test.cpp \
74 flatten/FileExportWriter_test.cpp \
75 flatten/TableFlattener_test.cpp \
76 flatten/XmlFlattener_test.cpp \
77 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080078 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070079 link/PrivateAttributeMover_test.cpp \
80 link/ReferenceLinker_test.cpp \
81 link/TableMerger_test.cpp \
82 link/XmlReferenceLinker_test.cpp \
83 process/SymbolTable_test.cpp \
84 unflatten/FileExportHeaderReader_test.cpp \
85 util/BigBuffer_test.cpp \
86 util/Maybe_test.cpp \
87 util/StringPiece_test.cpp \
88 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080089 ConfigDescription_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -080090 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070091 java/JavaClassGenerator_test.cpp \
92 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080093 Locale_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080094 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070095 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080096 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070097 ResourceUtils_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080098 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070099 ValueVisitor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -0800100 xml/XmlDom_test.cpp \
101 xml/XmlPullParser_test.cpp \
102 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700103
104toolSources := \
105 compile/Compile.cpp \
106 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800107
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700108hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800109
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800110hostStaticLibs := \
111 libandroidfw \
112 libutils \
113 liblog \
114 libcutils \
115 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700116 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100117 libpng \
118 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800119
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700120ifneq ($(strip $(USE_MINGW)),)
121 hostStaticLibs += libz
122else
123 hostLdLibs += -lz
124endif
125
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800126cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800127cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800128
129# ==========================================================
130# Build the host static library: libaapt2
131# ==========================================================
132include $(CLEAR_VARS)
133LOCAL_MODULE := libaapt2
134
135LOCAL_SRC_FILES := $(sources)
Elliott Hughes51348d22015-07-21 11:39:21 -0700136LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800137LOCAL_CFLAGS += $(cFlags)
138LOCAL_CPPFLAGS += $(cppFlags)
139
140include $(BUILD_HOST_STATIC_LIBRARY)
141
142
143# ==========================================================
144# Build the host tests: libaapt2_tests
145# ==========================================================
146include $(CLEAR_VARS)
147LOCAL_MODULE := libaapt2_tests
148LOCAL_MODULE_TAGS := tests
149
150LOCAL_SRC_FILES := $(testSources)
151
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800152LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
153LOCAL_LDLIBS += $(hostLdLibs)
154LOCAL_CFLAGS += $(cFlags)
155LOCAL_CPPFLAGS += $(cppFlags)
156
157include $(BUILD_HOST_NATIVE_TEST)
158
159# ==========================================================
160# Build the host executable: aapt2
161# ==========================================================
162include $(CLEAR_VARS)
163LOCAL_MODULE := aapt2
164
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700165LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800166
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800167LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
168LOCAL_LDLIBS += $(hostLdLibs)
169LOCAL_CFLAGS += $(cFlags)
170LOCAL_CPPFLAGS += $(cppFlags)
171
172include $(BUILD_HOST_EXECUTABLE)
173
174endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK