Android.mk revision b274e35abfbbd09e0fce983a215c11522c56cce2
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/XmlIdCollector.cpp \
31	flatten/Archive.cpp \
32	flatten/TableFlattener.cpp \
33	flatten/XmlFlattener.cpp \
34	link/AutoVersioner.cpp \
35	link/ManifestFixer.cpp \
36	link/PrivateAttributeMover.cpp \
37	link/ReferenceLinker.cpp \
38	link/TableMerger.cpp \
39	link/XmlReferenceLinker.cpp \
40	process/SymbolTable.cpp \
41	unflatten/BinaryResourceParser.cpp \
42	unflatten/ResChunkPullParser.cpp \
43	util/BigBuffer.cpp \
44	util/Files.cpp \
45	util/Util.cpp \
46	ConfigDescription.cpp \
47	Debug.cpp \
48	Flags.cpp \
49	java/AnnotationProcessor.cpp \
50	java/JavaClassGenerator.cpp \
51	java/ManifestClassGenerator.cpp \
52	java/ProguardRules.cpp \
53	Locale.cpp \
54	Resource.cpp \
55	ResourceParser.cpp \
56	ResourceTable.cpp \
57	ResourceUtils.cpp \
58	ResourceValues.cpp \
59	SdkConstants.cpp \
60	StringPool.cpp \
61	XmlDom.cpp \
62	XmlPullParser.cpp
63
64testSources := \
65	compile/IdAssigner_test.cpp \
66	compile/XmlIdCollector_test.cpp \
67	flatten/FileExportWriter_test.cpp \
68	flatten/TableFlattener_test.cpp \
69	flatten/XmlFlattener_test.cpp \
70	link/AutoVersioner_test.cpp \
71	link/ManifestFixer_test.cpp \
72	link/PrivateAttributeMover_test.cpp \
73	link/ReferenceLinker_test.cpp \
74	link/TableMerger_test.cpp \
75	link/XmlReferenceLinker_test.cpp \
76	process/SymbolTable_test.cpp \
77	unflatten/FileExportHeaderReader_test.cpp \
78	util/BigBuffer_test.cpp \
79	util/Maybe_test.cpp \
80	util/StringPiece_test.cpp \
81	util/Util_test.cpp \
82	ConfigDescription_test.cpp \
83	java/AnnotationProcessor_test.cpp \
84	java/JavaClassGenerator_test.cpp \
85	java/ManifestClassGenerator_test.cpp \
86	Locale_test.cpp \
87	Resource_test.cpp \
88	ResourceParser_test.cpp \
89	ResourceTable_test.cpp \
90	ResourceUtils_test.cpp \
91	StringPool_test.cpp \
92	ValueVisitor_test.cpp \
93	XmlDom_test.cpp \
94	XmlPullParser_test.cpp
95
96toolSources := \
97	compile/Compile.cpp \
98	link/Link.cpp
99
100hostLdLibs :=
101
102hostStaticLibs := \
103	libandroidfw \
104	libutils \
105	liblog \
106	libcutils \
107	libexpat \
108	libziparchive-host \
109	libpng \
110	libbase
111
112ifneq ($(strip $(USE_MINGW)),)
113	hostStaticLibs += libz
114else
115	hostLdLibs += -lz
116endif
117
118cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
119cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
120
121# ==========================================================
122# Build the host static library: libaapt2
123# ==========================================================
124include $(CLEAR_VARS)
125LOCAL_MODULE := libaapt2
126
127LOCAL_SRC_FILES := $(sources)
128LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
129LOCAL_CFLAGS += $(cFlags)
130LOCAL_CPPFLAGS += $(cppFlags)
131
132include $(BUILD_HOST_STATIC_LIBRARY)
133
134
135# ==========================================================
136# Build the host tests: libaapt2_tests
137# ==========================================================
138include $(CLEAR_VARS)
139LOCAL_MODULE := libaapt2_tests
140LOCAL_MODULE_TAGS := tests
141
142LOCAL_SRC_FILES := $(testSources)
143
144LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
145LOCAL_LDLIBS += $(hostLdLibs)
146LOCAL_CFLAGS += $(cFlags)
147LOCAL_CPPFLAGS += $(cppFlags)
148
149include $(BUILD_HOST_NATIVE_TEST)
150
151# ==========================================================
152# Build the host executable: aapt2
153# ==========================================================
154include $(CLEAR_VARS)
155LOCAL_MODULE := aapt2
156
157LOCAL_SRC_FILES := $(main) $(toolSources)
158
159LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
160LOCAL_LDLIBS += $(hostLdLibs)
161LOCAL_CFLAGS += $(cFlags)
162LOCAL_CPPFLAGS += $(cppFlags)
163
164include $(BUILD_HOST_EXECUTABLE)
165
166endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
167