blob: 14f558efbddba190a4615e3da5dacf6c9f70bb31 [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 \
30 ConfigDescription.cpp \
31 Files.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070032 Flag.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080033 JavaClassGenerator.cpp \
34 Linker.cpp \
35 Locale.cpp \
36 Logger.cpp \
37 ManifestParser.cpp \
38 ManifestValidator.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070039 Png.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080040 ResChunkPullParser.cpp \
41 Resolver.cpp \
42 Resource.cpp \
43 ResourceParser.cpp \
44 ResourceTable.cpp \
45 ResourceValues.cpp \
46 SdkConstants.cpp \
47 StringPool.cpp \
48 TableFlattener.cpp \
49 Util.cpp \
50 ScopedXmlPullParser.cpp \
51 SourceXmlPullParser.cpp \
52 XliffXmlPullParser.cpp \
53 XmlFlattener.cpp
54
55testSources := \
56 BigBuffer_test.cpp \
57 Compat_test.cpp \
58 ConfigDescription_test.cpp \
59 JavaClassGenerator_test.cpp \
60 Linker_test.cpp \
61 Locale_test.cpp \
62 ManifestParser_test.cpp \
63 Maybe_test.cpp \
64 ResourceParser_test.cpp \
65 Resource_test.cpp \
66 ResourceTable_test.cpp \
67 ScopedXmlPullParser_test.cpp \
68 StringPiece_test.cpp \
69 StringPool_test.cpp \
70 Util_test.cpp \
71 XliffXmlPullParser_test.cpp \
72 XmlFlattener_test.cpp
73
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070074cIncludes := \
75 external/libpng \
76 external/libz
77
Adam Lesinskifeefeb42015-04-03 12:44:40 -070078hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080079
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080080hostStaticLibs := \
81 libandroidfw \
82 libutils \
83 liblog \
84 libcutils \
85 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070086 libziparchive-host \
87 libpng
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080088
Adam Lesinskifeefeb42015-04-03 12:44:40 -070089ifneq ($(strip $(USE_MINGW)),)
90 hostStaticLibs += libz
91else
92 hostLdLibs += -lz
93endif
94
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080095cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
96cppFlags := -std=c++11 -Wno-missing-field-initializers
97
98# ==========================================================
99# Build the host static library: libaapt2
100# ==========================================================
101include $(CLEAR_VARS)
102LOCAL_MODULE := libaapt2
103
104LOCAL_SRC_FILES := $(sources)
105LOCAL_C_INCLUDES += $(cIncludes)
106LOCAL_CFLAGS += $(cFlags)
107LOCAL_CPPFLAGS += $(cppFlags)
108
109include $(BUILD_HOST_STATIC_LIBRARY)
110
111
112# ==========================================================
113# Build the host tests: libaapt2_tests
114# ==========================================================
115include $(CLEAR_VARS)
116LOCAL_MODULE := libaapt2_tests
117LOCAL_MODULE_TAGS := tests
118
119LOCAL_SRC_FILES := $(testSources)
120
121LOCAL_C_INCLUDES += $(cIncludes)
122LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
123LOCAL_LDLIBS += $(hostLdLibs)
124LOCAL_CFLAGS += $(cFlags)
125LOCAL_CPPFLAGS += $(cppFlags)
126
127include $(BUILD_HOST_NATIVE_TEST)
128
129# ==========================================================
130# Build the host executable: aapt2
131# ==========================================================
132include $(CLEAR_VARS)
133LOCAL_MODULE := aapt2
134
135LOCAL_SRC_FILES := $(main)
136
137LOCAL_C_INCLUDES += $(cIncludes)
138LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
139LOCAL_LDLIBS += $(hostLdLibs)
140LOCAL_CFLAGS += $(cFlags)
141LOCAL_CPPFLAGS += $(cppFlags)
142
143include $(BUILD_HOST_EXECUTABLE)
144
145endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK