blob: ec29c3818bdc09f91e14e97b10a972f21107616c [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 Lesinski75f3a552015-06-03 14:54:23 -070061 XmlDom.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070062 XmlPullParser.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080063
64testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070065 compile/IdAssigner_test.cpp \
66 compile/XmlIdCollector_test.cpp \
67 flatten/FileExportWriter_test.cpp \
68 flatten/TableFlattener_test.cpp \
69 flatten/XmlFlattener_test.cpp \
70 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080071 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070072 link/PrivateAttributeMover_test.cpp \
73 link/ReferenceLinker_test.cpp \
74 link/TableMerger_test.cpp \
75 link/XmlReferenceLinker_test.cpp \
76 process/SymbolTable_test.cpp \
77 unflatten/FileExportHeaderReader_test.cpp \
78 util/BigBuffer_test.cpp \
79 util/Maybe_test.cpp \
80 util/StringPiece_test.cpp \
81 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080082 ConfigDescription_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -080083 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070084 java/JavaClassGenerator_test.cpp \
85 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080086 Locale_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080087 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070088 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080089 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070090 ResourceUtils_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080091 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070092 ValueVisitor_test.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070093 XmlDom_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070094 XmlPullParser_test.cpp
95
96toolSources := \
97 compile/Compile.cpp \
98 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080099
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700100hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800101
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800102hostStaticLibs := \
103 libandroidfw \
104 libutils \
105 liblog \
106 libcutils \
107 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700108 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100109 libpng \
110 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800111
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700112ifneq ($(strip $(USE_MINGW)),)
113 hostStaticLibs += libz
114else
115 hostLdLibs += -lz
116endif
117
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800118cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800119cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800120
121# ==========================================================
122# Build the host static library: libaapt2
123# ==========================================================
124include $(CLEAR_VARS)
125LOCAL_MODULE := libaapt2
126
127LOCAL_SRC_FILES := $(sources)
Elliott Hughes51348d22015-07-21 11:39:21 -0700128LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800129LOCAL_CFLAGS += $(cFlags)
130LOCAL_CPPFLAGS += $(cppFlags)
131
132include $(BUILD_HOST_STATIC_LIBRARY)
133
134
135# ==========================================================
136# Build the host tests: libaapt2_tests
137# ==========================================================
138include $(CLEAR_VARS)
139LOCAL_MODULE := libaapt2_tests
140LOCAL_MODULE_TAGS := tests
141
142LOCAL_SRC_FILES := $(testSources)
143
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800144LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
145LOCAL_LDLIBS += $(hostLdLibs)
146LOCAL_CFLAGS += $(cFlags)
147LOCAL_CPPFLAGS += $(cppFlags)
148
149include $(BUILD_HOST_NATIVE_TEST)
150
151# ==========================================================
152# Build the host executable: aapt2
153# ==========================================================
154include $(CLEAR_VARS)
155LOCAL_MODULE := aapt2
156
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700157LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800158
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800159LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
160LOCAL_LDLIBS += $(hostLdLibs)
161LOCAL_CFLAGS += $(cFlags)
162LOCAL_CPPFLAGS += $(cppFlags)
163
164include $(BUILD_HOST_EXECUTABLE)
165
166endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK