blob: 1efd2ed6446cb73f8b490be499c74b1ad35dc74f [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 Lesinski21efb682016-09-14 17:35:43 -070027 compile/NinePatch.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070028 compile/Png.cpp \
Adam Lesinski21efb682016-09-14 17:35:43 -070029 compile/PngChunkFilter.cpp \
30 compile/PngCrunch.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080031 compile/PseudolocaleGenerator.cpp \
32 compile/Pseudolocalizer.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070033 compile/XmlIdCollector.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080034 filter/ConfigFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070035 flatten/Archive.cpp \
36 flatten/TableFlattener.cpp \
37 flatten/XmlFlattener.cpp \
Adam Lesinski5eeaadd2016-08-25 12:26:56 -070038 io/File.cpp \
Adam Lesinskia6fe3452015-12-09 15:20:52 -080039 io/FileSystem.cpp \
Adam Lesinski21efb682016-09-14 17:35:43 -070040 io/Io.cpp \
Adam Lesinskia6fe3452015-12-09 15:20:52 -080041 io/ZipArchive.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070042 link/AutoVersioner.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080043 link/ManifestFixer.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080044 link/ProductFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070045 link/PrivateAttributeMover.cpp \
46 link/ReferenceLinker.cpp \
Alexandria Cornwall77788eb2016-09-06 15:16:49 -070047 link/ResourceDeduper.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070048 link/TableMerger.cpp \
Adam Lesinskifb6312f2016-06-28 14:40:32 -070049 link/VersionCollapser.cpp \
Alexandria Cornwalla7cc3f12016-08-16 13:33:32 -070050 link/XmlNamespaceRemover.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070051 link/XmlReferenceLinker.cpp \
52 process/SymbolTable.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080053 proto/ProtoHelpers.cpp \
54 proto/TableProtoDeserializer.cpp \
55 proto/TableProtoSerializer.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080056 split/TableSplitter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070057 unflatten/BinaryResourceParser.cpp \
58 unflatten/ResChunkPullParser.cpp \
59 util/BigBuffer.cpp \
60 util/Files.cpp \
61 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080062 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070063 Debug.cpp \
Alexandria Cornwall77788eb2016-09-06 15:16:49 -070064 DominatorTree.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070065 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070066 java/AnnotationProcessor.cpp \
Adam Lesinski6cbfb1d2016-03-31 13:33:02 -070067 java/ClassDefinition.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070068 java/JavaClassGenerator.cpp \
69 java/ManifestClassGenerator.cpp \
70 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080071 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080072 Resource.cpp \
73 ResourceParser.cpp \
74 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070075 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080076 ResourceValues.cpp \
77 SdkConstants.cpp \
78 StringPool.cpp \
Adam Lesinskicc5609d2016-04-05 12:41:07 -070079 xml/XmlActionExecutor.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080080 xml/XmlDom.cpp \
81 xml/XmlPullParser.cpp \
82 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080083
Adam Lesinski59e04c62016-02-04 15:59:23 -080084sources += Format.proto
85
Paulo Casanova25596082016-10-07 12:00:26 +010086sourcesJni := jni/aapt2_jni.cpp
Paulo Casanovac7ca55e2016-09-23 20:52:31 +010087
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080088testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070089 compile/IdAssigner_test.cpp \
Adam Lesinski5eeaadd2016-08-25 12:26:56 -070090 compile/InlineXmlFormatParser_test.cpp \
Adam Lesinski21efb682016-09-14 17:35:43 -070091 compile/NinePatch_test.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080092 compile/PseudolocaleGenerator_test.cpp \
93 compile/Pseudolocalizer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070094 compile/XmlIdCollector_test.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080095 filter/ConfigFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070096 flatten/TableFlattener_test.cpp \
97 flatten/XmlFlattener_test.cpp \
98 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080099 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700100 link/PrivateAttributeMover_test.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800101 link/ProductFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700102 link/ReferenceLinker_test.cpp \
Alexandria Cornwall77788eb2016-09-06 15:16:49 -0700103 link/ResourceDeduper_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700104 link/TableMerger_test.cpp \
Adam Lesinskifb6312f2016-06-28 14:40:32 -0700105 link/VersionCollapser_test.cpp \
Alexandria Cornwalla7cc3f12016-08-16 13:33:32 -0700106 link/XmlNamespaceRemover_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700107 link/XmlReferenceLinker_test.cpp \
108 process/SymbolTable_test.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800109 proto/TableProtoSerializer_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -0800110 split/TableSplitter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700111 util/BigBuffer_test.cpp \
Adam Lesinski96917c22016-03-09 13:11:25 -0800112 util/Files_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700113 util/Maybe_test.cpp \
114 util/StringPiece_test.cpp \
115 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800116 ConfigDescription_test.cpp \
Alexandria Cornwall77788eb2016-09-06 15:16:49 -0700117 DominatorTree_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -0800118 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -0700119 java/JavaClassGenerator_test.cpp \
120 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800121 Locale_test.cpp \
Adam Lesinskid0f116b2016-07-08 15:00:32 -0700122 NameMangler_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800123 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700124 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800125 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700126 ResourceUtils_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -0800127 SdkConstants_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800128 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700129 ValueVisitor_test.cpp \
Adam Lesinskicc5609d2016-04-05 12:41:07 -0700130 xml/XmlActionExecutor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -0800131 xml/XmlDom_test.cpp \
132 xml/XmlPullParser_test.cpp \
133 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700134
135toolSources := \
136 compile/Compile.cpp \
Adam Lesinski458b8772016-04-25 14:20:21 -0700137 diff/Diff.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800138 dump/Dump.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700139 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800140
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700141hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800142
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800143hostStaticLibs := \
144 libandroidfw \
145 libutils \
146 liblog \
147 libcutils \
148 libexpat \
Colin Cross9a1a3bc2016-08-26 11:15:17 -0700149 libziparchive \
Narayan Kamath231e0542015-04-29 16:32:23 +0100150 libpng \
Adam Lesinskif4ab6122016-03-10 19:24:00 -0800151 libbase \
Dan Willemsen2005edf2016-07-31 22:48:28 -0700152 libprotobuf-cpp-lite
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800153
Adam Lesinski59e04c62016-02-04 15:59:23 -0800154
Adam Lesinski803c7c82016-04-06 16:09:43 -0700155# Statically link libz for MinGW (Win SDK under Linux),
156# and dynamically link for all others.
157hostStaticLibs_windows := libz
158hostLdLibs_linux := -lz
159hostLdLibs_darwin := -lz
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700160
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700161cFlags := -Wall -Werror -Wno-unused-parameter
Adam Lesinski803c7c82016-04-06 16:09:43 -0700162cFlags_darwin := -D_DARWIN_UNLIMITED_STREAMS
163cFlags_windows := -Wno-maybe-uninitialized # Incorrectly marking use of Maybe.value() as error.
Elliott Hughesc08e32e2016-10-07 15:57:17 -0700164cppFlags := -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski59e04c62016-02-04 15:59:23 -0800165protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800166
167# ==========================================================
Adam Lesinski803c7c82016-04-06 16:09:43 -0700168# NOTE: Do not add any shared libraries.
169# AAPT2 is built to run on many environments
170# that may not have the required dependencies.
171# ==========================================================
172
173# ==========================================================
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800174# Build the host static library: libaapt2
175# ==========================================================
176include $(CLEAR_VARS)
177LOCAL_MODULE := libaapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700178LOCAL_MODULE_CLASS := STATIC_LIBRARIES
179LOCAL_MODULE_HOST_OS := darwin linux windows
180LOCAL_CFLAGS := $(cFlags)
181LOCAL_CFLAGS_darwin := $(cFlags_darwin)
182LOCAL_CFLAGS_windows := $(cFlags_windows)
183LOCAL_CPPFLAGS := $(cppFlags)
184LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800185LOCAL_SRC_FILES := $(sources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700186LOCAL_STATIC_LIBRARIES := $(hostStaticLibs)
187LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800188include $(BUILD_HOST_STATIC_LIBRARY)
189
Paulo Casanovac7ca55e2016-09-23 20:52:31 +0100190
191# ==========================================================
192# Build the host shared library: libaapt2_jni
193# ==========================================================
194include $(CLEAR_VARS)
195LOCAL_MODULE := libaapt2_jni
196LOCAL_MODULE_CLASS := SHARED_LIBRARIES
Paulo Casanova3497b262016-11-01 17:07:06 +0000197LOCAL_MODULE_HOST_OS := darwin linux windows
Paulo Casanovac7ca55e2016-09-23 20:52:31 +0100198LOCAL_CFLAGS := $(cFlags)
199LOCAL_CFLAGS_darwin := $(cFlags_darwin)
200LOCAL_CFLAGS_windows := $(cFlags_windows)
201LOCAL_CPPFLAGS := $(cppFlags)
202LOCAL_C_INCLUDES := $(protoIncludes)
Paulo Casanova25596082016-10-07 12:00:26 +0100203LOCAL_SRC_FILES := $(toolSources) $(sourcesJni)
Paulo Casanova3497b262016-11-01 17:07:06 +0000204LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
Paulo Casanovac7ca55e2016-09-23 20:52:31 +0100205LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
Paulo Casanova25596082016-10-07 12:00:26 +0100206LOCAL_LDLIBS := $(hostLdLibs)
207LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
208LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Paulo Casanovac7ca55e2016-09-23 20:52:31 +0100209include $(BUILD_HOST_SHARED_LIBRARY)
210
211
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800212# ==========================================================
213# Build the host tests: libaapt2_tests
214# ==========================================================
215include $(CLEAR_VARS)
216LOCAL_MODULE := libaapt2_tests
217LOCAL_MODULE_TAGS := tests
Adam Lesinski803c7c82016-04-06 16:09:43 -0700218LOCAL_MODULE_HOST_OS := darwin linux windows
219LOCAL_CFLAGS := $(cFlags)
220LOCAL_CFLAGS_darwin := $(cFlags_darwin)
221LOCAL_CFLAGS_windows := $(cFlags_windows)
222LOCAL_CPPFLAGS := $(cppFlags)
223LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800224LOCAL_SRC_FILES := $(testSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700225LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
226LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
227LOCAL_LDLIBS := $(hostLdLibs)
228LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
229LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800230include $(BUILD_HOST_NATIVE_TEST)
231
232# ==========================================================
233# Build the host executable: aapt2
234# ==========================================================
235include $(CLEAR_VARS)
236LOCAL_MODULE := aapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700237LOCAL_MODULE_HOST_OS := darwin linux windows
238LOCAL_CFLAGS := $(cFlags)
239LOCAL_CFLAGS_darwin := $(cFlags_darwin)
240LOCAL_CFLAGS_windows := $(cFlags_windows)
241LOCAL_CPPFLAGS := $(cppFlags)
242LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700243LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700244LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
245LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
246LOCAL_LDLIBS := $(hostLdLibs)
247LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
248LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800249include $(BUILD_HOST_EXECUTABLE)
250
Adam Lesinski64587af2016-02-18 18:33:06 -0800251ifeq ($(ONE_SHOT_MAKEFILE),)
252include $(call all-makefiles-under,$(LOCAL_PATH))
253endif