blob: 53225da1456982dce795e99b4ba95f36b95570d8 [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 \
42 link/XmlReferenceLinker.cpp \
43 process/SymbolTable.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080044 proto/ProtoHelpers.cpp \
45 proto/TableProtoDeserializer.cpp \
46 proto/TableProtoSerializer.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080047 split/TableSplitter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070048 unflatten/BinaryResourceParser.cpp \
49 unflatten/ResChunkPullParser.cpp \
50 util/BigBuffer.cpp \
51 util/Files.cpp \
52 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080053 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070054 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070055 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070056 java/AnnotationProcessor.cpp \
Adam Lesinski6cbfb1d2016-03-31 13:33:02 -070057 java/ClassDefinition.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070058 java/JavaClassGenerator.cpp \
59 java/ManifestClassGenerator.cpp \
60 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080061 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080062 Resource.cpp \
63 ResourceParser.cpp \
64 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070065 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080066 ResourceValues.cpp \
67 SdkConstants.cpp \
68 StringPool.cpp \
Adam Lesinskicc5609d2016-04-05 12:41:07 -070069 xml/XmlActionExecutor.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080070 xml/XmlDom.cpp \
71 xml/XmlPullParser.cpp \
72 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080073
Adam Lesinski59e04c62016-02-04 15:59:23 -080074sources += Format.proto
75
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080076testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070077 compile/IdAssigner_test.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080078 compile/PseudolocaleGenerator_test.cpp \
79 compile/Pseudolocalizer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070080 compile/XmlIdCollector_test.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080081 filter/ConfigFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070082 flatten/TableFlattener_test.cpp \
83 flatten/XmlFlattener_test.cpp \
84 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080085 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070086 link/PrivateAttributeMover_test.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080087 link/ProductFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070088 link/ReferenceLinker_test.cpp \
89 link/TableMerger_test.cpp \
90 link/XmlReferenceLinker_test.cpp \
91 process/SymbolTable_test.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080092 proto/TableProtoSerializer_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080093 split/TableSplitter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070094 util/BigBuffer_test.cpp \
Adam Lesinski96917c22016-03-09 13:11:25 -080095 util/Files_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070096 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 Lesinskicc5609d2016-04-05 12:41:07 -0700111 xml/XmlActionExecutor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -0800112 xml/XmlDom_test.cpp \
113 xml/XmlPullParser_test.cpp \
114 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700115
116toolSources := \
117 compile/Compile.cpp \
Adam Lesinski458b8772016-04-25 14:20:21 -0700118 diff/Diff.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800119 dump/Dump.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700120 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800121
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700122hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800123
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800124hostStaticLibs := \
125 libandroidfw \
126 libutils \
127 liblog \
128 libcutils \
129 libexpat \
Colin Cross9a1a3bc2016-08-26 11:15:17 -0700130 libziparchive \
Narayan Kamath231e0542015-04-29 16:32:23 +0100131 libpng \
Adam Lesinskif4ab6122016-03-10 19:24:00 -0800132 libbase \
Dan Willemsen2005edf2016-07-31 22:48:28 -0700133 libprotobuf-cpp-lite
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800134
Adam Lesinski59e04c62016-02-04 15:59:23 -0800135
Adam Lesinski803c7c82016-04-06 16:09:43 -0700136# Statically link libz for MinGW (Win SDK under Linux),
137# and dynamically link for all others.
138hostStaticLibs_windows := libz
139hostLdLibs_linux := -lz
140hostLdLibs_darwin := -lz
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700141
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800142cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski803c7c82016-04-06 16:09:43 -0700143cFlags_darwin := -D_DARWIN_UNLIMITED_STREAMS
144cFlags_windows := -Wno-maybe-uninitialized # Incorrectly marking use of Maybe.value() as error.
Elliott Hughesc08e32e2016-10-07 15:57:17 -0700145cppFlags := -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski59e04c62016-02-04 15:59:23 -0800146protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800147
148# ==========================================================
Adam Lesinski803c7c82016-04-06 16:09:43 -0700149# NOTE: Do not add any shared libraries.
150# AAPT2 is built to run on many environments
151# that may not have the required dependencies.
152# ==========================================================
153
154# ==========================================================
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800155# Build the host static library: libaapt2
156# ==========================================================
157include $(CLEAR_VARS)
158LOCAL_MODULE := libaapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700159LOCAL_MODULE_CLASS := STATIC_LIBRARIES
160LOCAL_MODULE_HOST_OS := darwin linux windows
161LOCAL_CFLAGS := $(cFlags)
162LOCAL_CFLAGS_darwin := $(cFlags_darwin)
163LOCAL_CFLAGS_windows := $(cFlags_windows)
164LOCAL_CPPFLAGS := $(cppFlags)
165LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800166LOCAL_SRC_FILES := $(sources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700167LOCAL_STATIC_LIBRARIES := $(hostStaticLibs)
168LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800169include $(BUILD_HOST_STATIC_LIBRARY)
170
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800171# ==========================================================
172# Build the host tests: libaapt2_tests
173# ==========================================================
174include $(CLEAR_VARS)
175LOCAL_MODULE := libaapt2_tests
176LOCAL_MODULE_TAGS := tests
Adam Lesinski803c7c82016-04-06 16:09:43 -0700177LOCAL_MODULE_HOST_OS := darwin linux windows
178LOCAL_CFLAGS := $(cFlags)
179LOCAL_CFLAGS_darwin := $(cFlags_darwin)
180LOCAL_CFLAGS_windows := $(cFlags_windows)
181LOCAL_CPPFLAGS := $(cppFlags)
182LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800183LOCAL_SRC_FILES := $(testSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700184LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
185LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
186LOCAL_LDLIBS := $(hostLdLibs)
187LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
188LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800189include $(BUILD_HOST_NATIVE_TEST)
190
191# ==========================================================
192# Build the host executable: aapt2
193# ==========================================================
194include $(CLEAR_VARS)
195LOCAL_MODULE := aapt2
Adam Lesinski803c7c82016-04-06 16:09:43 -0700196LOCAL_MODULE_HOST_OS := darwin linux windows
197LOCAL_CFLAGS := $(cFlags)
198LOCAL_CFLAGS_darwin := $(cFlags_darwin)
199LOCAL_CFLAGS_windows := $(cFlags_windows)
200LOCAL_CPPFLAGS := $(cppFlags)
201LOCAL_C_INCLUDES := $(protoIncludes)
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700202LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski803c7c82016-04-06 16:09:43 -0700203LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
204LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
205LOCAL_LDLIBS := $(hostLdLibs)
206LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
207LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800208include $(BUILD_HOST_EXECUTABLE)
209
Adam Lesinski64587af2016-02-18 18:33:06 -0800210ifeq ($(ONE_SHOT_MAKEFILE),)
211include $(call all-makefiles-under,$(LOCAL_PATH))
212endif