blob: 4ffb589e38f4bd4e77bf8e557e48a94b1e359cfd [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001# Copyright 2005 The Android Open Source Project
2#
3# Android.mk for adb
4#
5
6LOCAL_PATH:= $(call my-dir)
7
Elliott Hughes53daee62015-04-19 13:17:01 -07008ifeq ($(HOST_OS),windows)
Dan Alberta7a67c32015-05-05 14:50:09 -07009 adb_host_clang := false # libc++ for mingw not ready yet.
Elliott Hughes53daee62015-04-19 13:17:01 -070010else
Dan Alberta7a67c32015-05-05 14:50:09 -070011 adb_host_clang := true
Elliott Hughes53daee62015-04-19 13:17:01 -070012endif
Dan Albert9697ce52015-02-20 17:28:44 -080013
Dan Albert1ba1d7c2015-05-05 17:46:50 -070014adb_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
15
16ADB_COMMON_CFLAGS := \
17 -Wall -Werror \
18 -Wno-unused-parameter \
19 -DADB_REVISION='"$(adb_version)"' \
20
Dan Albert630b9af2014-11-24 23:34:35 -080021# libadb
22# =========================================================
23
24# Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes
25# made to adb rarely get ported to the other two, so the trees have diverged a
26# bit. We'd like to stop this because it is a maintenance nightmare, but the
27# divergence makes this difficult to do all at once. For now, we will start
28# small by moving common files into a static library. Hopefully some day we can
29# get enough of adb in here that we no longer need minadb. https://b/17626262
Dan Albertba3a2512015-02-18 17:47:33 -080030LIBADB_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -080031 adb.cpp \
32 adb_auth.cpp \
Dan Albertcc731cc2015-02-24 21:26:58 -080033 adb_io.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080034 adb_listeners.cpp \
Elliott Hughes58305772015-04-17 13:57:15 -070035 adb_utils.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080036 sockets.cpp \
37 transport.cpp \
38 transport_local.cpp \
39 transport_usb.cpp \
Dan Albertba3a2512015-02-18 17:47:33 -080040
Elliott Hughes53daee62015-04-19 13:17:01 -070041LIBADB_TEST_SRCS := \
42 adb_io_test.cpp \
43 adb_utils_test.cpp \
44 transport_test.cpp \
45
Dan Albertbf106472015-02-20 17:20:09 -080046LIBADB_CFLAGS := \
Dan Albert1ba1d7c2015-05-05 17:46:50 -070047 $(ADB_COMMON_CFLAGS) \
Dan Albert055f1aa2015-02-20 17:24:58 -080048 -Wno-missing-field-initializers \
Dan Albertba3a2512015-02-18 17:47:33 -080049 -fvisibility=hidden \
Dan Albert630b9af2014-11-24 23:34:35 -080050
Dan Albertbac34742015-02-25 17:51:28 -080051LIBADB_darwin_SRC_FILES := \
52 fdevent.cpp \
Elliott Hughes1a4d85a2015-04-16 13:24:58 -070053 get_my_path_darwin.cpp \
Dan Albert7447dd02015-04-16 19:20:40 -070054 usb_osx.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080055
56LIBADB_linux_SRC_FILES := \
57 fdevent.cpp \
58 get_my_path_linux.cpp \
59 usb_linux.cpp \
60
61LIBADB_windows_SRC_FILES := \
62 get_my_path_windows.cpp \
Elliott Hughesa2f2e562015-04-16 16:47:02 -070063 sysdeps_win32.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080064 usb_windows.cpp \
Dan Albert94493762014-11-25 11:00:56 -080065
66include $(CLEAR_VARS)
Elliott Hughes2acec912015-04-16 14:12:50 -070067LOCAL_CLANG := true
Dan Albert94493762014-11-25 11:00:56 -080068LOCAL_MODULE := libadbd
69LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
Dan Albert21c3eaf2015-02-18 17:20:44 -080070LOCAL_SRC_FILES := \
71 $(LIBADB_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080072 adb_auth_client.cpp \
Dan Albert3c438582015-02-20 17:24:30 -080073 fdevent.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080074 jdwp_service.cpp \
75 qemu_tracing.cpp \
Elliott Hughes2acec912015-04-16 14:12:50 -070076 usb_linux_client.cpp \
Dan Albert21c3eaf2015-02-18 17:20:44 -080077
Elliott Hughes7b506092015-04-20 08:09:20 -070078LOCAL_SHARED_LIBRARIES := libbase
79
Dan Albert94493762014-11-25 11:00:56 -080080include $(BUILD_STATIC_LIBRARY)
81
Dan Albert630b9af2014-11-24 23:34:35 -080082include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -070083LOCAL_CLANG := $(adb_host_clang)
Dan Albert630b9af2014-11-24 23:34:35 -080084LOCAL_MODULE := libadb
Dan Albert94493762014-11-25 11:00:56 -080085LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Alberte1ca6232015-02-19 13:19:42 -080086LOCAL_SRC_FILES := \
87 $(LIBADB_SRC_FILES) \
Dan Albert3c438582015-02-20 17:24:30 -080088 $(LIBADB_$(HOST_OS)_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080089 adb_auth_host.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -080090
Elliott Hughes7b506092015-04-20 08:09:20 -070091LOCAL_SHARED_LIBRARIES := libbase
92
Dan Alberte1ca6232015-02-19 13:19:42 -080093# Even though we're building a static library (and thus there's no link step for
94# this to take effect), this adds the SSL includes to our path.
95LOCAL_STATIC_LIBRARIES := libcrypto_static
96
Dan Albert88cf1c82015-02-24 14:08:03 -080097ifeq ($(HOST_OS),windows)
98 LOCAL_C_INCLUDES += development/host/windows/usb/api/
Spencer Low142ec752015-05-06 16:13:42 -070099 # Windows.h defines an awful ERROR macro that collides with base/logging.h.
100 # Suppress it with NOGDI.
101 LOCAL_CFLAGS += -DNOGDI
Dan Albert88cf1c82015-02-24 14:08:03 -0800102endif
103
Dan Albert630b9af2014-11-24 23:34:35 -0800104include $(BUILD_HOST_STATIC_LIBRARY)
105
Dan Albert055f1aa2015-02-20 17:24:58 -0800106include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700107LOCAL_CLANG := true
Dan Albert055f1aa2015-02-20 17:24:58 -0800108LOCAL_MODULE := adbd_test
109LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
110LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
111LOCAL_STATIC_LIBRARIES := libadbd
Dan Albertc007bc32015-03-16 10:08:46 -0700112LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
Dan Albert055f1aa2015-02-20 17:24:58 -0800113include $(BUILD_NATIVE_TEST)
114
Dan Alberta7a67c32015-05-05 14:50:09 -0700115ifneq ($(HOST_OS),windows)
Dan Albert055f1aa2015-02-20 17:24:58 -0800116include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700117LOCAL_CLANG := $(adb_host_clang)
Dan Albert055f1aa2015-02-20 17:24:58 -0800118LOCAL_MODULE := adb_test
119LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
Dan Albertbac34742015-02-25 17:51:28 -0800120LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
Dan Albertc007bc32015-03-16 10:08:46 -0700121LOCAL_SHARED_LIBRARIES := liblog libbase
Dan Albert055f1aa2015-02-20 17:24:58 -0800122LOCAL_STATIC_LIBRARIES := \
123 libadb \
124 libcrypto_static \
125 libcutils \
126
127ifeq ($(HOST_OS),linux)
Dan Alberta7a67c32015-05-05 14:50:09 -0700128 LOCAL_LDLIBS += -lrt -ldl -lpthread
Dan Albert055f1aa2015-02-20 17:24:58 -0800129endif
130
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700131ifeq ($(HOST_OS),darwin)
Dan Alberta7a67c32015-05-05 14:50:09 -0700132 LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700133endif
134
Dan Albert055f1aa2015-02-20 17:24:58 -0800135include $(BUILD_HOST_NATIVE_TEST)
Dan Alberta7a67c32015-05-05 14:50:09 -0700136endif
Dan Albert055f1aa2015-02-20 17:24:58 -0800137
Elliott Hughese67f1f82015-04-30 17:32:03 -0700138# adb device tracker (used by ddms) test tool
139# =========================================================
140
141ifeq ($(HOST_OS),linux)
142include $(CLEAR_VARS)
143LOCAL_CLANG := $(adb_host_clang)
144LOCAL_MODULE := adb_device_tracker_test
145LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
146LOCAL_SRC_FILES := test_track_devices.cpp
147LOCAL_SHARED_LIBRARIES := liblog libbase
148LOCAL_STATIC_LIBRARIES := libadb libcrypto_static libcutils
149LOCAL_LDLIBS += -lrt -ldl -lpthread
150include $(BUILD_HOST_EXECUTABLE)
151endif
152
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800153# adb host tool
154# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800155include $(CLEAR_VARS)
156
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800157ifeq ($(HOST_OS),linux)
Spencer Low142ec752015-05-06 16:13:42 -0700158 LOCAL_LDLIBS += -lrt -ldl -lpthread
159 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800160endif
161
162ifeq ($(HOST_OS),darwin)
Spencer Low142ec752015-05-06 16:13:42 -0700163 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
164 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800165endif
166
167ifeq ($(HOST_OS),windows)
Spencer Low142ec752015-05-06 16:13:42 -0700168 # Windows.h defines an awful ERROR macro that collides with base/logging.h.
169 # Suppress it with NOGDI.
170 LOCAL_CFLAGS += -DNOGDI
171 LOCAL_LDLIBS += -lws2_32 -lgdi32
172 EXTRA_STATIC_LIBS := AdbWinApi
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800173endif
174
Elliott Hughes53daee62015-04-19 13:17:01 -0700175LOCAL_CLANG := $(adb_host_clang)
Dan Albert9697ce52015-02-20 17:28:44 -0800176
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800177LOCAL_SRC_FILES := \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700178 client/main.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800179 console.cpp \
180 commandline.cpp \
181 adb_client.cpp \
182 services.cpp \
183 file_sync_client.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800184
Dan Albert7fd821e2015-02-24 22:38:21 -0800185LOCAL_CFLAGS += \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700186 $(ADB_COMMON_CFLAGS) \
Dan Albert7fd821e2015-02-24 22:38:21 -0800187 -D_GNU_SOURCE \
188 -DADB_HOST=1 \
189
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800190LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700191LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800192
Dan Albert630b9af2014-11-24 23:34:35 -0800193LOCAL_STATIC_LIBRARIES := \
194 libadb \
Elliott Hughes2baae3a2015-04-17 10:59:34 -0700195 libbase \
Dan Albert630b9af2014-11-24 23:34:35 -0800196 libcrypto_static \
Elliott Hughes53daee62015-04-19 13:17:01 -0700197 libcutils \
Elliott Hughes9309ecb2015-04-27 14:20:17 -0700198 liblog \
Dan Albert630b9af2014-11-24 23:34:35 -0800199 $(EXTRA_STATIC_LIBS) \
200
Colin Crossdc1e4822015-04-20 12:36:50 -0700201# libc++ not available on windows yet
202ifneq ($(HOST_OS),windows)
203 LOCAL_CXX_STL := libc++_static
204endif
Colin Cross55bf5f02015-04-16 16:21:44 -0700205
206# Don't add anything here, we don't want additional shared dependencies
207# on the host adb tool, and shared libraries that link against libc++
208# will violate ODR
209LOCAL_SHARED_LIBRARIES :=
210
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800211include $(BUILD_HOST_EXECUTABLE)
212
Ying Wang96535ba2012-09-05 10:26:43 -0700213$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800214
215ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700216$(LOCAL_INSTALLED_MODULE): \
217 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
218 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800219endif
220
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800221
222# adbd device daemon
223# =========================================================
224
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800225include $(CLEAR_VARS)
226
Elliott Hughes53daee62015-04-19 13:17:01 -0700227LOCAL_CLANG := true
Dan Albert9697ce52015-02-20 17:28:44 -0800228
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800229LOCAL_SRC_FILES := \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700230 daemon/main.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800231 services.cpp \
232 file_sync_service.cpp \
233 framebuffer_service.cpp \
234 remount_service.cpp \
235 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800236
Christopher Ferris51448eb2014-09-03 19:48:48 -0700237LOCAL_CFLAGS := \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700238 $(ADB_COMMON_CFLAGS) \
Dan Albertbac34742015-02-25 17:51:28 -0800239 -DADB_HOST=0 \
240 -D_GNU_SOURCE \
Dan Albertbac34742015-02-25 17:51:28 -0800241 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800242
Nick Kralevich5890fe32012-01-19 13:11:35 -0800243ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
244LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
245endif
246
Elliott Hughesec7a6672015-03-16 21:58:32 +0000247ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000248LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
249endif
250
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800251LOCAL_MODULE := adbd
252
253LOCAL_FORCE_STATIC_EXECUTABLE := true
254LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
255LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Tao Bao175b7bb2015-03-29 11:22:34 -0700256LOCAL_C_INCLUDES += system/extras/ext4_utils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800257
Dan Albert630b9af2014-11-24 23:34:35 -0800258LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800259 libadbd \
Tao Bao175b7bb2015-03-29 11:22:34 -0700260 libbase \
Dan Albert030b76f2015-01-26 17:13:54 -0800261 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800262 liblog \
263 libcutils \
264 libc \
265 libmincrypt \
266 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800267 libext4_utils_static \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000268
Jeff Brown29e1e732011-07-11 22:12:32 -0700269include $(BUILD_EXECUTABLE)