blob: e5c42d5f74c170c36b46a4c391a427f7c1bca935 [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 \
Adam Lesinski8c831ca2015-05-20 15:24:01 -070039 ManifestMerger.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080040 ManifestParser.cpp \
41 ManifestValidator.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070042 Png.cpp \
Adam Lesinskia1ad4a82015-06-08 11:41:09 -070043 ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080044 ResChunkPullParser.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080045 Resource.cpp \
46 ResourceParser.cpp \
47 ResourceTable.cpp \
Adam Lesinski24aad162015-04-24 19:19:30 -070048 ResourceTableResolver.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080049 ResourceValues.cpp \
50 SdkConstants.cpp \
51 StringPool.cpp \
52 TableFlattener.cpp \
53 Util.cpp \
54 ScopedXmlPullParser.cpp \
55 SourceXmlPullParser.cpp \
56 XliffXmlPullParser.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070057 XmlDom.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070058 XmlFlattener.cpp \
59 ZipEntry.cpp \
60 ZipFile.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080061
62testSources := \
63 BigBuffer_test.cpp \
Adam Lesinski4d3a9872015-04-09 19:53:22 -070064 BindingXmlPullParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080065 Compat_test.cpp \
66 ConfigDescription_test.cpp \
67 JavaClassGenerator_test.cpp \
68 Linker_test.cpp \
69 Locale_test.cpp \
Adam Lesinski8c831ca2015-05-20 15:24:01 -070070 ManifestMerger_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080071 ManifestParser_test.cpp \
72 Maybe_test.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070073 NameMangler_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080074 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 \
Adam Lesinski75f3a552015-06-03 14:54:23 -070082 XmlDom_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080083 XmlFlattener_test.cpp
84
Adam Lesinskifeefeb42015-04-03 12:44:40 -070085hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080086
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080087hostStaticLibs := \
88 libandroidfw \
89 libutils \
90 liblog \
91 libcutils \
92 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070093 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +010094 libpng \
95 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080096
Adam Lesinskifeefeb42015-04-03 12:44:40 -070097ifneq ($(strip $(USE_MINGW)),)
98 hostStaticLibs += libz
99else
100 hostLdLibs += -lz
101endif
102
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800103cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski8c831ca2015-05-20 15:24:01 -0700104cppFlags := -std=c++11 -Wno-missing-field-initializers -Wno-unused-private-field
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800105
106# ==========================================================
107# Build the host static library: libaapt2
108# ==========================================================
109include $(CLEAR_VARS)
110LOCAL_MODULE := libaapt2
111
112LOCAL_SRC_FILES := $(sources)
Elliott Hughesd149c9e2015-07-21 11:39:21 -0700113LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800114LOCAL_CFLAGS += $(cFlags)
115LOCAL_CPPFLAGS += $(cppFlags)
116
117include $(BUILD_HOST_STATIC_LIBRARY)
118
119
120# ==========================================================
121# Build the host tests: libaapt2_tests
122# ==========================================================
123include $(CLEAR_VARS)
124LOCAL_MODULE := libaapt2_tests
125LOCAL_MODULE_TAGS := tests
126
127LOCAL_SRC_FILES := $(testSources)
128
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800129LOCAL_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
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800144LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
145LOCAL_LDLIBS += $(hostLdLibs)
146LOCAL_CFLAGS += $(cFlags)
147LOCAL_CPPFLAGS += $(cppFlags)
148
149include $(BUILD_HOST_EXECUTABLE)
150
151endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK