2 # Copyright (C) 2014 The Android Open Source Project
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # This tool is prebuilt if we're doing an app-only build.
18 ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
20 # ==========================================================
21 # Setup some common variables for the different build
23 # ==========================================================
24 LOCAL_PATH:= $(call my-dir)
51 tests/AaptConfig_test.cpp \
52 tests/AaptGroupEntry_test.cpp \
53 tests/Pseudolocales_test.cpp \
54 tests/ResourceFilter_test.cpp \
55 tests/ResourceTable_test.cpp
57 aaptHostStaticLibs := \
67 aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER_FROM_FILE)\"
68 aaptCFlags += -Wall -Werror
70 aaptHostLdLibs_linux := -lrt -ldl -lpthread
72 # Statically link libz for MinGW (Win SDK under Linux),
73 # and dynamically link for all others.
74 aaptHostStaticLibs_windows := libz
75 aaptHostLdLibs_linux += -lz
76 aaptHostLdLibs_darwin := -lz
79 # ==========================================================
80 # Build the host static library: libaapt
81 # ==========================================================
84 LOCAL_MODULE := libaapt
85 LOCAL_MODULE_HOST_OS := darwin linux windows
86 LOCAL_CFLAGS := -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS $(aaptCFlags)
87 LOCAL_CPPFLAGS := $(aaptCppFlags)
88 LOCAL_CFLAGS_darwin := -D_DARWIN_UNLIMITED_STREAMS
89 LOCAL_SRC_FILES := $(aaptSources)
90 LOCAL_STATIC_LIBRARIES := $(aaptHostStaticLibs)
91 LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows)
93 include $(BUILD_HOST_STATIC_LIBRARY)
95 # ==========================================================
96 # Build the host executable: aapt
97 # ==========================================================
101 LOCAL_MODULE_HOST_OS := darwin linux windows
102 LOCAL_CFLAGS := $(aaptCFlags)
103 LOCAL_CPPFLAGS := $(aaptCppFlags)
104 LOCAL_LDLIBS_darwin := $(aaptHostLdLibs_darwin)
105 LOCAL_LDLIBS_linux := $(aaptHostLdLibs_linux)
106 LOCAL_SRC_FILES := $(aaptMain)
107 LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs)
108 LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows)
110 include $(BUILD_HOST_EXECUTABLE)
113 # ==========================================================
114 # Build the host tests: libaapt_tests
115 # ==========================================================
116 include $(CLEAR_VARS)
118 LOCAL_MODULE := libaapt_tests
119 LOCAL_CFLAGS := $(aaptCFlags)
120 LOCAL_CPPFLAGS := $(aaptCppFlags)
121 LOCAL_LDLIBS_darwin := $(aaptHostLdLibs_darwin)
122 LOCAL_LDLIBS_linux := $(aaptHostLdLibs_linux)
123 LOCAL_SRC_FILES := $(aaptTests)
124 LOCAL_C_INCLUDES := $(LOCAL_PATH)
125 LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs)
126 LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows)
128 include $(BUILD_HOST_NATIVE_TEST)
131 endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK