blob: c83a1328fcd73a052f6425fd439d418379e301c1 [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 \
47 link/TableMerger.cpp \
Adam Lesinskifb6312f2016-06-28 14:40:32 -070048 link/VersionCollapser.cpp \
Alexandria Cornwalla7cc3f12016-08-16 13:33:32 -070049 link/XmlNamespaceRemover.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070050 link/XmlReferenceLinker.cpp \
51 process/SymbolTable.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080052 proto/ProtoHelpers.cpp \
53 proto/TableProtoDeserializer.cpp \
54 proto/TableProtoSerializer.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080055 split/TableSplitter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070056 unflatten/BinaryResourceParser.cpp \
57 unflatten/ResChunkPullParser.cpp \
58 util/BigBuffer.cpp \
59 util/Files.cpp \
60 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080061 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070062 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070063 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070064 java/AnnotationProcessor.cpp \
Adam Lesinski6cbfb1d2016-03-31 13:33:02 -070065 java/ClassDefinition.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070066 java/JavaClassGenerator.cpp \
67 java/ManifestClassGenerator.cpp \
68 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080069 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080070 Resource.cpp \
71 ResourceParser.cpp \
72 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070073 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080074 ResourceValues.cpp \
75 SdkConstants.cpp \
76 StringPool.cpp \
Adam Lesinskicc5609d2016-04-05 12:41:07 -070077 xml/XmlActionExecutor.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080078 xml/XmlDom.cpp \
79 xml/XmlPullParser.cpp \
80 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080081
Adam Lesinski59e04c62016-02-04 15:59:23 -080082sources += Format.proto
83
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080084testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070085 compile/IdAssigner_test.cpp \
Adam Lesinski5eeaadd2016-08-25 12:26:56 -070086 compile/InlineXmlFormatParser_test.cpp \
Adam Lesinski21efb682016-09-14 17:35:43 -070087 compile/NinePatch_test.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080088 compile/PseudolocaleGenerator_test.cpp \
89 compile/Pseudolocalizer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070090 compile/XmlIdCollector_test.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080091 filter/ConfigFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070092 flatten/TableFlattener_test.cpp \
93 flatten/XmlFlattener_test.cpp \
94 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080095 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070096 link/PrivateAttributeMover_test.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080097 link/ProductFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070098 link/ReferenceLinker_test.cpp \
99 link/TableMerger_test.cpp \
Adam Lesinskifb6312f2016-06-28 14:40:32 -0700100 link/VersionCollapser_test.cpp \
Alexandria Cornwalla7cc3f12016-08-16 13:33:32 -0700101 link/XmlNamespaceRemover_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700102 link/XmlReferenceLinker_test.cpp \
103 process/SymbolTable_test.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800104 proto/TableProtoSerializer_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -0800105 split/TableSplitter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700106 util/BigBuffer_test.cpp \
Adam Lesinski96917c22016-03-09 13:11:25 -0800107 util/Files_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700108 util/Maybe_test.cpp \
109 util/StringPiece_test.cpp \
110 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800111 ConfigDescription_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -0800112 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -0700113 java/JavaClassGenerator_test.cpp \
114 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800115 Locale_test.cpp \
Adam Lesinskid0f116b2016-07-08 15:00:32 -0700116 NameMangler_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800117 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700118 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800119 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700120 ResourceUtils_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -0800121 SdkConstants_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800122 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700123 ValueVisitor_test.cpp \
Adam Lesinskicc5609d2016-04-05 12:41:07 -0700124 xml/XmlActionExecutor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -0800125 xml/XmlDom_test.cpp \
126 xml/XmlPullParser_test.cpp \
127 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700128
129toolSources := \
130 compile/Compile.cpp \
Adam Lesinski458b8772016-04-25 14:20:21 -0700131 diff/Diff.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800132 dump/Dump.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700133 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800134
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700135hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800136
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800137hostStaticLibs := \
138 libandroidfw \
139 libutils \
140 liblog \
141 libcutils \
142 libexpat \
Colin Cross9a1a3bc2016-08-26 11:15:17 -0700143 libziparchive \
Narayan Kamath231e0542015-04-29 16:32:23 +0100144 libpng \
Adam Lesinskif4ab6122016-03-10 19:24:00 -0800145 libbase \
Dan Willemsen2005edf2016-07-31 22:48:28 -0700146 libprotobuf-cpp-lite
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800147
Adam Lesinski59e04c62016-02-04 15:59:23 -0800148
Adam Lesinski803c7c82016-04-06 16:09:43 -0700149# Statically link libz for MinGW (Win SDK under Linux),
150# and dynamically link for all others.
151hostStaticLibs_windows := libz
152hostLdLibs_linux := -lz
153hostLdLibs_darwin := -lz
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700154
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800155cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski803c7c82016-04-06 16:09:43 -0700156cFlags_darwin := -D_DARWIN_UNLIMITED_STREAMS
157cFlags_windows := -Wno-maybe-uninitialized # Incorrectly marking use of Maybe.value() as error.
158cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski59e04c62016-02-04 15:59:23 -0800159protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800160
161# ==========================================================
Adam Lesinski803c7c82016-04-06 16:09:43 -0700162# NOTE: Do not add any shared libraries.
163# AAPT2 is built to run on many environments
164# that may not have the required dependencies.
165# ==========================================================
166
167# ==========================================================
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800168# Build the host static library: libaapt2
169# ==========================================================
170include $(CLEAR_VARS)
171LOCAL_MODULE := libaapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700172LOCAL_MODULE_CLASS := STATIC_LIBRARIES
173LOCAL_MODULE_HOST_OS := darwin linux windows
174LOCAL_CFLAGS := $(cFlags)
175LOCAL_CFLAGS_darwin := $(cFlags_darwin)
176LOCAL_CFLAGS_windows := $(cFlags_windows)
177LOCAL_CPPFLAGS := $(cppFlags)
178LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800179LOCAL_SRC_FILES := $(sources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700180LOCAL_STATIC_LIBRARIES := $(hostStaticLibs)
181LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800182include $(BUILD_HOST_STATIC_LIBRARY)
183
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800184# ==========================================================
185# Build the host tests: libaapt2_tests
186# ==========================================================
187include $(CLEAR_VARS)
188LOCAL_MODULE := libaapt2_tests
189LOCAL_MODULE_TAGS := tests
Adam Lesinski803c7c82016-04-06 16:09:43 -0700190LOCAL_MODULE_HOST_OS := darwin linux windows
191LOCAL_CFLAGS := $(cFlags)
192LOCAL_CFLAGS_darwin := $(cFlags_darwin)
193LOCAL_CFLAGS_windows := $(cFlags_windows)
194LOCAL_CPPFLAGS := $(cppFlags)
195LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800196LOCAL_SRC_FILES := $(testSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700197LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
198LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
199LOCAL_LDLIBS := $(hostLdLibs)
200LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
201LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800202include $(BUILD_HOST_NATIVE_TEST)
203
204# ==========================================================
205# Build the host executable: aapt2
206# ==========================================================
207include $(CLEAR_VARS)
208LOCAL_MODULE := aapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700209LOCAL_MODULE_HOST_OS := darwin linux windows
210LOCAL_CFLAGS := $(cFlags)
211LOCAL_CFLAGS_darwin := $(cFlags_darwin)
212LOCAL_CFLAGS_windows := $(cFlags_windows)
213LOCAL_CPPFLAGS := $(cppFlags)
214LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700215LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700216LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
217LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
218LOCAL_LDLIBS := $(hostLdLibs)
219LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
220LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800221include $(BUILD_HOST_EXECUTABLE)
222
Adam Lesinski64587af2016-02-18 18:33:06 -0800223ifeq ($(ONE_SHOT_MAKEFILE),)
224include $(call all-makefiles-under,$(LOCAL_PATH))
225endif