blob: 10f81502f2681ece0292791caa59b1cbdcd7589c [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 Lesinski98aa3ad2015-04-06 11:46:52 -070085cIncludes := \
86 external/libpng \
87 external/libz
88
Adam Lesinskifeefeb42015-04-03 12:44:40 -070089hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080090
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080091hostStaticLibs := \
92 libandroidfw \
93 libutils \
94 liblog \
95 libcutils \
96 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070097 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +010098 libpng \
99 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800100
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700101ifneq ($(strip $(USE_MINGW)),)
102 hostStaticLibs += libz
103else
104 hostLdLibs += -lz
105endif
106
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800107cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski8c831ca2015-05-20 15:24:01 -0700108cppFlags := -std=c++11 -Wno-missing-field-initializers -Wno-unused-private-field
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800109
110# ==========================================================
111# Build the host static library: libaapt2
112# ==========================================================
113include $(CLEAR_VARS)
114LOCAL_MODULE := libaapt2
115
116LOCAL_SRC_FILES := $(sources)
117LOCAL_C_INCLUDES += $(cIncludes)
118LOCAL_CFLAGS += $(cFlags)
119LOCAL_CPPFLAGS += $(cppFlags)
120
121include $(BUILD_HOST_STATIC_LIBRARY)
122
123
124# ==========================================================
125# Build the host tests: libaapt2_tests
126# ==========================================================
127include $(CLEAR_VARS)
128LOCAL_MODULE := libaapt2_tests
129LOCAL_MODULE_TAGS := tests
130
131LOCAL_SRC_FILES := $(testSources)
132
133LOCAL_C_INCLUDES += $(cIncludes)
134LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
135LOCAL_LDLIBS += $(hostLdLibs)
136LOCAL_CFLAGS += $(cFlags)
137LOCAL_CPPFLAGS += $(cppFlags)
138
139include $(BUILD_HOST_NATIVE_TEST)
140
141# ==========================================================
142# Build the host executable: aapt2
143# ==========================================================
144include $(CLEAR_VARS)
145LOCAL_MODULE := aapt2
146
147LOCAL_SRC_FILES := $(main)
148
149LOCAL_C_INCLUDES += $(cIncludes)
150LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
151LOCAL_LDLIBS += $(hostLdLibs)
152LOCAL_CFLAGS += $(cFlags)
153LOCAL_CPPFLAGS += $(cppFlags)
154
155include $(BUILD_HOST_EXECUTABLE)
156
157endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK