blob: 57a769221a8f8daa3e22cc5486480a1ee254d71f [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#
Adam Lesinski64587af2016-02-18 18:33:06 -080016LOCAL_PATH:= $(call my-dir)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080017
18# ==========================================================
19# Setup some common variables for the different build
20# targets here.
21# ==========================================================
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080022
23main := Main.cpp
24sources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070025 compile/IdAssigner.cpp \
26 compile/Png.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080027 compile/PseudolocaleGenerator.cpp \
28 compile/Pseudolocalizer.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070029 compile/XmlIdCollector.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080030 filter/ConfigFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070031 flatten/Archive.cpp \
32 flatten/TableFlattener.cpp \
33 flatten/XmlFlattener.cpp \
Adam Lesinskia6fe3452015-12-09 15:20:52 -080034 io/FileSystem.cpp \
35 io/ZipArchive.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070036 link/AutoVersioner.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080037 link/ManifestFixer.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080038 link/ProductFilter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070039 link/PrivateAttributeMover.cpp \
40 link/ReferenceLinker.cpp \
41 link/TableMerger.cpp \
42 link/XmlReferenceLinker.cpp \
43 process/SymbolTable.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080044 proto/ProtoHelpers.cpp \
45 proto/TableProtoDeserializer.cpp \
46 proto/TableProtoSerializer.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080047 split/TableSplitter.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070048 unflatten/BinaryResourceParser.cpp \
49 unflatten/ResChunkPullParser.cpp \
50 util/BigBuffer.cpp \
51 util/Files.cpp \
52 util/Util.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080053 ConfigDescription.cpp \
Adam Lesinski330edcd2015-05-04 17:40:56 -070054 Debug.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070055 Flags.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070056 java/AnnotationProcessor.cpp \
57 java/JavaClassGenerator.cpp \
58 java/ManifestClassGenerator.cpp \
59 java/ProguardRules.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080060 Locale.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080061 Resource.cpp \
62 ResourceParser.cpp \
63 ResourceTable.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070064 ResourceUtils.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080065 ResourceValues.cpp \
66 SdkConstants.cpp \
67 StringPool.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -080068 xml/XmlDom.cpp \
69 xml/XmlPullParser.cpp \
70 xml/XmlUtil.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080071
Adam Lesinski59e04c62016-02-04 15:59:23 -080072sources += Format.proto
73
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080074testSources := \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070075 compile/IdAssigner_test.cpp \
Adam Lesinski393b5f02015-12-17 13:03:11 -080076 compile/PseudolocaleGenerator_test.cpp \
77 compile/Pseudolocalizer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070078 compile/XmlIdCollector_test.cpp \
Adam Lesinski6a008172016-02-02 17:02:58 -080079 filter/ConfigFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070080 flatten/TableFlattener_test.cpp \
81 flatten/XmlFlattener_test.cpp \
82 link/AutoVersioner_test.cpp \
Adam Lesinski2ae4a872015-11-02 16:10:55 -080083 link/ManifestFixer_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070084 link/PrivateAttributeMover_test.cpp \
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080085 link/ProductFilter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070086 link/ReferenceLinker_test.cpp \
87 link/TableMerger_test.cpp \
88 link/XmlReferenceLinker_test.cpp \
89 process/SymbolTable_test.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -080090 proto/TableProtoSerializer_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -080091 split/TableSplitter_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -070092 util/BigBuffer_test.cpp \
93 util/Maybe_test.cpp \
94 util/StringPiece_test.cpp \
95 util/Util_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080096 ConfigDescription_test.cpp \
Adam Lesinskib274e352015-11-06 15:14:35 -080097 java/AnnotationProcessor_test.cpp \
Adam Lesinskica5638f2015-10-21 14:42:43 -070098 java/JavaClassGenerator_test.cpp \
99 java/ManifestClassGenerator_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800100 Locale_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800101 Resource_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700102 ResourceParser_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800103 ResourceTable_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700104 ResourceUtils_test.cpp \
Adam Lesinski355f2852016-02-13 20:26:45 -0800105 SdkConstants_test.cpp \
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800106 StringPool_test.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700107 ValueVisitor_test.cpp \
Adam Lesinski467f1712015-11-16 17:35:44 -0800108 xml/XmlDom_test.cpp \
109 xml/XmlPullParser_test.cpp \
110 xml/XmlUtil_test.cpp
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700111
112toolSources := \
113 compile/Compile.cpp \
Adam Lesinski59e04c62016-02-04 15:59:23 -0800114 dump/Dump.cpp \
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700115 link/Link.cpp
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800116
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700117hostLdLibs :=
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800118
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800119hostStaticLibs := \
120 libandroidfw \
121 libutils \
122 liblog \
123 libcutils \
124 libexpat \
Adam Lesinski98aa3ad2015-04-06 11:46:52 -0700125 libziparchive-host \
Narayan Kamath231e0542015-04-29 16:32:23 +0100126 libpng \
127 libbase
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800128
Adam Lesinski59e04c62016-02-04 15:59:23 -0800129hostSharedLibs := \
130 libprotobuf-cpp-lite
131
Adam Lesinskifeefeb42015-04-03 12:44:40 -0700132ifneq ($(strip $(USE_MINGW)),)
133 hostStaticLibs += libz
134else
135 hostLdLibs += -lz
136endif
137
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800138cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800139cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti
Adam Lesinski59e04c62016-02-04 15:59:23 -0800140protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800141
142# ==========================================================
143# Build the host static library: libaapt2
144# ==========================================================
145include $(CLEAR_VARS)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800146LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800147LOCAL_MODULE := libaapt2
148
149LOCAL_SRC_FILES := $(sources)
Elliott Hughes51348d22015-07-21 11:39:21 -0700150LOCAL_STATIC_LIBRARIES += $(hostStaticLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800151LOCAL_CFLAGS += $(cFlags)
152LOCAL_CPPFLAGS += $(cppFlags)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800153LOCAL_C_INCLUDES += $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800154
155include $(BUILD_HOST_STATIC_LIBRARY)
156
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800157# ==========================================================
158# Build the host tests: libaapt2_tests
159# ==========================================================
160include $(CLEAR_VARS)
161LOCAL_MODULE := libaapt2_tests
162LOCAL_MODULE_TAGS := tests
163
164LOCAL_SRC_FILES := $(testSources)
165
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800166LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800167LOCAL_SHARED_LIBRARIES += $(hostSharedLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800168LOCAL_LDLIBS += $(hostLdLibs)
169LOCAL_CFLAGS += $(cFlags)
170LOCAL_CPPFLAGS += $(cppFlags)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800171LOCAL_C_INCLUDES += $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800172
173include $(BUILD_HOST_NATIVE_TEST)
174
175# ==========================================================
176# Build the host executable: aapt2
177# ==========================================================
178include $(CLEAR_VARS)
179LOCAL_MODULE := aapt2
180
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700181LOCAL_SRC_FILES := $(main) $(toolSources)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800182
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800183LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800184LOCAL_SHARED_LIBRARIES += $(hostSharedLibs)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800185LOCAL_LDLIBS += $(hostLdLibs)
186LOCAL_CFLAGS += $(cFlags)
187LOCAL_CPPFLAGS += $(cppFlags)
Adam Lesinski59e04c62016-02-04 15:59:23 -0800188LOCAL_C_INCLUDES += $(protoIncludes)
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800189
190include $(BUILD_HOST_EXECUTABLE)
191
Adam Lesinski64587af2016-02-18 18:33:06 -0800192ifeq ($(ONE_SHOT_MAKEFILE),)
193include $(call all-makefiles-under,$(LOCAL_PATH))
194endif