Android.mk revision 59e04c6f92da584b322c87072f18e6cab4de4c60
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#
16
17# This tool is prebuilt if we're doing an app-only build.
18ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
19
20# ==========================================================
21# Setup some common variables for the different build
22# targets here.
23# ==========================================================
24LOCAL_PATH:= $(call my-dir)
25
26main := Main.cpp
27sources := \
28	compile/IdAssigner.cpp \
29	compile/Png.cpp \
30	compile/PseudolocaleGenerator.cpp \
31	compile/Pseudolocalizer.cpp \
32	compile/XmlIdCollector.cpp \
33	filter/ConfigFilter.cpp \
34	flatten/Archive.cpp \
35	flatten/TableFlattener.cpp \
36	flatten/XmlFlattener.cpp \
37	io/FileSystem.cpp \
38	io/ZipArchive.cpp \
39	link/AutoVersioner.cpp \
40	link/ManifestFixer.cpp \
41	link/PrivateAttributeMover.cpp \
42	link/ReferenceLinker.cpp \
43	link/TableMerger.cpp \
44	link/XmlReferenceLinker.cpp \
45	process/SymbolTable.cpp \
46	proto/ProtoHelpers.cpp \
47	proto/TableProtoDeserializer.cpp \
48	proto/TableProtoSerializer.cpp \
49	unflatten/BinaryResourceParser.cpp \
50	unflatten/ResChunkPullParser.cpp \
51	util/BigBuffer.cpp \
52	util/Files.cpp \
53	util/Util.cpp \
54	ConfigDescription.cpp \
55	Debug.cpp \
56	Flags.cpp \
57	java/AnnotationProcessor.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/XmlDom.cpp \
70	xml/XmlPullParser.cpp \
71	xml/XmlUtil.cpp
72
73sources += Format.proto
74
75testSources := \
76	compile/IdAssigner_test.cpp \
77	compile/PseudolocaleGenerator_test.cpp \
78	compile/Pseudolocalizer_test.cpp \
79	compile/XmlIdCollector_test.cpp \
80	filter/ConfigFilter_test.cpp \
81	flatten/TableFlattener_test.cpp \
82	flatten/XmlFlattener_test.cpp \
83	link/AutoVersioner_test.cpp \
84	link/ManifestFixer_test.cpp \
85	link/PrivateAttributeMover_test.cpp \
86	link/ReferenceLinker_test.cpp \
87	link/TableMerger_test.cpp \
88	link/XmlReferenceLinker_test.cpp \
89	process/SymbolTable_test.cpp \
90	proto/TableProtoSerializer_test.cpp \
91	util/BigBuffer_test.cpp \
92	util/Maybe_test.cpp \
93	util/StringPiece_test.cpp \
94	util/Util_test.cpp \
95	ConfigDescription_test.cpp \
96	java/AnnotationProcessor_test.cpp \
97	java/JavaClassGenerator_test.cpp \
98	java/ManifestClassGenerator_test.cpp \
99	Locale_test.cpp \
100	Resource_test.cpp \
101	ResourceParser_test.cpp \
102	ResourceTable_test.cpp \
103	ResourceUtils_test.cpp \
104	StringPool_test.cpp \
105	ValueVisitor_test.cpp \
106	xml/XmlDom_test.cpp \
107	xml/XmlPullParser_test.cpp \
108	xml/XmlUtil_test.cpp
109
110toolSources := \
111	compile/Compile.cpp \
112	dump/Dump.cpp \
113	link/Link.cpp
114
115hostLdLibs :=
116
117hostStaticLibs := \
118	libandroidfw \
119	libutils \
120	liblog \
121	libcutils \
122	libexpat \
123	libziparchive-host \
124	libpng \
125	libbase
126
127hostSharedLibs := \
128	libprotobuf-cpp-lite
129
130ifneq ($(strip $(USE_MINGW)),)
131	hostStaticLibs += libz
132else
133	hostLdLibs += -lz
134endif
135
136cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
137cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
138protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST)
139
140# ==========================================================
141# Build the host static library: libaapt2
142# ==========================================================
143include $(CLEAR_VARS)
144LOCAL_MODULE_CLASS := STATIC_LIBRARIES
145LOCAL_MODULE := libaapt2
146
147LOCAL_SRC_FILES := $(sources)
148LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
149LOCAL_CFLAGS += $(cFlags)
150LOCAL_CPPFLAGS += $(cppFlags)
151LOCAL_C_INCLUDES += $(protoIncludes)
152
153include $(BUILD_HOST_STATIC_LIBRARY)
154
155# ==========================================================
156# Build the host tests: libaapt2_tests
157# ==========================================================
158include $(CLEAR_VARS)
159LOCAL_MODULE := libaapt2_tests
160LOCAL_MODULE_TAGS := tests
161
162LOCAL_SRC_FILES := $(testSources)
163
164LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
165LOCAL_SHARED_LIBRARIES += $(hostSharedLibs)
166LOCAL_LDLIBS += $(hostLdLibs)
167LOCAL_CFLAGS += $(cFlags)
168LOCAL_CPPFLAGS += $(cppFlags)
169LOCAL_C_INCLUDES += $(protoIncludes)
170
171include $(BUILD_HOST_NATIVE_TEST)
172
173# ==========================================================
174# Build the host executable: aapt2
175# ==========================================================
176include $(CLEAR_VARS)
177LOCAL_MODULE := aapt2
178
179LOCAL_SRC_FILES := $(main) $(toolSources)
180
181LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
182LOCAL_SHARED_LIBRARIES += $(hostSharedLibs)
183LOCAL_LDLIBS += $(hostLdLibs)
184LOCAL_CFLAGS += $(cFlags)
185LOCAL_CPPFLAGS += $(cppFlags)
186LOCAL_C_INCLUDES += $(protoIncludes)
187
188include $(BUILD_HOST_EXECUTABLE)
189
190endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
191