blob: d311cd9f0a8997f2be4cd5f109ad4c16335fb484 [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 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 Lesinski75f3a552015-06-03 14:54:23 -070056 XmlDom.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070057 XmlFlattener.cpp \
58 ZipEntry.cpp \
59 ZipFile.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080060
61testSources := \
62 BigBuffer_test.cpp \
Adam Lesinski4d3a9872015-04-09 19:53:22 -070063 BindingXmlPullParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080064 Compat_test.cpp \
65 ConfigDescription_test.cpp \
66 JavaClassGenerator_test.cpp \
67 Linker_test.cpp \
68 Locale_test.cpp \
Adam Lesinski8c831ca2015-05-20 15:24:01 -070069 ManifestMerger_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080070 ManifestParser_test.cpp \
71 Maybe_test.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070072 NameMangler_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080073 ResourceParser_test.cpp \
74 Resource_test.cpp \
75 ResourceTable_test.cpp \
76 ScopedXmlPullParser_test.cpp \
77 StringPiece_test.cpp \
78 StringPool_test.cpp \
79 Util_test.cpp \
80 XliffXmlPullParser_test.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070081 XmlDom_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080082 XmlFlattener_test.cpp
83
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070084cIncludes := \
85 external/libpng \
86 external/libz
87
Adam Lesinskifeefeb42015-04-03 12:44:40 -070088hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080089
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080090hostStaticLibs := \
91 libandroidfw \
92 libutils \
93 liblog \
94 libcutils \
95 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070096 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +010097 libpng \
98 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080099
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700100ifneq ($(strip $(USE_MINGW)),)
101 hostStaticLibs += libz
102else
103 hostLdLibs += -lz
104endif
105
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800106cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski8c831ca2015-05-20 15:24:01 -0700107cppFlags := -std=c++11 -Wno-missing-field-initializers -Wno-unused-private-field
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800108
109# ==========================================================
110# Build the host static library: libaapt2
111# ==========================================================
112include $(CLEAR_VARS)
113LOCAL_MODULE := libaapt2
114
115LOCAL_SRC_FILES := $(sources)
116LOCAL_C_INCLUDES += $(cIncludes)
117LOCAL_CFLAGS += $(cFlags)
118LOCAL_CPPFLAGS += $(cppFlags)
119
120include $(BUILD_HOST_STATIC_LIBRARY)
121
122
123# ==========================================================
124# Build the host tests: libaapt2_tests
125# ==========================================================
126include $(CLEAR_VARS)
127LOCAL_MODULE := libaapt2_tests
128LOCAL_MODULE_TAGS := tests
129
130LOCAL_SRC_FILES := $(testSources)
131
132LOCAL_C_INCLUDES += $(cIncludes)
133LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
134LOCAL_LDLIBS += $(hostLdLibs)
135LOCAL_CFLAGS += $(cFlags)
136LOCAL_CPPFLAGS += $(cppFlags)
137
138include $(BUILD_HOST_NATIVE_TEST)
139
140# ==========================================================
141# Build the host executable: aapt2
142# ==========================================================
143include $(CLEAR_VARS)
144LOCAL_MODULE := aapt2
145
146LOCAL_SRC_FILES := $(main)
147
148LOCAL_C_INCLUDES += $(cIncludes)
149LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
150LOCAL_LDLIBS += $(hostLdLibs)
151LOCAL_CFLAGS += $(cFlags)
152LOCAL_CPPFLAGS += $(cppFlags)
153
154include $(BUILD_HOST_EXECUTABLE)
155
156endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK