• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
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#
16LOCAL_PATH:= $(call my-dir)
17
18# ==========================================================
19# Setup some common variables for the different build
20# targets here.
21# ==========================================================
22
23main := Main.cpp
24sources := \
25	compile/IdAssigner.cpp \
26	compile/Png.cpp \
27	compile/PseudolocaleGenerator.cpp \
28	compile/Pseudolocalizer.cpp \
29	compile/XmlIdCollector.cpp \
30	filter/ConfigFilter.cpp \
31	flatten/Archive.cpp \
32	flatten/TableFlattener.cpp \
33	flatten/XmlFlattener.cpp \
34	io/FileSystem.cpp \
35	io/ZipArchive.cpp \
36	link/AutoVersioner.cpp \
37	link/ManifestFixer.cpp \
38	link/ProductFilter.cpp \
39	link/PrivateAttributeMover.cpp \
40	link/ReferenceLinker.cpp \
41	link/TableMerger.cpp \
42	link/XmlReferenceLinker.cpp \
43	process/SymbolTable.cpp \
44	proto/ProtoHelpers.cpp \
45	proto/TableProtoDeserializer.cpp \
46	proto/TableProtoSerializer.cpp \
47	split/TableSplitter.cpp \
48	unflatten/BinaryResourceParser.cpp \
49	unflatten/ResChunkPullParser.cpp \
50	util/BigBuffer.cpp \
51	util/Files.cpp \
52	util/Util.cpp \
53	ConfigDescription.cpp \
54	Debug.cpp \
55	Flags.cpp \
56	java/AnnotationProcessor.cpp \
57	java/ClassDefinition.cpp \
58	java/JavaClassGenerator.cpp \
59	java/ManifestClassGenerator.cpp \
60	java/ProguardRules.cpp \
61	Locale.cpp \
62	Resource.cpp \
63	ResourceParser.cpp \
64	ResourceTable.cpp \
65	ResourceUtils.cpp \
66	ResourceValues.cpp \
67	SdkConstants.cpp \
68	StringPool.cpp \
69	xml/XmlActionExecutor.cpp \
70	xml/XmlDom.cpp \
71	xml/XmlPullParser.cpp \
72	xml/XmlUtil.cpp
73
74sources += Format.proto
75
76testSources := \
77	compile/IdAssigner_test.cpp \
78	compile/PseudolocaleGenerator_test.cpp \
79	compile/Pseudolocalizer_test.cpp \
80	compile/XmlIdCollector_test.cpp \
81	filter/ConfigFilter_test.cpp \
82	flatten/TableFlattener_test.cpp \
83	flatten/XmlFlattener_test.cpp \
84	link/AutoVersioner_test.cpp \
85	link/ManifestFixer_test.cpp \
86	link/PrivateAttributeMover_test.cpp \
87	link/ProductFilter_test.cpp \
88	link/ReferenceLinker_test.cpp \
89	link/TableMerger_test.cpp \
90	link/XmlReferenceLinker_test.cpp \
91	process/SymbolTable_test.cpp \
92	proto/TableProtoSerializer_test.cpp \
93	split/TableSplitter_test.cpp \
94	util/BigBuffer_test.cpp \
95	util/Files_test.cpp \
96	util/Maybe_test.cpp \
97	util/StringPiece_test.cpp \
98	util/Util_test.cpp \
99	ConfigDescription_test.cpp \
100	java/AnnotationProcessor_test.cpp \
101	java/JavaClassGenerator_test.cpp \
102	java/ManifestClassGenerator_test.cpp \
103	Locale_test.cpp \
104	Resource_test.cpp \
105	ResourceParser_test.cpp \
106	ResourceTable_test.cpp \
107	ResourceUtils_test.cpp \
108	SdkConstants_test.cpp \
109	StringPool_test.cpp \
110	ValueVisitor_test.cpp \
111	xml/XmlActionExecutor_test.cpp \
112	xml/XmlDom_test.cpp \
113	xml/XmlPullParser_test.cpp \
114	xml/XmlUtil_test.cpp
115
116toolSources := \
117	compile/Compile.cpp \
118	diff/Diff.cpp \
119	dump/Dump.cpp \
120	link/Link.cpp
121
122hostLdLibs :=
123
124hostStaticLibs := \
125	libandroidfw \
126	libutils \
127	liblog \
128	libcutils \
129	libexpat \
130	libziparchive-host \
131	libpng \
132	libbase \
133	libprotobuf-cpp-lite_static
134
135
136# 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
141
142cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
143cFlags_darwin := -D_DARWIN_UNLIMITED_STREAMS
144cFlags_windows := -Wno-maybe-uninitialized # Incorrectly marking use of Maybe.value() as error.
145cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
146protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST)
147
148# ==========================================================
149# 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# ==========================================================
155# Build the host static library: libaapt2
156# ==========================================================
157include $(CLEAR_VARS)
158LOCAL_MODULE := libaapt2
159LOCAL_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)
166LOCAL_SRC_FILES := $(sources)
167LOCAL_STATIC_LIBRARIES := $(hostStaticLibs)
168LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
169include $(BUILD_HOST_STATIC_LIBRARY)
170
171# ==========================================================
172# Build the host tests: libaapt2_tests
173# ==========================================================
174include $(CLEAR_VARS)
175LOCAL_MODULE := libaapt2_tests
176LOCAL_MODULE_TAGS := tests
177LOCAL_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)
183LOCAL_SRC_FILES := $(testSources)
184LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
185LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
186LOCAL_LDLIBS := $(hostLdLibs)
187LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
188LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
189include $(BUILD_HOST_NATIVE_TEST)
190
191# ==========================================================
192# Build the host executable: aapt2
193# ==========================================================
194include $(CLEAR_VARS)
195LOCAL_MODULE := aapt2
196LOCAL_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)
202LOCAL_SRC_FILES := $(main) $(toolSources)
203LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs)
204LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
205LOCAL_LDLIBS := $(hostLdLibs)
206LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
207LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
208include $(BUILD_HOST_EXECUTABLE)
209
210ifeq ($(ONE_SHOT_MAKEFILE),)
211include $(call all-makefiles-under,$(LOCAL_PATH))
212endif
213