Android.mk revision d0f116b619feede0cfdb647157ce5ab4d50a1c46
1# 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# 16LOCAL_PATH:= $(call my-dir) 17 18# ========================================================== 19# Setup some common variables for the different build 20# targets here. 21# ========================================================== 22 23main := Main.cpp 24sources := \ 25 compile/IdAssigner.cpp \ 26 compile/Png.cpp \ 27 compile/PseudolocaleGenerator.cpp \ 28 compile/Pseudolocalizer.cpp \ 29 compile/XmlIdCollector.cpp \ 30 filter/ConfigFilter.cpp \ 31 flatten/Archive.cpp \ 32 flatten/TableFlattener.cpp \ 33 flatten/XmlFlattener.cpp \ 34 io/FileSystem.cpp \ 35 io/ZipArchive.cpp \ 36 link/AutoVersioner.cpp \ 37 link/ManifestFixer.cpp \ 38 link/ProductFilter.cpp \ 39 link/PrivateAttributeMover.cpp \ 40 link/ReferenceLinker.cpp \ 41 link/TableMerger.cpp \ 42 link/VersionCollapser.cpp \ 43 link/XmlReferenceLinker.cpp \ 44 process/SymbolTable.cpp \ 45 proto/ProtoHelpers.cpp \ 46 proto/TableProtoDeserializer.cpp \ 47 proto/TableProtoSerializer.cpp \ 48 split/TableSplitter.cpp \ 49 unflatten/BinaryResourceParser.cpp \ 50 unflatten/ResChunkPullParser.cpp \ 51 util/BigBuffer.cpp \ 52 util/Files.cpp \ 53 util/Util.cpp \ 54 ConfigDescription.cpp \ 55 Debug.cpp \ 56 Flags.cpp \ 57 java/AnnotationProcessor.cpp \ 58 java/ClassDefinition.cpp \ 59 java/JavaClassGenerator.cpp \ 60 java/ManifestClassGenerator.cpp \ 61 java/ProguardRules.cpp \ 62 Locale.cpp \ 63 Resource.cpp \ 64 ResourceParser.cpp \ 65 ResourceTable.cpp \ 66 ResourceUtils.cpp \ 67 ResourceValues.cpp \ 68 SdkConstants.cpp \ 69 StringPool.cpp \ 70 xml/XmlActionExecutor.cpp \ 71 xml/XmlDom.cpp \ 72 xml/XmlPullParser.cpp \ 73 xml/XmlUtil.cpp 74 75sources += Format.proto 76 77testSources := \ 78 compile/IdAssigner_test.cpp \ 79 compile/PseudolocaleGenerator_test.cpp \ 80 compile/Pseudolocalizer_test.cpp \ 81 compile/XmlIdCollector_test.cpp \ 82 filter/ConfigFilter_test.cpp \ 83 flatten/TableFlattener_test.cpp \ 84 flatten/XmlFlattener_test.cpp \ 85 link/AutoVersioner_test.cpp \ 86 link/ManifestFixer_test.cpp \ 87 link/PrivateAttributeMover_test.cpp \ 88 link/ProductFilter_test.cpp \ 89 link/ReferenceLinker_test.cpp \ 90 link/TableMerger_test.cpp \ 91 link/VersionCollapser_test.cpp \ 92 link/XmlReferenceLinker_test.cpp \ 93 process/SymbolTable_test.cpp \ 94 proto/TableProtoSerializer_test.cpp \ 95 split/TableSplitter_test.cpp \ 96 util/BigBuffer_test.cpp \ 97 util/Files_test.cpp \ 98 util/Maybe_test.cpp \ 99 util/StringPiece_test.cpp \ 100 util/Util_test.cpp \ 101 ConfigDescription_test.cpp \ 102 java/AnnotationProcessor_test.cpp \ 103 java/JavaClassGenerator_test.cpp \ 104 java/ManifestClassGenerator_test.cpp \ 105 Locale_test.cpp \ 106 NameMangler_test.cpp \ 107 Resource_test.cpp \ 108 ResourceParser_test.cpp \ 109 ResourceTable_test.cpp \ 110 ResourceUtils_test.cpp \ 111 SdkConstants_test.cpp \ 112 StringPool_test.cpp \ 113 ValueVisitor_test.cpp \ 114 xml/XmlActionExecutor_test.cpp \ 115 xml/XmlDom_test.cpp \ 116 xml/XmlPullParser_test.cpp \ 117 xml/XmlUtil_test.cpp 118 119toolSources := \ 120 compile/Compile.cpp \ 121 diff/Diff.cpp \ 122 dump/Dump.cpp \ 123 link/Link.cpp 124 125hostLdLibs := 126 127hostStaticLibs := \ 128 libandroidfw \ 129 libutils \ 130 liblog \ 131 libcutils \ 132 libexpat \ 133 libziparchive-host \ 134 libpng \ 135 libbase \ 136 libprotobuf-cpp-lite_static 137 138 139# Statically link libz for MinGW (Win SDK under Linux), 140# and dynamically link for all others. 141hostStaticLibs_windows := libz 142hostLdLibs_linux := -lz 143hostLdLibs_darwin := -lz 144 145cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG 146cFlags_darwin := -D_DARWIN_UNLIMITED_STREAMS 147cFlags_windows := -Wno-maybe-uninitialized # Incorrectly marking use of Maybe.value() as error. 148cppFlags := -std=c++11 -Wno-missing-field-initializers -fno-exceptions -fno-rtti 149protoIncludes := $(call generated-sources-dir-for,STATIC_LIBRARIES,libaapt2,HOST) 150 151# ========================================================== 152# NOTE: Do not add any shared libraries. 153# AAPT2 is built to run on many environments 154# that may not have the required dependencies. 155# ========================================================== 156 157# ========================================================== 158# Build the host static library: libaapt2 159# ========================================================== 160include $(CLEAR_VARS) 161LOCAL_MODULE := libaapt2 162LOCAL_MODULE_CLASS := STATIC_LIBRARIES 163LOCAL_MODULE_HOST_OS := darwin linux windows 164LOCAL_CFLAGS := $(cFlags) 165LOCAL_CFLAGS_darwin := $(cFlags_darwin) 166LOCAL_CFLAGS_windows := $(cFlags_windows) 167LOCAL_CPPFLAGS := $(cppFlags) 168LOCAL_C_INCLUDES := $(protoIncludes) 169LOCAL_SRC_FILES := $(sources) 170LOCAL_STATIC_LIBRARIES := $(hostStaticLibs) 171LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows) 172include $(BUILD_HOST_STATIC_LIBRARY) 173 174# ========================================================== 175# Build the host tests: libaapt2_tests 176# ========================================================== 177include $(CLEAR_VARS) 178LOCAL_MODULE := libaapt2_tests 179LOCAL_MODULE_TAGS := tests 180LOCAL_MODULE_HOST_OS := darwin linux windows 181LOCAL_CFLAGS := $(cFlags) 182LOCAL_CFLAGS_darwin := $(cFlags_darwin) 183LOCAL_CFLAGS_windows := $(cFlags_windows) 184LOCAL_CPPFLAGS := $(cppFlags) 185LOCAL_C_INCLUDES := $(protoIncludes) 186LOCAL_SRC_FILES := $(testSources) 187LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs) 188LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows) 189LOCAL_LDLIBS := $(hostLdLibs) 190LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin) 191LOCAL_LDLIBS_linux := $(hostLdLibs_linux) 192include $(BUILD_HOST_NATIVE_TEST) 193 194# ========================================================== 195# Build the host executable: aapt2 196# ========================================================== 197include $(CLEAR_VARS) 198LOCAL_MODULE := aapt2 199LOCAL_MODULE_HOST_OS := darwin linux windows 200LOCAL_CFLAGS := $(cFlags) 201LOCAL_CFLAGS_darwin := $(cFlags_darwin) 202LOCAL_CFLAGS_windows := $(cFlags_windows) 203LOCAL_CPPFLAGS := $(cppFlags) 204LOCAL_C_INCLUDES := $(protoIncludes) 205LOCAL_SRC_FILES := $(main) $(toolSources) 206LOCAL_STATIC_LIBRARIES := libaapt2 $(hostStaticLibs) 207LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows) 208LOCAL_LDLIBS := $(hostLdLibs) 209LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin) 210LOCAL_LDLIBS_linux := $(hostLdLibs_linux) 211include $(BUILD_HOST_EXECUTABLE) 212 213ifeq ($(ONE_SHOT_MAKEFILE),) 214include $(call all-makefiles-under,$(LOCAL_PATH)) 215endif 216