blob: 05034c395e3ae8ab5938b41fde3fb433d1c01635 [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 \
33 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 \
39 ManifestParser.cpp \
40 ManifestValidator.cpp \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070041 Png.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080042 ResChunkPullParser.cpp \
43 Resolver.cpp \
44 Resource.cpp \
45 ResourceParser.cpp \
46 ResourceTable.cpp \
47 ResourceValues.cpp \
48 SdkConstants.cpp \
49 StringPool.cpp \
50 TableFlattener.cpp \
51 Util.cpp \
52 ScopedXmlPullParser.cpp \
53 SourceXmlPullParser.cpp \
54 XliffXmlPullParser.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070055 XmlFlattener.cpp \
56 ZipEntry.cpp \
57 ZipFile.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080058
59testSources := \
60 BigBuffer_test.cpp \
Adam Lesinski4d3a9872015-04-09 19:53:22 -070061 BindingXmlPullParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080062 Compat_test.cpp \
63 ConfigDescription_test.cpp \
64 JavaClassGenerator_test.cpp \
65 Linker_test.cpp \
66 Locale_test.cpp \
67 ManifestParser_test.cpp \
68 Maybe_test.cpp \
Adam Lesinski769de982015-04-10 19:43:55 -070069 NameMangler_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080070 ResourceParser_test.cpp \
71 Resource_test.cpp \
72 ResourceTable_test.cpp \
73 ScopedXmlPullParser_test.cpp \
74 StringPiece_test.cpp \
75 StringPool_test.cpp \
76 Util_test.cpp \
77 XliffXmlPullParser_test.cpp \
78 XmlFlattener_test.cpp
79
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070080cIncludes := \
81 external/libpng \
82 external/libz
83
Adam Lesinskifeefeb42015-04-03 12:44:40 -070084hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080085
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080086hostStaticLibs := \
87 libandroidfw \
88 libutils \
89 liblog \
90 libcutils \
91 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -070092 libziparchive-host \
93 libpng
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080094
Adam Lesinskifeefeb42015-04-03 12:44:40 -070095ifneq ($(strip $(USE_MINGW)),)
96 hostStaticLibs += libz
97else
98 hostLdLibs += -lz
99endif
100
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800101cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
102cppFlags := -std=c++11 -Wno-missing-field-initializers
103
104# ==========================================================
105# Build the host static library: libaapt2
106# ==========================================================
107include $(CLEAR_VARS)
108LOCAL_MODULE := libaapt2
109
110LOCAL_SRC_FILES := $(sources)
111LOCAL_C_INCLUDES += $(cIncludes)
112LOCAL_CFLAGS += $(cFlags)
113LOCAL_CPPFLAGS += $(cppFlags)
114
115include $(BUILD_HOST_STATIC_LIBRARY)
116
117
118# ==========================================================
119# Build the host tests: libaapt2_tests
120# ==========================================================
121include $(CLEAR_VARS)
122LOCAL_MODULE := libaapt2_tests
123LOCAL_MODULE_TAGS := tests
124
125LOCAL_SRC_FILES := $(testSources)
126
127LOCAL_C_INCLUDES += $(cIncludes)
128LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
129LOCAL_LDLIBS += $(hostLdLibs)
130LOCAL_CFLAGS += $(cFlags)
131LOCAL_CPPFLAGS += $(cppFlags)
132
133include $(BUILD_HOST_NATIVE_TEST)
134
135# ==========================================================
136# Build the host executable: aapt2
137# ==========================================================
138include $(CLEAR_VARS)
139LOCAL_MODULE := aapt2
140
141LOCAL_SRC_FILES := $(main)
142
143LOCAL_C_INCLUDES += $(cIncludes)
144LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
145LOCAL_LDLIBS += $(hostLdLibs)
146LOCAL_CFLAGS += $(cFlags)
147LOCAL_CPPFLAGS += $(cppFlags)
148
149include $(BUILD_HOST_EXECUTABLE)
150
151endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK