blob: 60114fb6ff99b40c6199eaba4b2f6b74be21b55b [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#
Adam Lesinski64587af2016-02-18 18:33:06 -080016LOCAL_PATH:= $(call my-dir)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080017
18# ==========================================================
19# Setup some common variables for the different build
20# targets here.
21# ==========================================================
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080022
23main := Main.cpp
24sources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070025 compile/IdAssigner.cpp \
Adam Lesinski5eeaadd2016-08-25 12:26:56 -070026 compile/InlineXmlFormatParser.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070027 compile/Png.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080028 compile/PseudolocaleGenerator.cpp \
29 compile/Pseudolocalizer.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070030 compile/XmlIdCollector.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080031 filter/ConfigFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070032 flatten/Archive.cpp \
33 flatten/TableFlattener.cpp \
34 flatten/XmlFlattener.cpp \
Adam Lesinski5eeaadd2016-08-25 12:26:56 -070035 io/File.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 Lesinskie4bb9eb2016-02-12 22:18:51 -080040 link/ProductFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070041 link/PrivateAttributeMover.cpp \
42 link/ReferenceLinker.cpp \
43 link/TableMerger.cpp \
Adam Lesinskifb6312f2016-06-28 14:40:32 -070044 link/VersionCollapser.cpp \
Alexandria Cornwalla7cc3f12016-08-16 13:33:32 -070045 link/XmlNamespaceRemover.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070046 link/XmlReferenceLinker.cpp \
47 process/SymbolTable.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080048 proto/ProtoHelpers.cpp \
49 proto/TableProtoDeserializer.cpp \
50 proto/TableProtoSerializer.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080051 split/TableSplitter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070052 unflatten/BinaryResourceParser.cpp \
53 unflatten/ResChunkPullParser.cpp \
54 util/BigBuffer.cpp \
55 util/Files.cpp \
56 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080057 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070058 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070059 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070060 java/AnnotationProcessor.cpp \
Adam Lesinski6cbfb1d2016-03-31 13:33:02 -070061 java/ClassDefinition.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070062 java/JavaClassGenerator.cpp \
63 java/ManifestClassGenerator.cpp \
64 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080065 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080066 Resource.cpp \
67 ResourceParser.cpp \
68 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070069 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080070 ResourceValues.cpp \
71 SdkConstants.cpp \
72 StringPool.cpp \
Adam Lesinskicc5609d2016-04-05 12:41:07 -070073 xml/XmlActionExecutor.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080074 xml/XmlDom.cpp \
75 xml/XmlPullParser.cpp \
76 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080077
Adam Lesinski59e04c62016-02-04 15:59:23 -080078sources += Format.proto
79
Paulo Casanovac7ca55e2016-09-23 20:52:31 +010080sourcesJni :=
81
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080082testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070083 compile/IdAssigner_test.cpp \
Adam Lesinski5eeaadd2016-08-25 12:26:56 -070084 compile/InlineXmlFormatParser_test.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080085 compile/PseudolocaleGenerator_test.cpp \
86 compile/Pseudolocalizer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070087 compile/XmlIdCollector_test.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080088 filter/ConfigFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070089 flatten/TableFlattener_test.cpp \
90 flatten/XmlFlattener_test.cpp \
91 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080092 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070093 link/PrivateAttributeMover_test.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080094 link/ProductFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070095 link/ReferenceLinker_test.cpp \
96 link/TableMerger_test.cpp \
Adam Lesinskifb6312f2016-06-28 14:40:32 -070097 link/VersionCollapser_test.cpp \
Alexandria Cornwalla7cc3f12016-08-16 13:33:32 -070098 link/XmlNamespaceRemover_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070099 link/XmlReferenceLinker_test.cpp \
100 process/SymbolTable_test.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800101 proto/TableProtoSerializer_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -0800102 split/TableSplitter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700103 util/BigBuffer_test.cpp \
Adam Lesinski96917c22016-03-09 13:11:25 -0800104 util/Files_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700105 util/Maybe_test.cpp \
106 util/StringPiece_test.cpp \
107 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800108 ConfigDescription_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -0800109 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -0700110 java/JavaClassGenerator_test.cpp \
111 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800112 Locale_test.cpp \
Adam Lesinskid0f116b2016-07-08 15:00:32 -0700113 NameMangler_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800114 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700115 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800116 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700117 ResourceUtils_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -0800118 SdkConstants_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800119 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700120 ValueVisitor_test.cpp \
Adam Lesinskicc5609d2016-04-05 12:41:07 -0700121 xml/XmlActionExecutor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -0800122 xml/XmlDom_test.cpp \
123 xml/XmlPullParser_test.cpp \
124 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700125
126toolSources := \
127 compile/Compile.cpp \
Adam Lesinski458b8772016-04-25 14:20:21 -0700128 diff/Diff.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800129 dump/Dump.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700130 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800131
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700132hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800133
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800134hostStaticLibs := \
135 libandroidfw \
136 libutils \
137 liblog \
138 libcutils \
139 libexpat \
Colin Cross9a1a3bc2016-08-26 11:15:17 -0700140 libziparchive \
Narayan Kamath231e0542015-04-29 16:32:23 +0100141 libpng \
Adam Lesinskif4ab6122016-03-10 19:24:00 -0800142 libbase \
Dan Willemsen2005edf2016-07-31 22:48:28 -0700143 libprotobuf-cpp-lite
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800144
Adam Lesinski59e04c62016-02-04 15:59:23 -0800145
Adam Lesinski803c7c82016-04-06 16:09:43 -0700146# Statically link libz for MinGW (Win SDK under Linux),
147# and dynamically link for all others.
148hostStaticLibs_windows := libz
149hostLdLibs_linux := -lz
150hostLdLibs_darwin := -lz
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700151
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800152cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski803c7c82016-04-06 16:09:43 -0700153cFlags_darwin := -D_DARWIN_UNLIMITED_STREAMS
154cFlags_windows := -Wno-maybe-uninitialized # Incorrectly marking use of Maybe.value() as error.
155cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski59e04c62016-02-04 15:59:23 -0800156protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800157
158# ==========================================================
Adam Lesinski803c7c82016-04-06 16:09:43 -0700159# NOTE: Do not add any shared libraries.
160# AAPT2 is built to run on many environments
161# that may not have the required dependencies.
162# ==========================================================
163
164# ==========================================================
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800165# Build the host static library: libaapt2
166# ==========================================================
167include $(CLEAR_VARS)
168LOCAL_MODULE := libaapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700169LOCAL_MODULE_CLASS := STATIC_LIBRARIES
170LOCAL_MODULE_HOST_OS := darwin linux windows
171LOCAL_CFLAGS := $(cFlags)
172LOCAL_CFLAGS_darwin := $(cFlags_darwin)
173LOCAL_CFLAGS_windows := $(cFlags_windows)
174LOCAL_CPPFLAGS := $(cppFlags)
175LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800176LOCAL_SRC_FILES := $(sources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700177LOCAL_STATIC_LIBRARIES := $(hostStaticLibs)
178LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800179include $(BUILD_HOST_STATIC_LIBRARY)
180
Paulo Casanovac7ca55e2016-09-23 20:52:31 +0100181
182# ==========================================================
183# Build the host shared library: libaapt2_jni
184# ==========================================================
185include $(CLEAR_VARS)
186LOCAL_MODULE := libaapt2_jni
187LOCAL_MODULE_CLASS := SHARED_LIBRARIES
188LOCAL_MODULE_HOST_OS := darwin linux windows
189LOCAL_CFLAGS := $(cFlags)
190LOCAL_CFLAGS_darwin := $(cFlags_darwin)
191LOCAL_CFLAGS_windows := $(cFlags_windows)
192LOCAL_CPPFLAGS := $(cppFlags)
193LOCAL_C_INCLUDES := $(protoIncludes)
194LOCAL_SRC_FILES := $(sourcesJni)
195LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
196LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
197include $(BUILD_HOST_SHARED_LIBRARY)
198
199
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800200# ==========================================================
201# Build the host tests: libaapt2_tests
202# ==========================================================
203include $(CLEAR_VARS)
204LOCAL_MODULE := libaapt2_tests
205LOCAL_MODULE_TAGS := tests
Adam Lesinski803c7c82016-04-06 16:09:43 -0700206LOCAL_MODULE_HOST_OS := darwin linux windows
207LOCAL_CFLAGS := $(cFlags)
208LOCAL_CFLAGS_darwin := $(cFlags_darwin)
209LOCAL_CFLAGS_windows := $(cFlags_windows)
210LOCAL_CPPFLAGS := $(cppFlags)
211LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800212LOCAL_SRC_FILES := $(testSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700213LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
214LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
215LOCAL_LDLIBS := $(hostLdLibs)
216LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
217LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800218include $(BUILD_HOST_NATIVE_TEST)
219
220# ==========================================================
221# Build the host executable: aapt2
222# ==========================================================
223include $(CLEAR_VARS)
224LOCAL_MODULE := aapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700225LOCAL_MODULE_HOST_OS := darwin linux windows
226LOCAL_CFLAGS := $(cFlags)
227LOCAL_CFLAGS_darwin := $(cFlags_darwin)
228LOCAL_CFLAGS_windows := $(cFlags_windows)
229LOCAL_CPPFLAGS := $(cppFlags)
230LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700231LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700232LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
233LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
234LOCAL_LDLIBS := $(hostLdLibs)
235LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
236LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800237include $(BUILD_HOST_EXECUTABLE)
238
Adam Lesinski64587af2016-02-18 18:33:06 -0800239ifeq ($(ONE_SHOT_MAKEFILE),)
240include $(call all-makefiles-under,$(LOCAL_PATH))
241endif