OSDN Git Service

Add PNG and 9-patch support
[android-x86/frameworks-base.git] / tools / aapt2 / Android.mk
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 #
16
17 # This tool is prebuilt if we're doing an app-only build.
18 ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
19
20 # ==========================================================
21 # Setup some common variables for the different build
22 # targets here.
23 # ==========================================================
24 LOCAL_PATH:= $(call my-dir)
25
26 main := Main.cpp
27 sources := \
28         BigBuffer.cpp \
29         BinaryResourceParser.cpp \
30         ConfigDescription.cpp \
31         Files.cpp \
32         Flag.cpp \
33         JavaClassGenerator.cpp \
34         Linker.cpp \
35         Locale.cpp \
36         Logger.cpp \
37         ManifestParser.cpp \
38         ManifestValidator.cpp \
39         Png.cpp \
40         ResChunkPullParser.cpp \
41         Resolver.cpp \
42         Resource.cpp \
43         ResourceParser.cpp \
44         ResourceTable.cpp \
45         ResourceValues.cpp \
46         SdkConstants.cpp \
47         StringPool.cpp \
48         TableFlattener.cpp \
49         Util.cpp \
50         ScopedXmlPullParser.cpp \
51         SourceXmlPullParser.cpp \
52         XliffXmlPullParser.cpp \
53         XmlFlattener.cpp
54
55 testSources := \
56         BigBuffer_test.cpp \
57         Compat_test.cpp \
58         ConfigDescription_test.cpp \
59         JavaClassGenerator_test.cpp \
60         Linker_test.cpp \
61         Locale_test.cpp \
62         ManifestParser_test.cpp \
63         Maybe_test.cpp \
64         ResourceParser_test.cpp \
65         Resource_test.cpp \
66         ResourceTable_test.cpp \
67         ScopedXmlPullParser_test.cpp \
68         StringPiece_test.cpp \
69         StringPool_test.cpp \
70         Util_test.cpp \
71         XliffXmlPullParser_test.cpp \
72         XmlFlattener_test.cpp
73
74 cIncludes := \
75         external/libpng \
76         external/libz
77
78 hostLdLibs :=
79
80 hostStaticLibs := \
81         libandroidfw \
82         libutils \
83         liblog \
84         libcutils \
85         libexpat \
86         libziparchive-host \
87         libpng
88
89 ifneq ($(strip $(USE_MINGW)),)
90         hostStaticLibs += libz
91 else
92         hostLdLibs += -lz
93 endif
94
95 cFlags := -Wall -Werror -Wno-unused-parameter -UNDEBUG
96 cppFlags := -std=c++11 -Wno-missing-field-initializers
97
98 # ==========================================================
99 # Build the host static library: libaapt2
100 # ==========================================================
101 include $(CLEAR_VARS)
102 LOCAL_MODULE := libaapt2
103
104 LOCAL_SRC_FILES := $(sources)
105 LOCAL_C_INCLUDES += $(cIncludes)
106 LOCAL_CFLAGS += $(cFlags)
107 LOCAL_CPPFLAGS += $(cppFlags)
108
109 include $(BUILD_HOST_STATIC_LIBRARY)
110
111
112 # ==========================================================
113 # Build the host tests: libaapt2_tests
114 # ==========================================================
115 include $(CLEAR_VARS)
116 LOCAL_MODULE := libaapt2_tests
117 LOCAL_MODULE_TAGS := tests
118
119 LOCAL_SRC_FILES := $(testSources)
120
121 LOCAL_C_INCLUDES += $(cIncludes)
122 LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
123 LOCAL_LDLIBS += $(hostLdLibs)
124 LOCAL_CFLAGS += $(cFlags)
125 LOCAL_CPPFLAGS += $(cppFlags)
126
127 include $(BUILD_HOST_NATIVE_TEST)
128
129 # ==========================================================
130 # Build the host executable: aapt2
131 # ==========================================================
132 include $(CLEAR_VARS)
133 LOCAL_MODULE := aapt2
134
135 LOCAL_SRC_FILES := $(main)
136
137 LOCAL_C_INCLUDES += $(cIncludes)
138 LOCAL_STATIC_LIBRARIES += libaapt2 $(hostStaticLibs)
139 LOCAL_LDLIBS += $(hostLdLibs)
140 LOCAL_CFLAGS += $(cFlags)
141 LOCAL_CPPFLAGS += $(cppFlags)
142
143 include $(BUILD_HOST_EXECUTABLE)
144
145 endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK