blob: f74b93abd79607ad66512ca5f5f8acde4a117aeb [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 \
Adam Lesinski393b5f02015-12-17 13:03:11 -080030 compile/PseudolocaleGenerator.cpp \
31 compile/Pseudolocalizer.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070032 compile/XmlIdCollector.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080033 filter/ConfigFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070034 flatten/Archive.cpp \
35 flatten/TableFlattener.cpp \
36 flatten/XmlFlattener.cpp \
Adam Lesinskia6fe3452015-12-09 15:20:52 -080037 io/FileSystem.cpp \
38 io/ZipArchive.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070039 link/AutoVersioner.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080040 link/ManifestFixer.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070041 link/PrivateAttributeMover.cpp \
42 link/ReferenceLinker.cpp \
43 link/TableMerger.cpp \
44 link/XmlReferenceLinker.cpp \
45 process/SymbolTable.cpp \
46 unflatten/BinaryResourceParser.cpp \
47 unflatten/ResChunkPullParser.cpp \
48 util/BigBuffer.cpp \
49 util/Files.cpp \
50 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080051 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070052 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070053 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070054 java/AnnotationProcessor.cpp \
55 java/JavaClassGenerator.cpp \
56 java/ManifestClassGenerator.cpp \
57 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080058 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080059 Resource.cpp \
60 ResourceParser.cpp \
61 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070062 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080063 ResourceValues.cpp \
64 SdkConstants.cpp \
65 StringPool.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080066 xml/XmlDom.cpp \
67 xml/XmlPullParser.cpp \
68 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080069
70testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070071 compile/IdAssigner_test.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080072 compile/PseudolocaleGenerator_test.cpp \
73 compile/Pseudolocalizer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070074 compile/XmlIdCollector_test.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080075 filter/ConfigFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070076 flatten/FileExportWriter_test.cpp \
77 flatten/TableFlattener_test.cpp \
78 flatten/XmlFlattener_test.cpp \
79 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080080 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070081 link/PrivateAttributeMover_test.cpp \
82 link/ReferenceLinker_test.cpp \
83 link/TableMerger_test.cpp \
84 link/XmlReferenceLinker_test.cpp \
85 process/SymbolTable_test.cpp \
86 unflatten/FileExportHeaderReader_test.cpp \
87 util/BigBuffer_test.cpp \
88 util/Maybe_test.cpp \
89 util/StringPiece_test.cpp \
90 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080091 ConfigDescription_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -080092 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070093 java/JavaClassGenerator_test.cpp \
94 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080095 Locale_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080096 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070097 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080098 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070099 ResourceUtils_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800100 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700101 ValueVisitor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -0800102 xml/XmlDom_test.cpp \
103 xml/XmlPullParser_test.cpp \
104 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700105
106toolSources := \
107 compile/Compile.cpp \
108 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800109
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700110hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800111
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800112hostStaticLibs := \
113 libandroidfw \
114 libutils \
115 liblog \
116 libcutils \
117 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700118 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100119 libpng \
120 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800121
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700122ifneq ($(strip $(USE_MINGW)),)
123 hostStaticLibs += libz
124else
125 hostLdLibs += -lz
126endif
127
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800128cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800129cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800130
131# ==========================================================
132# Build the host static library: libaapt2
133# ==========================================================
134include $(CLEAR_VARS)
135LOCAL_MODULE := libaapt2
136
137LOCAL_SRC_FILES := $(sources)
Elliott Hughes51348d22015-07-21 11:39:21 -0700138LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800139LOCAL_CFLAGS += $(cFlags)
140LOCAL_CPPFLAGS += $(cppFlags)
141
142include $(BUILD_HOST_STATIC_LIBRARY)
143
144
145# ==========================================================
146# Build the host tests: libaapt2_tests
147# ==========================================================
148include $(CLEAR_VARS)
149LOCAL_MODULE := libaapt2_tests
150LOCAL_MODULE_TAGS := tests
151
152LOCAL_SRC_FILES := $(testSources)
153
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800154LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
155LOCAL_LDLIBS += $(hostLdLibs)
156LOCAL_CFLAGS += $(cFlags)
157LOCAL_CPPFLAGS += $(cppFlags)
158
159include $(BUILD_HOST_NATIVE_TEST)
160
161# ==========================================================
162# Build the host executable: aapt2
163# ==========================================================
164include $(CLEAR_VARS)
165LOCAL_MODULE := aapt2
166
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700167LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800168
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800169LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
170LOCAL_LDLIBS += $(hostLdLibs)
171LOCAL_CFLAGS += $(cFlags)
172LOCAL_CPPFLAGS += $(cppFlags)
173
174include $(BUILD_HOST_EXECUTABLE)
175
176endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK