blob: ceed21edeb1b724c4d9aeecb6af103e8d8deda98 [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 Lesinskica5638f2015-10-21 14:42:43 -070083 java/JavaClassGenerator_test.cpp \
84 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080085 Locale_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080086 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070087 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080088 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070089 ResourceUtils_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080090 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070091 ValueVisitor_test.cpp \
Adam Lesinski75f3a552015-06-03 14:54:23 -070092 XmlDom_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070093 XmlPullParser_test.cpp
94
95toolSources := \
96 compile/Compile.cpp \
97 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080098
Adam Lesinskifeefeb42015-04-03 12:44:40 -070099hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800100
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800101hostStaticLibs := \
102 libandroidfw \
103 libutils \
104 liblog \
105 libcutils \
106 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700107 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100108 libpng \
109 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800110
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700111ifneq ($(strip $(USE_MINGW)),)
112 hostStaticLibs += libz
113else
114 hostLdLibs += -lz
115endif
116
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800117cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800118cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800119
120# ==========================================================
121# Build the host static library: libaapt2
122# ==========================================================
123include $(CLEAR_VARS)
124LOCAL_MODULE := libaapt2
125
126LOCAL_SRC_FILES := $(sources)
Elliott Hughes51348d22015-07-21 11:39:21 -0700127LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800128LOCAL_CFLAGS += $(cFlags)
129LOCAL_CPPFLAGS += $(cppFlags)
130
131include $(BUILD_HOST_STATIC_LIBRARY)
132
133
134# ==========================================================
135# Build the host tests: libaapt2_tests
136# ==========================================================
137include $(CLEAR_VARS)
138LOCAL_MODULE := libaapt2_tests
139LOCAL_MODULE_TAGS := tests
140
141LOCAL_SRC_FILES := $(testSources)
142
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800143LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
144LOCAL_LDLIBS += $(hostLdLibs)
145LOCAL_CFLAGS += $(cFlags)
146LOCAL_CPPFLAGS += $(cppFlags)
147
148include $(BUILD_HOST_NATIVE_TEST)
149
150# ==========================================================
151# Build the host executable: aapt2
152# ==========================================================
153include $(CLEAR_VARS)
154LOCAL_MODULE := aapt2
155
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700156LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800157
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800158LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
159LOCAL_LDLIBS += $(hostLdLibs)
160LOCAL_CFLAGS += $(cFlags)
161LOCAL_CPPFLAGS += $(cppFlags)
162
163include $(BUILD_HOST_EXECUTABLE)
164
165endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK