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