blob: 8c128d3ffbb279006b9170e74fe4df743f2badbe [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#
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 \
Adam Lesinski4d3a9872015-04-09 19:53:22 -070030 BindingXmlPullParser.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080031 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070032 Debug.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080033 Files.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070034 Flag.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080035 JavaClassGenerator.cpp \
36 Linker.cpp \
37 Locale.cpp \
38 Logger.cpp \
39 ManifestParser.cpp \
40 ManifestValidator.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070041 Png.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080042 ResChunkPullParser.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080043 Resource.cpp \
44 ResourceParser.cpp \
45 ResourceTable.cpp \
Adam Lesinski24aad162015-04-24 19:19:30 -070046 ResourceTableResolver.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080047 ResourceValues.cpp \
48 SdkConstants.cpp \
49 StringPool.cpp \
50 TableFlattener.cpp \
51 Util.cpp \
52 ScopedXmlPullParser.cpp \
53 SourceXmlPullParser.cpp \
54 XliffXmlPullParser.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070055 XmlDom.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070056 XmlFlattener.cpp \
57 ZipEntry.cpp \
58 ZipFile.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080059
60testSources := \
61 BigBuffer_test.cpp \
Adam Lesinski4d3a9872015-04-09 19:53:22 -070062 BindingXmlPullParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080063 Compat_test.cpp \
64 ConfigDescription_test.cpp \
65 JavaClassGenerator_test.cpp \
66 Linker_test.cpp \
67 Locale_test.cpp \
68 ManifestParser_test.cpp \
69 Maybe_test.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070070 NameMangler_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080071 ResourceParser_test.cpp \
72 Resource_test.cpp \
73 ResourceTable_test.cpp \
74 ScopedXmlPullParser_test.cpp \
75 StringPiece_test.cpp \
76 StringPool_test.cpp \
77 Util_test.cpp \
78 XliffXmlPullParser_test.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070079 XmlDom_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080080 XmlFlattener_test.cpp
81
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070082cIncludes := \
83 external/libpng \
84 external/libz
85
Adam Lesinskifeefeb42015-04-03 12:44:40 -070086hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080087
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080088hostStaticLibs := \
89 libandroidfw \
90 libutils \
91 liblog \
92 libcutils \
93 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070094 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +010095 libpng \
96 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080097
Adam Lesinskifeefeb42015-04-03 12:44:40 -070098ifneq ($(strip $(USE_MINGW)),)
99 hostStaticLibs += libz
100else
101 hostLdLibs += -lz
102endif
103
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800104cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
105cppFlags := -std=c++11 -Wno-missing-field-initializers
106
107# ==========================================================
108# Build the host static library: libaapt2
109# ==========================================================
110include $(CLEAR_VARS)
111LOCAL_MODULE := libaapt2
112
113LOCAL_SRC_FILES := $(sources)
114LOCAL_C_INCLUDES += $(cIncludes)
115LOCAL_CFLAGS += $(cFlags)
116LOCAL_CPPFLAGS += $(cppFlags)
117
118include $(BUILD_HOST_STATIC_LIBRARY)
119
120
121# ==========================================================
122# Build the host tests: libaapt2_tests
123# ==========================================================
124include $(CLEAR_VARS)
125LOCAL_MODULE := libaapt2_tests
126LOCAL_MODULE_TAGS := tests
127
128LOCAL_SRC_FILES := $(testSources)
129
130LOCAL_C_INCLUDES += $(cIncludes)
131LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
132LOCAL_LDLIBS += $(hostLdLibs)
133LOCAL_CFLAGS += $(cFlags)
134LOCAL_CPPFLAGS += $(cppFlags)
135
136include $(BUILD_HOST_NATIVE_TEST)
137
138# ==========================================================
139# Build the host executable: aapt2
140# ==========================================================
141include $(CLEAR_VARS)
142LOCAL_MODULE := aapt2
143
144LOCAL_SRC_FILES := $(main)
145
146LOCAL_C_INCLUDES += $(cIncludes)
147LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
148LOCAL_LDLIBS += $(hostLdLibs)
149LOCAL_CFLAGS += $(cFlags)
150LOCAL_CPPFLAGS += $(cppFlags)
151
152include $(BUILD_HOST_EXECUTABLE)
153
154endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK