blob: d8e0aac678f02b3c8602fe11cf9b90aef5b0495d [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 := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070028 compile/IdAssigner.cpp \
29 compile/Png.cpp \
30 compile/XmlIdCollector.cpp \
31 flatten/Archive.cpp \
32 flatten/TableFlattener.cpp \
33 flatten/XmlFlattener.cpp \
34 link/AutoVersioner.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080035 link/ManifestFixer.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070036 link/PrivateAttributeMover.cpp \
37 link/ReferenceLinker.cpp \
38 link/TableMerger.cpp \
39 link/XmlReferenceLinker.cpp \
40 process/SymbolTable.cpp \
41 unflatten/BinaryResourceParser.cpp \
42 unflatten/ResChunkPullParser.cpp \
43 util/BigBuffer.cpp \
44 util/Files.cpp \
45 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080046 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070047 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070048 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070049 java/AnnotationProcessor.cpp \
50 java/JavaClassGenerator.cpp \
51 java/ManifestClassGenerator.cpp \
52 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080053 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080054 Resource.cpp \
55 ResourceParser.cpp \
56 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070057 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080058 ResourceValues.cpp \
59 SdkConstants.cpp \
60 StringPool.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080061 xml/XmlDom.cpp \
62 xml/XmlPullParser.cpp \
63 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080064
65testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070066 compile/IdAssigner_test.cpp \
67 compile/XmlIdCollector_test.cpp \
68 flatten/FileExportWriter_test.cpp \
69 flatten/TableFlattener_test.cpp \
70 flatten/XmlFlattener_test.cpp \
71 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080072 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070073 link/PrivateAttributeMover_test.cpp \
74 link/ReferenceLinker_test.cpp \
75 link/TableMerger_test.cpp \
76 link/XmlReferenceLinker_test.cpp \
77 process/SymbolTable_test.cpp \
78 unflatten/FileExportHeaderReader_test.cpp \
79 util/BigBuffer_test.cpp \
80 util/Maybe_test.cpp \
81 util/StringPiece_test.cpp \
82 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080083 ConfigDescription_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -080084 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070085 java/JavaClassGenerator_test.cpp \
86 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080087 Locale_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080088 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070089 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080090 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070091 ResourceUtils_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080092 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070093 ValueVisitor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080094 xml/XmlDom_test.cpp \
95 xml/XmlPullParser_test.cpp \
96 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -070097
98toolSources := \
99 compile/Compile.cpp \
100 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800101
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700102hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800103
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800104hostStaticLibs := \
105 libandroidfw \
106 libutils \
107 liblog \
108 libcutils \
109 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700110 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100111 libpng \
112 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800113
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700114ifneq ($(strip $(USE_MINGW)),)
115 hostStaticLibs += libz
116else
117 hostLdLibs += -lz
118endif
119
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800120cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800121cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800122
123# ==========================================================
124# Build the host static library: libaapt2
125# ==========================================================
126include $(CLEAR_VARS)
127LOCAL_MODULE := libaapt2
128
129LOCAL_SRC_FILES := $(sources)
Elliott Hughes51348d22015-07-21 11:39:21 -0700130LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800131LOCAL_CFLAGS += $(cFlags)
132LOCAL_CPPFLAGS += $(cppFlags)
133
134include $(BUILD_HOST_STATIC_LIBRARY)
135
136
137# ==========================================================
138# Build the host tests: libaapt2_tests
139# ==========================================================
140include $(CLEAR_VARS)
141LOCAL_MODULE := libaapt2_tests
142LOCAL_MODULE_TAGS := tests
143
144LOCAL_SRC_FILES := $(testSources)
145
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800146LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
147LOCAL_LDLIBS += $(hostLdLibs)
148LOCAL_CFLAGS += $(cFlags)
149LOCAL_CPPFLAGS += $(cppFlags)
150
151include $(BUILD_HOST_NATIVE_TEST)
152
153# ==========================================================
154# Build the host executable: aapt2
155# ==========================================================
156include $(CLEAR_VARS)
157LOCAL_MODULE := aapt2
158
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700159LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800160
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800161LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
162LOCAL_LDLIBS += $(hostLdLibs)
163LOCAL_CFLAGS += $(cFlags)
164LOCAL_CPPFLAGS += $(cppFlags)
165
166include $(BUILD_HOST_EXECUTABLE)
167
168endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK