blob: b52c530d03cb3de88b1bde6228c61da2f19d4b29 [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 \
26 compile/Png.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080027 compile/PseudolocaleGenerator.cpp \
28 compile/Pseudolocalizer.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070029 compile/XmlIdCollector.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080030 filter/ConfigFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070031 flatten/Archive.cpp \
32 flatten/TableFlattener.cpp \
33 flatten/XmlFlattener.cpp \
Adam Lesinskia6fe3452015-12-09 15:20:52 -080034 io/FileSystem.cpp \
35 io/ZipArchive.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070036 link/AutoVersioner.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080037 link/ManifestFixer.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080038 link/ProductFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070039 link/PrivateAttributeMover.cpp \
40 link/ReferenceLinker.cpp \
41 link/TableMerger.cpp \
Adam Lesinskifb6312f2016-06-28 14:40:32 -070042 link/VersionCollapser.cpp \
Alexandria Cornwalla7cc3f12016-08-16 13:33:32 -070043 link/XmlNamespaceRemover.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070044 link/XmlReferenceLinker.cpp \
45 process/SymbolTable.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080046 proto/ProtoHelpers.cpp \
47 proto/TableProtoDeserializer.cpp \
48 proto/TableProtoSerializer.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080049 split/TableSplitter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070050 unflatten/BinaryResourceParser.cpp \
51 unflatten/ResChunkPullParser.cpp \
52 util/BigBuffer.cpp \
53 util/Files.cpp \
54 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080055 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070056 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070057 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070058 java/AnnotationProcessor.cpp \
Adam Lesinski6cbfb1d2016-03-31 13:33:02 -070059 java/ClassDefinition.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070060 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 Lesinskicc5609d2016-04-05 12:41:07 -070071 xml/XmlActionExecutor.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080072 xml/XmlDom.cpp \
73 xml/XmlPullParser.cpp \
74 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080075
Adam Lesinski59e04c62016-02-04 15:59:23 -080076sources += Format.proto
77
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080078testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070079 compile/IdAssigner_test.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080080 compile/PseudolocaleGenerator_test.cpp \
81 compile/Pseudolocalizer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070082 compile/XmlIdCollector_test.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080083 filter/ConfigFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070084 flatten/TableFlattener_test.cpp \
85 flatten/XmlFlattener_test.cpp \
86 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080087 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070088 link/PrivateAttributeMover_test.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080089 link/ProductFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070090 link/ReferenceLinker_test.cpp \
91 link/TableMerger_test.cpp \
Adam Lesinskifb6312f2016-06-28 14:40:32 -070092 link/VersionCollapser_test.cpp \
Alexandria Cornwalla7cc3f12016-08-16 13:33:32 -070093 link/XmlNamespaceRemover_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070094 link/XmlReferenceLinker_test.cpp \
95 process/SymbolTable_test.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080096 proto/TableProtoSerializer_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080097 split/TableSplitter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070098 util/BigBuffer_test.cpp \
Adam Lesinski96917c22016-03-09 13:11:25 -080099 util/Files_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700100 util/Maybe_test.cpp \
101 util/StringPiece_test.cpp \
102 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800103 ConfigDescription_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -0800104 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -0700105 java/JavaClassGenerator_test.cpp \
106 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800107 Locale_test.cpp \
Adam Lesinskid0f116b2016-07-08 15:00:32 -0700108 NameMangler_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800109 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700110 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800111 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700112 ResourceUtils_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -0800113 SdkConstants_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800114 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700115 ValueVisitor_test.cpp \
Adam Lesinskicc5609d2016-04-05 12:41:07 -0700116 xml/XmlActionExecutor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -0800117 xml/XmlDom_test.cpp \
118 xml/XmlPullParser_test.cpp \
119 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700120
121toolSources := \
122 compile/Compile.cpp \
Adam Lesinski458b8772016-04-25 14:20:21 -0700123 diff/Diff.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800124 dump/Dump.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700125 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800126
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700127hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800128
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800129hostStaticLibs := \
130 libandroidfw \
131 libutils \
132 liblog \
133 libcutils \
134 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700135 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100136 libpng \
Adam Lesinskif4ab6122016-03-10 19:24:00 -0800137 libbase \
Dan Willemsen2005edf2016-07-31 22:48:28 -0700138 libprotobuf-cpp-lite
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800139
Adam Lesinski59e04c62016-02-04 15:59:23 -0800140
Adam Lesinski803c7c82016-04-06 16:09:43 -0700141# Statically link libz for MinGW (Win SDK under Linux),
142# and dynamically link for all others.
143hostStaticLibs_windows := libz
144hostLdLibs_linux := -lz
145hostLdLibs_darwin := -lz
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700146
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800147cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski803c7c82016-04-06 16:09:43 -0700148cFlags_darwin := -D_DARWIN_UNLIMITED_STREAMS
149cFlags_windows := -Wno-maybe-uninitialized # Incorrectly marking use of Maybe.value() as error.
150cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski59e04c62016-02-04 15:59:23 -0800151protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800152
153# ==========================================================
Adam Lesinski803c7c82016-04-06 16:09:43 -0700154# NOTE: Do not add any shared libraries.
155# AAPT2 is built to run on many environments
156# that may not have the required dependencies.
157# ==========================================================
158
159# ==========================================================
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800160# Build the host static library: libaapt2
161# ==========================================================
162include $(CLEAR_VARS)
163LOCAL_MODULE := libaapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700164LOCAL_MODULE_CLASS := STATIC_LIBRARIES
165LOCAL_MODULE_HOST_OS := darwin linux windows
166LOCAL_CFLAGS := $(cFlags)
167LOCAL_CFLAGS_darwin := $(cFlags_darwin)
168LOCAL_CFLAGS_windows := $(cFlags_windows)
169LOCAL_CPPFLAGS := $(cppFlags)
170LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800171LOCAL_SRC_FILES := $(sources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700172LOCAL_STATIC_LIBRARIES := $(hostStaticLibs)
173LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800174include $(BUILD_HOST_STATIC_LIBRARY)
175
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800176# ==========================================================
177# Build the host tests: libaapt2_tests
178# ==========================================================
179include $(CLEAR_VARS)
180LOCAL_MODULE := libaapt2_tests
181LOCAL_MODULE_TAGS := tests
Adam Lesinski803c7c82016-04-06 16:09:43 -0700182LOCAL_MODULE_HOST_OS := darwin linux windows
183LOCAL_CFLAGS := $(cFlags)
184LOCAL_CFLAGS_darwin := $(cFlags_darwin)
185LOCAL_CFLAGS_windows := $(cFlags_windows)
186LOCAL_CPPFLAGS := $(cppFlags)
187LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800188LOCAL_SRC_FILES := $(testSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700189LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
190LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
191LOCAL_LDLIBS := $(hostLdLibs)
192LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
193LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800194include $(BUILD_HOST_NATIVE_TEST)
195
196# ==========================================================
197# Build the host executable: aapt2
198# ==========================================================
199include $(CLEAR_VARS)
200LOCAL_MODULE := aapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700201LOCAL_MODULE_HOST_OS := darwin linux windows
202LOCAL_CFLAGS := $(cFlags)
203LOCAL_CFLAGS_darwin := $(cFlags_darwin)
204LOCAL_CFLAGS_windows := $(cFlags_windows)
205LOCAL_CPPFLAGS := $(cppFlags)
206LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700207LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700208LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
209LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
210LOCAL_LDLIBS := $(hostLdLibs)
211LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
212LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800213include $(BUILD_HOST_EXECUTABLE)
214
Adam Lesinski64587af2016-02-18 18:33:06 -0800215ifeq ($(ONE_SHOT_MAKEFILE),)
216include $(call all-makefiles-under,$(LOCAL_PATH))
217endif