blob: 80356fd915401546b5d2cfbec77fd22fb906640e [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 Lesinski769de982015-04-10 19:43:55 -070030 BinaryXmlPullParser.cpp \
Adam Lesinski4d3a9872015-04-09 19:53:22 -070031 BindingXmlPullParser.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080032 ConfigDescription.cpp \
33 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 \
43 Resolver.cpp \
44 Resource.cpp \
45 ResourceParser.cpp \
46 ResourceTable.cpp \
47 ResourceValues.cpp \
48 SdkConstants.cpp \
49 StringPool.cpp \
50 TableFlattener.cpp \
51 Util.cpp \
52 ScopedXmlPullParser.cpp \
53 SourceXmlPullParser.cpp \
54 XliffXmlPullParser.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070055 XmlFlattener.cpp \
56 ZipEntry.cpp \
57 ZipFile.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080058
59testSources := \
60 BigBuffer_test.cpp \
Adam Lesinski4d3a9872015-04-09 19:53:22 -070061 BindingXmlPullParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080062 Compat_test.cpp \
63 ConfigDescription_test.cpp \
64 JavaClassGenerator_test.cpp \
65 Linker_test.cpp \
66 Locale_test.cpp \
67 ManifestParser_test.cpp \
68 Maybe_test.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070069 NameMangler_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080070 ResourceParser_test.cpp \
71 Resource_test.cpp \
72 ResourceTable_test.cpp \
73 ScopedXmlPullParser_test.cpp \
74 StringPiece_test.cpp \
75 StringPool_test.cpp \
76 Util_test.cpp \
77 XliffXmlPullParser_test.cpp \
78 XmlFlattener_test.cpp
79
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070080cIncludes := \
81 external/libpng \
82 external/libz
83
Adam Lesinskifeefeb42015-04-03 12:44:40 -070084hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080085
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080086hostStaticLibs := \
87 libandroidfw \
88 libutils \
89 liblog \
90 libcutils \
91 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070092 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +010093 libpng \
94 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080095
Adam Lesinskifeefeb42015-04-03 12:44:40 -070096ifneq ($(strip $(USE_MINGW)),)
97 hostStaticLibs += libz
98else
99 hostLdLibs += -lz
100endif
101
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800102cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
103cppFlags := -std=c++11 -Wno-missing-field-initializers
104
105# ==========================================================
106# Build the host static library: libaapt2
107# ==========================================================
108include $(CLEAR_VARS)
109LOCAL_MODULE := libaapt2
110
111LOCAL_SRC_FILES := $(sources)
112LOCAL_C_INCLUDES += $(cIncludes)
113LOCAL_CFLAGS += $(cFlags)
114LOCAL_CPPFLAGS += $(cppFlags)
115
116include $(BUILD_HOST_STATIC_LIBRARY)
117
118
119# ==========================================================
120# Build the host tests: libaapt2_tests
121# ==========================================================
122include $(CLEAR_VARS)
123LOCAL_MODULE := libaapt2_tests
124LOCAL_MODULE_TAGS := tests
125
126LOCAL_SRC_FILES := $(testSources)
127
128LOCAL_C_INCLUDES += $(cIncludes)
129LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
130LOCAL_LDLIBS += $(hostLdLibs)
131LOCAL_CFLAGS += $(cFlags)
132LOCAL_CPPFLAGS += $(cppFlags)
133
134include $(BUILD_HOST_NATIVE_TEST)
135
136# ==========================================================
137# Build the host executable: aapt2
138# ==========================================================
139include $(CLEAR_VARS)
140LOCAL_MODULE := aapt2
141
142LOCAL_SRC_FILES := $(main)
143
144LOCAL_C_INCLUDES += $(cIncludes)
145LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
146LOCAL_LDLIBS += $(hostLdLibs)
147LOCAL_CFLAGS += $(cFlags)
148LOCAL_CPPFLAGS += $(cppFlags)
149
150include $(BUILD_HOST_EXECUTABLE)
151
152endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK