blob: a41d2d72b7547e0bb985993289430745994b1668 [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 \
35 link/PrivateAttributeMover.cpp \
36 link/ReferenceLinker.cpp \
37 link/TableMerger.cpp \
38 link/XmlReferenceLinker.cpp \
39 process/SymbolTable.cpp \
40 unflatten/BinaryResourceParser.cpp \
41 unflatten/ResChunkPullParser.cpp \
42 util/BigBuffer.cpp \
43 util/Files.cpp \
44 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080045 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070046 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070047 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070048 java/AnnotationProcessor.cpp \
49 java/JavaClassGenerator.cpp \
50 java/ManifestClassGenerator.cpp \
51 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080052 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080053 Resource.cpp \
54 ResourceParser.cpp \
55 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070056 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080057 ResourceValues.cpp \
58 SdkConstants.cpp \
59 StringPool.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070060 XmlDom.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070061 XmlPullParser.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080062
63testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070064 compile/IdAssigner_test.cpp \
65 compile/XmlIdCollector_test.cpp \
66 flatten/FileExportWriter_test.cpp \
67 flatten/TableFlattener_test.cpp \
68 flatten/XmlFlattener_test.cpp \
69 link/AutoVersioner_test.cpp \
70 link/PrivateAttributeMover_test.cpp \
71 link/ReferenceLinker_test.cpp \
72 link/TableMerger_test.cpp \
73 link/XmlReferenceLinker_test.cpp \
74 process/SymbolTable_test.cpp \
75 unflatten/FileExportHeaderReader_test.cpp \
76 util/BigBuffer_test.cpp \
77 util/Maybe_test.cpp \
78 util/StringPiece_test.cpp \
79 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080080 ConfigDescription_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070081 java/JavaClassGenerator_test.cpp \
82 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080083 Locale_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080084 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070085 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080086 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070087 ResourceUtils_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080088 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070089 ValueVisitor_test.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070090 XmlDom_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070091 XmlPullParser_test.cpp
92
93toolSources := \
94 compile/Compile.cpp \
95 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080096
Adam Lesinskifeefeb42015-04-03 12:44:40 -070097hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080098
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080099hostStaticLibs := \
100 libandroidfw \
101 libutils \
102 liblog \
103 libcutils \
104 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700105 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100106 libpng \
107 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800108
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700109ifneq ($(strip $(USE_MINGW)),)
110 hostStaticLibs += libz
111else
112 hostLdLibs += -lz
113endif
114
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800115cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700116cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800117
118# ==========================================================
119# Build the host static library: libaapt2
120# ==========================================================
121include $(CLEAR_VARS)
122LOCAL_MODULE := libaapt2
123
124LOCAL_SRC_FILES := $(sources)
Elliott Hughes51348d22015-07-21 11:39:21 -0700125LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800126LOCAL_CFLAGS += $(cFlags)
127LOCAL_CPPFLAGS += $(cppFlags)
128
129include $(BUILD_HOST_STATIC_LIBRARY)
130
131
132# ==========================================================
133# Build the host tests: libaapt2_tests
134# ==========================================================
135include $(CLEAR_VARS)
136LOCAL_MODULE := libaapt2_tests
137LOCAL_MODULE_TAGS := tests
138
139LOCAL_SRC_FILES := $(testSources)
140
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800141LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
142LOCAL_LDLIBS += $(hostLdLibs)
143LOCAL_CFLAGS += $(cFlags)
144LOCAL_CPPFLAGS += $(cppFlags)
145
146include $(BUILD_HOST_NATIVE_TEST)
147
148# ==========================================================
149# Build the host executable: aapt2
150# ==========================================================
151include $(CLEAR_VARS)
152LOCAL_MODULE := aapt2
153
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700154LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800155
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800156LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
157LOCAL_LDLIBS += $(hostLdLibs)
158LOCAL_CFLAGS += $(cFlags)
159LOCAL_CPPFLAGS += $(cppFlags)
160
161include $(BUILD_HOST_EXECUTABLE)
162
163endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK