blob: f9d35aba86d2eb91c3b4952d8995c211ec97c585 [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 \
Adam Lesinski6a008172016-02-02 17:02:58 -080033 filter/ConfigFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070034 flatten/Archive.cpp \
35 flatten/TableFlattener.cpp \
36 flatten/XmlFlattener.cpp \
Adam Lesinskia6fe3452015-12-09 15:20:52 -080037 io/FileSystem.cpp \
38 io/ZipArchive.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070039 link/AutoVersioner.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080040 link/ManifestFixer.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080041 link/ProductFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070042 link/PrivateAttributeMover.cpp \
43 link/ReferenceLinker.cpp \
44 link/TableMerger.cpp \
45 link/XmlReferenceLinker.cpp \
46 process/SymbolTable.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080047 proto/ProtoHelpers.cpp \
48 proto/TableProtoDeserializer.cpp \
49 proto/TableProtoSerializer.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080050 split/TableSplitter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070051 unflatten/BinaryResourceParser.cpp \
52 unflatten/ResChunkPullParser.cpp \
53 util/BigBuffer.cpp \
54 util/Files.cpp \
55 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080056 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070057 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070058 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070059 java/AnnotationProcessor.cpp \
60 java/JavaClassGenerator.cpp \
61 java/ManifestClassGenerator.cpp \
62 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080063 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080064 Resource.cpp \
65 ResourceParser.cpp \
66 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070067 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080068 ResourceValues.cpp \
69 SdkConstants.cpp \
70 StringPool.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080071 xml/XmlDom.cpp \
72 xml/XmlPullParser.cpp \
73 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080074
Adam Lesinski59e04c62016-02-04 15:59:23 -080075sources += Format.proto
76
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080077testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070078 compile/IdAssigner_test.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080079 compile/PseudolocaleGenerator_test.cpp \
80 compile/Pseudolocalizer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070081 compile/XmlIdCollector_test.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080082 filter/ConfigFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070083 flatten/TableFlattener_test.cpp \
84 flatten/XmlFlattener_test.cpp \
85 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080086 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070087 link/PrivateAttributeMover_test.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080088 link/ProductFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070089 link/ReferenceLinker_test.cpp \
90 link/TableMerger_test.cpp \
91 link/XmlReferenceLinker_test.cpp \
92 process/SymbolTable_test.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080093 proto/TableProtoSerializer_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080094 split/TableSplitter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070095 util/BigBuffer_test.cpp \
96 util/Maybe_test.cpp \
97 util/StringPiece_test.cpp \
98 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080099 ConfigDescription_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -0800100 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -0700101 java/JavaClassGenerator_test.cpp \
102 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800103 Locale_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800104 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700105 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800106 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700107 ResourceUtils_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -0800108 SdkConstants_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800109 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700110 ValueVisitor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -0800111 xml/XmlDom_test.cpp \
112 xml/XmlPullParser_test.cpp \
113 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700114
115toolSources := \
116 compile/Compile.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800117 dump/Dump.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700118 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800119
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700120hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800121
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800122hostStaticLibs := \
123 libandroidfw \
124 libutils \
125 liblog \
126 libcutils \
127 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700128 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100129 libpng \
130 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800131
Adam Lesinski59e04c62016-02-04 15:59:23 -0800132hostSharedLibs := \
133 libprotobuf-cpp-lite
134
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700135ifneq ($(strip $(USE_MINGW)),)
136 hostStaticLibs += libz
137else
138 hostLdLibs += -lz
139endif
140
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800141cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800142cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski59e04c62016-02-04 15:59:23 -0800143protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800144
145# ==========================================================
146# Build the host static library: libaapt2
147# ==========================================================
148include $(CLEAR_VARS)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800149LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800150LOCAL_MODULE := libaapt2
151
152LOCAL_SRC_FILES := $(sources)
Elliott Hughes51348d22015-07-21 11:39:21 -0700153LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800154LOCAL_CFLAGS += $(cFlags)
155LOCAL_CPPFLAGS += $(cppFlags)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800156LOCAL_C_INCLUDES += $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800157
158include $(BUILD_HOST_STATIC_LIBRARY)
159
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800160# ==========================================================
161# Build the host tests: libaapt2_tests
162# ==========================================================
163include $(CLEAR_VARS)
164LOCAL_MODULE := libaapt2_tests
165LOCAL_MODULE_TAGS := tests
166
167LOCAL_SRC_FILES := $(testSources)
168
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800169LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800170LOCAL_SHARED_LIBRARIES += $(hostSharedLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800171LOCAL_LDLIBS += $(hostLdLibs)
172LOCAL_CFLAGS += $(cFlags)
173LOCAL_CPPFLAGS += $(cppFlags)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800174LOCAL_C_INCLUDES += $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800175
176include $(BUILD_HOST_NATIVE_TEST)
177
178# ==========================================================
179# Build the host executable: aapt2
180# ==========================================================
181include $(CLEAR_VARS)
182LOCAL_MODULE := aapt2
183
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700184LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800185
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800186LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800187LOCAL_SHARED_LIBRARIES += $(hostSharedLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800188LOCAL_LDLIBS += $(hostLdLibs)
189LOCAL_CFLAGS += $(cFlags)
190LOCAL_CPPFLAGS += $(cppFlags)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800191LOCAL_C_INCLUDES += $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800192
193include $(BUILD_HOST_EXECUTABLE)
194
195endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK