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	BigBuffer.cpp \
29	BinaryResourceParser.cpp \
30	BindingXmlPullParser.cpp \
31	ConfigDescription.cpp \
32	Debug.cpp \
33	Files.cpp \
34	Flag.cpp \
35	JavaClassGenerator.cpp \
36	Linker.cpp \
37	Locale.cpp \
38	Logger.cpp \
39	ManifestMerger.cpp \
40	ManifestParser.cpp \
41	ManifestValidator.cpp \
42	Png.cpp \
43	ProguardRules.cpp \
44	ResChunkPullParser.cpp \
45	Resource.cpp \
46	ResourceParser.cpp \
47	ResourceTable.cpp \
48	ResourceTableResolver.cpp \
49	ResourceValues.cpp \
50	SdkConstants.cpp \
51	StringPool.cpp \
52	TableFlattener.cpp \
53	Util.cpp \
54	ScopedXmlPullParser.cpp \
55	SourceXmlPullParser.cpp \
56	XliffXmlPullParser.cpp \
57	XmlDom.cpp \
58	XmlFlattener.cpp \
59	ZipEntry.cpp \
60	ZipFile.cpp
61
62testSources := \
63	BigBuffer_test.cpp \
64	BindingXmlPullParser_test.cpp \
65	Compat_test.cpp \
66	ConfigDescription_test.cpp \
67	JavaClassGenerator_test.cpp \
68	Linker_test.cpp \
69	Locale_test.cpp \
70	ManifestMerger_test.cpp \
71	ManifestParser_test.cpp \
72	Maybe_test.cpp \
73	NameMangler_test.cpp \
74	ResourceParser_test.cpp \
75	Resource_test.cpp \
76	ResourceTable_test.cpp \
77	ScopedXmlPullParser_test.cpp \
78	StringPiece_test.cpp \
79	StringPool_test.cpp \
80	Util_test.cpp \
81	XliffXmlPullParser_test.cpp \
82	XmlDom_test.cpp \
83	XmlFlattener_test.cpp
84
85cIncludes := \
86	external/libpng \
87	external/libz
88
89hostLdLibs :=
90
91hostStaticLibs := \
92	libandroidfw \
93	libutils \
94	liblog \
95	libcutils \
96	libexpat \
97	libziparchive-host \
98	libpng \
99	libbase
100
101ifneq ($(strip $(USE_MINGW)),)
102	hostStaticLibs += libz
103else
104	hostLdLibs += -lz
105endif
106
107cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
108cppFlags := -std=c++11 -Wno-missing-field-initializers -Wno-unused-private-field
109
110# ==========================================================
111# Build the host static library: libaapt2
112# ==========================================================
113include $(CLEAR_VARS)
114LOCAL_MODULE := libaapt2
115
116LOCAL_SRC_FILES := $(sources)
117LOCAL_C_INCLUDES += $(cIncludes)
118LOCAL_CFLAGS += $(cFlags)
119LOCAL_CPPFLAGS += $(cppFlags)
120
121include $(BUILD_HOST_STATIC_LIBRARY)
122
123
124# ==========================================================
125# Build the host tests: libaapt2_tests
126# ==========================================================
127include $(CLEAR_VARS)
128LOCAL_MODULE := libaapt2_tests
129LOCAL_MODULE_TAGS := tests
130
131LOCAL_SRC_FILES := $(testSources)
132
133LOCAL_C_INCLUDES += $(cIncludes)
134LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
135LOCAL_LDLIBS += $(hostLdLibs)
136LOCAL_CFLAGS += $(cFlags)
137LOCAL_CPPFLAGS += $(cppFlags)
138
139include $(BUILD_HOST_NATIVE_TEST)
140
141# ==========================================================
142# Build the host executable: aapt2
143# ==========================================================
144include $(CLEAR_VARS)
145LOCAL_MODULE := aapt2
146
147LOCAL_SRC_FILES := $(main)
148
149LOCAL_C_INCLUDES += $(cIncludes)
150LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
151LOCAL_LDLIBS += $(hostLdLibs)
152LOCAL_CFLAGS += $(cFlags)
153LOCAL_CPPFLAGS += $(cppFlags)
154
155include $(BUILD_HOST_EXECUTABLE)
156
157endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
158