Android.mk revision ad751224401564dcc8338df3d5c4c5de7722be8f
1#
2# Copyright (C) 2014 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
26aaptMain := Main.cpp
27aaptSources := \
28    AaptAssets.cpp \
29    AaptConfig.cpp \
30    AaptUtil.cpp \
31    ApkBuilder.cpp \
32    Command.cpp \
33    CrunchCache.cpp \
34    FileFinder.cpp \
35    Package.cpp \
36    StringPool.cpp \
37    XMLNode.cpp \
38    ResourceFilter.cpp \
39    ResourceIdCache.cpp \
40    ResourceTable.cpp \
41    Images.cpp \
42    Resource.cpp \
43    pseudolocalize.cpp \
44    SourcePos.cpp \
45    WorkQueue.cpp \
46    ZipEntry.cpp \
47    ZipFile.cpp \
48    qsort_r_compat.c
49
50aaptTests := \
51    tests/AaptConfig_test.cpp \
52    tests/AaptGroupEntry_test.cpp \
53    tests/ResourceFilter_test.cpp
54
55aaptCIncludes := \
56    external/libpng \
57    external/zlib
58
59aaptHostLdLibs :=
60aaptHostStaticLibs := \
61    libandroidfw \
62    libpng \
63    liblog \
64    libutils \
65    libcutils \
66    libexpat \
67    libziparchive-host
68
69aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER)\"
70
71ifeq ($(HOST_OS),linux)
72    aaptHostLdLibs += -lrt -ldl -lpthread
73endif
74
75# Statically link libz for MinGW (Win SDK under Linux),
76# and dynamically link for all others.
77ifneq ($(strip $(USE_MINGW)),)
78    aaptHostStaticLibs += libz
79else
80    aaptHostLdLibs += -lz
81endif
82
83
84# ==========================================================
85# Build the host static library: libaapt
86# ==========================================================
87include $(CLEAR_VARS)
88
89LOCAL_MODULE := libaapt
90
91LOCAL_SRC_FILES := $(aaptSources)
92LOCAL_C_INCLUDES += $(aaptCIncludes)
93
94LOCAL_CFLAGS += -Wno-format-y2k
95LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS
96LOCAL_CFLAGS += $(aaptCFlags)
97ifeq (darwin,$(HOST_OS))
98LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS
99endif
100
101include $(BUILD_HOST_STATIC_LIBRARY)
102
103
104# ==========================================================
105# Build the host executable: aapt
106# ==========================================================
107include $(CLEAR_VARS)
108
109LOCAL_MODULE := aapt
110
111LOCAL_SRC_FILES := $(aaptMain)
112
113LOCAL_STATIC_LIBRARIES += \
114    libaapt \
115    $(aaptHostStaticLibs)
116
117LOCAL_LDLIBS += $(aaptHostLdLibs)
118LOCAL_CFLAGS += $(aaptCFlags)
119
120include $(BUILD_HOST_EXECUTABLE)
121
122
123# ==========================================================
124# Build the host tests: libaapt_tests
125# ==========================================================
126include $(CLEAR_VARS)
127
128LOCAL_MODULE := libaapt_tests
129
130LOCAL_SRC_FILES += $(aaptTests)
131LOCAL_C_INCLUDES += $(LOCAL_PATH)
132
133LOCAL_STATIC_LIBRARIES += \
134    libaapt \
135    $(aaptHostStaticLibs)
136
137LOCAL_LDLIBS += $(aaptHostLdLibs)
138LOCAL_CFLAGS += $(aaptCFlags)
139
140include $(BUILD_HOST_NATIVE_TEST)
141
142
143# ==========================================================
144# Build the device executable: aapt
145# ==========================================================
146ifneq ($(SDK_ONLY),true)
147include $(CLEAR_VARS)
148
149LOCAL_MODULE := aapt
150
151LOCAL_SRC_FILES := $(aaptSources) $(aaptMain)
152LOCAL_C_INCLUDES += \
153    $(aaptCIncludes) \
154    bionic \
155    external/stlport/stlport
156
157LOCAL_SHARED_LIBRARIES := \
158    libandroidfw \
159    libutils \
160    libcutils \
161    libpng \
162    liblog \
163    libz
164
165LOCAL_STATIC_LIBRARIES := \
166    libstlport_static \
167    libexpat_static
168
169LOCAL_CFLAGS += $(aaptCFlags)
170LOCAL_CPPFLAGS += -Wno-non-virtual-dtor
171
172include $(BUILD_EXECUTABLE)
173
174endif # Not SDK_ONLY
175
176endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
177