blob: 0622dc6288c13f8de5aef6292bdda75a6e944ac4 [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 \
32 Files.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070033 Flag.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080034 JavaClassGenerator.cpp \
35 Linker.cpp \
36 Locale.cpp \
37 Logger.cpp \
38 ManifestParser.cpp \
39 ManifestValidator.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070040 Png.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080041 ResChunkPullParser.cpp \
42 Resolver.cpp \
43 Resource.cpp \
44 ResourceParser.cpp \
45 ResourceTable.cpp \
46 ResourceValues.cpp \
47 SdkConstants.cpp \
48 StringPool.cpp \
49 TableFlattener.cpp \
50 Util.cpp \
51 ScopedXmlPullParser.cpp \
52 SourceXmlPullParser.cpp \
53 XliffXmlPullParser.cpp \
54 XmlFlattener.cpp
55
56testSources := \
57 BigBuffer_test.cpp \
Adam Lesinski4d3a9872015-04-09 19:53:22 -070058 BindingXmlPullParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080059 Compat_test.cpp \
60 ConfigDescription_test.cpp \
61 JavaClassGenerator_test.cpp \
62 Linker_test.cpp \
63 Locale_test.cpp \
64 ManifestParser_test.cpp \
65 Maybe_test.cpp \
66 ResourceParser_test.cpp \
67 Resource_test.cpp \
68 ResourceTable_test.cpp \
69 ScopedXmlPullParser_test.cpp \
70 StringPiece_test.cpp \
71 StringPool_test.cpp \
72 Util_test.cpp \
73 XliffXmlPullParser_test.cpp \
74 XmlFlattener_test.cpp
75
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070076cIncludes := \
77 external/libpng \
78 external/libz
79
Adam Lesinskifeefeb42015-04-03 12:44:40 -070080hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080081
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080082hostStaticLibs := \
83 libandroidfw \
84 libutils \
85 liblog \
86 libcutils \
87 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070088 libziparchive-host \
89 libpng
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080090
Adam Lesinskifeefeb42015-04-03 12:44:40 -070091ifneq ($(strip $(USE_MINGW)),)
92 hostStaticLibs += libz
93else
94 hostLdLibs += -lz
95endif
96
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080097cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
98cppFlags := -std=c++11 -Wno-missing-field-initializers
99
100# ==========================================================
101# Build the host static library: libaapt2
102# ==========================================================
103include $(CLEAR_VARS)
104LOCAL_MODULE := libaapt2
105
106LOCAL_SRC_FILES := $(sources)
107LOCAL_C_INCLUDES += $(cIncludes)
108LOCAL_CFLAGS += $(cFlags)
109LOCAL_CPPFLAGS += $(cppFlags)
110
111include $(BUILD_HOST_STATIC_LIBRARY)
112
113
114# ==========================================================
115# Build the host tests: libaapt2_tests
116# ==========================================================
117include $(CLEAR_VARS)
118LOCAL_MODULE := libaapt2_tests
119LOCAL_MODULE_TAGS := tests
120
121LOCAL_SRC_FILES := $(testSources)
122
123LOCAL_C_INCLUDES += $(cIncludes)
124LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
125LOCAL_LDLIBS += $(hostLdLibs)
126LOCAL_CFLAGS += $(cFlags)
127LOCAL_CPPFLAGS += $(cppFlags)
128
129include $(BUILD_HOST_NATIVE_TEST)
130
131# ==========================================================
132# Build the host executable: aapt2
133# ==========================================================
134include $(CLEAR_VARS)
135LOCAL_MODULE := aapt2
136
137LOCAL_SRC_FILES := $(main)
138
139LOCAL_C_INCLUDES += $(cIncludes)
140LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
141LOCAL_LDLIBS += $(hostLdLibs)
142LOCAL_CFLAGS += $(cFlags)
143LOCAL_CPPFLAGS += $(cppFlags)
144
145include $(BUILD_HOST_EXECUTABLE)
146
147endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK