blob: 23d679dfa4a8012cac3877b52f29ec9dfe916282 [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 \
Adam Lesinski330edcd2015-05-04 17:40:56 -070033 Debug.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080034 Files.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070035 Flag.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080036 JavaClassGenerator.cpp \
37 Linker.cpp \
38 Locale.cpp \
39 Logger.cpp \
40 ManifestParser.cpp \
41 ManifestValidator.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070042 Png.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080043 ResChunkPullParser.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080044 Resource.cpp \
45 ResourceParser.cpp \
46 ResourceTable.cpp \
Adam Lesinski24aad162015-04-24 19:19:30 -070047 ResourceTableResolver.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080048 ResourceValues.cpp \
49 SdkConstants.cpp \
50 StringPool.cpp \
51 TableFlattener.cpp \
52 Util.cpp \
53 ScopedXmlPullParser.cpp \
54 SourceXmlPullParser.cpp \
55 XliffXmlPullParser.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 \
79 XmlFlattener_test.cpp
80
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070081cIncludes := \
82 external/libpng \
83 external/libz
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
104cppFlags := -std=c++11 -Wno-missing-field-initializers
105
106# ==========================================================
107# Build the host static library: libaapt2
108# ==========================================================
109include $(CLEAR_VARS)
110LOCAL_MODULE := libaapt2
111
112LOCAL_SRC_FILES := $(sources)
113LOCAL_C_INCLUDES += $(cIncludes)
114LOCAL_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
129LOCAL_C_INCLUDES += $(cIncludes)
130LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
131LOCAL_LDLIBS += $(hostLdLibs)
132LOCAL_CFLAGS += $(cFlags)
133LOCAL_CPPFLAGS += $(cppFlags)
134
135include $(BUILD_HOST_NATIVE_TEST)
136
137# ==========================================================
138# Build the host executable: aapt2
139# ==========================================================
140include $(CLEAR_VARS)
141LOCAL_MODULE := aapt2
142
143LOCAL_SRC_FILES := $(main)
144
145LOCAL_C_INCLUDES += $(cIncludes)
146LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
147LOCAL_LDLIBS += $(hostLdLibs)
148LOCAL_CFLAGS += $(cFlags)
149LOCAL_CPPFLAGS += $(cppFlags)
150
151include $(BUILD_HOST_EXECUTABLE)
152
153endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK