blob: ae03593ed26fa15d16c9813486cfb7e57b847f16 [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 Hughes4d4f64f2017-05-08 11:30:34 -07008include $(LOCAL_PATH)/../platform_tools_tool_version.mk
9
Dan Albert9113b472015-07-30 10:25:32 -070010adb_host_sanitize :=
11adb_target_sanitize :=
12
Dan Albert1ba1d7c2015-05-05 17:46:50 -070013ADB_COMMON_CFLAGS := \
Dan Albert23fee8f2015-05-20 18:56:10 -070014 -Wall -Wextra -Werror \
Dan Albert459df8f2015-07-08 13:50:42 -070015 -Wno-unused-parameter \
Dan Albert286bb6d2015-07-09 20:35:09 +000016 -Wno-missing-field-initializers \
Elliott Hughes6d929972015-10-27 13:40:35 -070017 -Wvla \
Elliott Hughes8964fbf2017-05-10 08:41:33 -070018 -DADB_VERSION="\"$(tool_version)\"" \
Dan Albert1ba1d7c2015-05-05 17:46:50 -070019
Josh Gao68f679c2017-05-03 14:01:35 -070020ADB_COMMON_posix_CFLAGS := \
Josh Gaob7b1edf2015-11-11 17:56:12 -080021 -Wexit-time-destructors \
Elliott Hughes8964fbf2017-05-10 08:41:33 -070022 -Wthread-safety \
Josh Gao68f679c2017-05-03 14:01:35 -070023
24ADB_COMMON_linux_CFLAGS := \
25 $(ADB_COMMON_posix_CFLAGS) \
Josh Gaob7b1edf2015-11-11 17:56:12 -080026
27ADB_COMMON_darwin_CFLAGS := \
Josh Gao68f679c2017-05-03 14:01:35 -070028 $(ADB_COMMON_posix_CFLAGS) \
Josh Gaob7b1edf2015-11-11 17:56:12 -080029
Spencer Lowe347c1d2015-08-02 18:13:54 -070030# Define windows.h and tchar.h Unicode preprocessor symbols so that
31# CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
32# build if you accidentally pass char*. Fix by calling like:
Spencer Lowd21dc822015-11-12 15:20:15 -080033# std::wstring path_wide;
34# if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
35# CreateFileW(path_wide.c_str());
Spencer Lowe347c1d2015-08-02 18:13:54 -070036ADB_COMMON_windows_CFLAGS := \
37 -DUNICODE=1 -D_UNICODE=1 \
38
Dan Albert630b9af2014-11-24 23:34:35 -080039# libadb
40# =========================================================
41
42# Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes
43# made to adb rarely get ported to the other two, so the trees have diverged a
44# bit. We'd like to stop this because it is a maintenance nightmare, but the
45# divergence makes this difficult to do all at once. For now, we will start
46# small by moving common files into a static library. Hopefully some day we can
47# get enough of adb in here that we no longer need minadb. https://b/17626262
Dan Albertba3a2512015-02-18 17:47:33 -080048LIBADB_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -080049 adb.cpp \
Dan Albertcc731cc2015-02-24 21:26:58 -080050 adb_io.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080051 adb_listeners.cpp \
Yabin Cuiaed3c612015-09-22 15:52:57 -070052 adb_trace.cpp \
Elliott Hughes58305772015-04-17 13:57:15 -070053 adb_utils.cpp \
Josh Gao3777d2e2016-02-16 17:34:53 -080054 fdevent.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080055 sockets.cpp \
Josh Gaocfb21412016-08-24 18:38:44 -070056 socket_spec.cpp \
Josh Gao5a1e3fd2016-12-05 17:11:34 -080057 sysdeps/errno.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080058 transport.cpp \
59 transport_local.cpp \
60 transport_usb.cpp \
Dan Albertba3a2512015-02-18 17:47:33 -080061
Elliott Hughes53daee62015-04-19 13:17:01 -070062LIBADB_TEST_SRCS := \
63 adb_io_test.cpp \
David Purselleaae97e2016-04-07 11:25:48 -070064 adb_listeners_test.cpp \
Elliott Hughes53daee62015-04-19 13:17:01 -070065 adb_utils_test.cpp \
Josh Gao022d4472016-02-10 14:49:00 -080066 fdevent_test.cpp \
Josh Gao10992152016-09-19 17:31:55 -070067 socket_spec_test.cpp \
Josh Gao022d4472016-02-10 14:49:00 -080068 socket_test.cpp \
Josh Gao3b3e10d2016-02-09 14:59:09 -080069 sysdeps_test.cpp \
Josh Gaof551ea02016-07-28 18:09:48 -070070 sysdeps/stat_test.cpp \
Elliott Hughes53daee62015-04-19 13:17:01 -070071 transport_test.cpp \
72
Dan Albertbf106472015-02-20 17:20:09 -080073LIBADB_CFLAGS := \
Dan Albert1ba1d7c2015-05-05 17:46:50 -070074 $(ADB_COMMON_CFLAGS) \
Dan Albertba3a2512015-02-18 17:47:33 -080075 -fvisibility=hidden \
Elliott Hughes4f1d7b52015-07-24 14:32:46 -070076
77LIBADB_linux_CFLAGS := \
Josh Gaob7b1edf2015-11-11 17:56:12 -080078 $(ADB_COMMON_linux_CFLAGS) \
79
80LIBADB_darwin_CFLAGS := \
81 $(ADB_COMMON_darwin_CFLAGS) \
Dan Albert630b9af2014-11-24 23:34:35 -080082
Dan Willemsen87a419c2015-08-13 14:43:34 -070083LIBADB_windows_CFLAGS := \
84 $(ADB_COMMON_windows_CFLAGS) \
Elliott Hughes4f1d7b52015-07-24 14:32:46 -070085
Dan Albertbac34742015-02-25 17:51:28 -080086LIBADB_darwin_SRC_FILES := \
David Pursellbfd95032016-02-22 14:27:23 -080087 sysdeps_unix.cpp \
Josh Gao46de1d72017-04-12 13:57:06 -070088 sysdeps/posix/network.cpp \
Josh Gao1c70e1b2016-09-28 12:32:45 -070089 client/usb_dispatch.cpp \
90 client/usb_libusb.cpp \
Josh Gao456e1ad2017-01-19 13:44:23 -080091 client/usb_osx.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080092
93LIBADB_linux_SRC_FILES := \
David Pursellbfd95032016-02-22 14:27:23 -080094 sysdeps_unix.cpp \
Josh Gao46de1d72017-04-12 13:57:06 -070095 sysdeps/posix/network.cpp \
Josh Gao1c70e1b2016-09-28 12:32:45 -070096 client/usb_dispatch.cpp \
97 client/usb_libusb.cpp \
Josh Gao456e1ad2017-01-19 13:44:23 -080098 client/usb_linux.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080099
100LIBADB_windows_SRC_FILES := \
Elliott Hughesa2f2e562015-04-16 16:47:02 -0700101 sysdeps_win32.cpp \
Josh Gaoa3577e12016-12-05 13:24:48 -0800102 sysdeps/win32/errno.cpp \
Josh Gaof551ea02016-07-28 18:09:48 -0700103 sysdeps/win32/stat.cpp \
Josh Gao456e1ad2017-01-19 13:44:23 -0800104 client/usb_windows.cpp \
Dan Albert94493762014-11-25 11:00:56 -0800105
Spencer Lowe6ae5732015-09-08 17:13:04 -0700106LIBADB_TEST_windows_SRCS := \
Josh Gaoa3577e12016-12-05 13:24:48 -0800107 sysdeps/win32/errno_test.cpp \
Spencer Lowe6ae5732015-09-08 17:13:04 -0700108 sysdeps_win32_test.cpp \
109
Dan Albert94493762014-11-25 11:00:56 -0800110include $(CLEAR_VARS)
Elliott Hughes2acec912015-04-16 14:12:50 -0700111LOCAL_CLANG := true
Josh Gao44c688c2017-01-11 17:37:35 -0800112LOCAL_MODULE := libadbd_usb
Dan Albert94493762014-11-25 11:00:56 -0800113LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
Josh Gao44c688c2017-01-11 17:37:35 -0800114LOCAL_SRC_FILES := daemon/usb.cpp
Dan Albert21c3eaf2015-02-18 17:20:44 -0800115
Dan Albert9113b472015-07-30 10:25:32 -0700116LOCAL_SANITIZE := $(adb_target_sanitize)
Elliott Hughes7b506092015-04-20 08:09:20 -0700117
Dan Alberte2462192015-03-19 13:25:27 -0700118# Even though we're building a static library (and thus there's no link step for
119# this to take effect), this adds the includes to our path.
Josh Gao47763c32016-08-05 15:47:57 -0700120LOCAL_STATIC_LIBRARIES := libcrypto_utils libcrypto libbase
Dan Alberte2462192015-03-19 13:25:27 -0700121
Dan Albert94493762014-11-25 11:00:56 -0800122include $(BUILD_STATIC_LIBRARY)
123
Dan Albert630b9af2014-11-24 23:34:35 -0800124include $(CLEAR_VARS)
Josh Gao44c688c2017-01-11 17:37:35 -0800125LOCAL_CLANG := true
126LOCAL_MODULE := libadbd
127LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
128LOCAL_SRC_FILES := \
129 $(LIBADB_SRC_FILES) \
130 adbd_auth.cpp \
131 jdwp_service.cpp \
Josh Gao46de1d72017-04-12 13:57:06 -0700132 sysdeps/posix/network.cpp \
Josh Gao44c688c2017-01-11 17:37:35 -0800133
134LOCAL_SANITIZE := $(adb_target_sanitize)
135
136# Even though we're building a static library (and thus there's no link step for
137# this to take effect), this adds the includes to our path.
138LOCAL_STATIC_LIBRARIES := libcrypto_utils libcrypto libbase
139
140LOCAL_WHOLE_STATIC_LIBRARIES := libadbd_usb
141
142include $(BUILD_STATIC_LIBRARY)
143
144include $(CLEAR_VARS)
Dan Albert630b9af2014-11-24 23:34:35 -0800145LOCAL_MODULE := libadb
Dan Willemsen87a419c2015-08-13 14:43:34 -0700146LOCAL_MODULE_HOST_OS := darwin linux windows
Dan Albert94493762014-11-25 11:00:56 -0800147LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Willemsen87a419c2015-08-13 14:43:34 -0700148LOCAL_CFLAGS_windows := $(LIBADB_windows_CFLAGS)
149LOCAL_CFLAGS_linux := $(LIBADB_linux_CFLAGS)
Josh Gaob7b1edf2015-11-11 17:56:12 -0800150LOCAL_CFLAGS_darwin := $(LIBADB_darwin_CFLAGS)
Dan Alberte1ca6232015-02-19 13:19:42 -0800151LOCAL_SRC_FILES := \
152 $(LIBADB_SRC_FILES) \
Casey Dahlin2fe9b602016-09-21 14:03:39 -0700153 adb_auth_host.cpp \
154 transport_mdns.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -0800155
Dan Willemsen87a419c2015-08-13 14:43:34 -0700156LOCAL_SRC_FILES_darwin := $(LIBADB_darwin_SRC_FILES)
157LOCAL_SRC_FILES_linux := $(LIBADB_linux_SRC_FILES)
158LOCAL_SRC_FILES_windows := $(LIBADB_windows_SRC_FILES)
159
Dan Albert9113b472015-07-30 10:25:32 -0700160LOCAL_SANITIZE := $(adb_host_sanitize)
Elliott Hughes7b506092015-04-20 08:09:20 -0700161
Dan Alberte1ca6232015-02-19 13:19:42 -0800162# Even though we're building a static library (and thus there's no link step for
Dan Alberte2462192015-03-19 13:25:27 -0700163# this to take effect), this adds the includes to our path.
Casey Dahlin2fe9b602016-09-21 14:03:39 -0700164LOCAL_STATIC_LIBRARIES := libcrypto_utils libcrypto libbase libmdnssd
165LOCAL_STATIC_LIBRARIES_linux := libusb
Josh Gao1c70e1b2016-09-28 12:32:45 -0700166LOCAL_STATIC_LIBRARIES_darwin := libusb
Dan Alberte1ca6232015-02-19 13:19:42 -0800167
Dan Willemsen87a419c2015-08-13 14:43:34 -0700168LOCAL_C_INCLUDES_windows := development/host/windows/usb/api/
Dan Willemsen66680c52015-09-03 20:29:56 -0700169LOCAL_MULTILIB := first
Dan Albert88cf1c82015-02-24 14:08:03 -0800170
Dan Albert630b9af2014-11-24 23:34:35 -0800171include $(BUILD_HOST_STATIC_LIBRARY)
172
Dan Albert055f1aa2015-02-20 17:24:58 -0800173include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700174LOCAL_CLANG := true
Dan Albert055f1aa2015-02-20 17:24:58 -0800175LOCAL_MODULE := adbd_test
176LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
Yabin Cuibec02fc2015-08-28 15:44:27 -0700177LOCAL_SRC_FILES := \
178 $(LIBADB_TEST_SRCS) \
179 $(LIBADB_TEST_linux_SRCS) \
David Pursell0955c662015-08-31 10:42:13 -0700180 shell_service.cpp \
David Pursellb9e2e842015-08-31 15:36:18 -0700181 shell_service_protocol.cpp \
182 shell_service_protocol_test.cpp \
David Pursell0955c662015-08-31 10:42:13 -0700183 shell_service_test.cpp \
Yabin Cuibec02fc2015-08-28 15:44:27 -0700184
Dan Albert9113b472015-07-30 10:25:32 -0700185LOCAL_SANITIZE := $(adb_target_sanitize)
Casey Dahlin2fe9b602016-09-21 14:03:39 -0700186LOCAL_STATIC_LIBRARIES := libadbd libcrypto_utils libcrypto libusb libmdnssd
Dimitry Ivanov01f21da2016-02-12 18:40:29 -0800187LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
Dan Albert055f1aa2015-02-20 17:24:58 -0800188include $(BUILD_NATIVE_TEST)
189
Elliott Hughes1b708d32015-12-11 19:07:01 -0800190# libdiagnose_usb
191# =========================================================
192
193include $(CLEAR_VARS)
194LOCAL_MODULE := libdiagnose_usb
195LOCAL_MODULE_HOST_OS := darwin linux windows
196LOCAL_CFLAGS := $(LIBADB_CFLAGS)
197LOCAL_SRC_FILES := diagnose_usb.cpp
198# Even though we're building a static library (and thus there's no link step for
199# this to take effect), this adds the includes to our path.
200LOCAL_STATIC_LIBRARIES := libbase
201include $(BUILD_HOST_STATIC_LIBRARY)
202
Spencer Lowcf168a82015-05-24 15:36:28 -0700203# adb_test
204# =========================================================
205
Dan Albert055f1aa2015-02-20 17:24:58 -0800206include $(CLEAR_VARS)
Dan Albert055f1aa2015-02-20 17:24:58 -0800207LOCAL_MODULE := adb_test
Spencer Lowebf770f2015-09-07 23:39:02 -0700208LOCAL_MODULE_HOST_OS := darwin linux windows
Dan Albert055f1aa2015-02-20 17:24:58 -0800209LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
Dan Willemsen87a419c2015-08-13 14:43:34 -0700210LOCAL_CFLAGS_windows := $(LIBADB_windows_CFLAGS)
211LOCAL_CFLAGS_linux := $(LIBADB_linux_CFLAGS)
Josh Gaob7b1edf2015-11-11 17:56:12 -0800212LOCAL_CFLAGS_darwin := $(LIBADB_darwin_CFLAGS)
David Pursellb9e2e842015-08-31 15:36:18 -0700213LOCAL_SRC_FILES := \
214 $(LIBADB_TEST_SRCS) \
Felipe Leme698e0652016-07-19 17:07:22 -0700215 adb_client.cpp \
216 bugreport.cpp \
217 bugreport_test.cpp \
Felipe Leme6f5080f2016-07-26 12:23:40 -0700218 line_printer.cpp \
David Pursellb9e2e842015-08-31 15:36:18 -0700219 services.cpp \
220 shell_service_protocol.cpp \
221 shell_service_protocol_test.cpp \
222
David Pursellb404dec2015-09-11 16:06:59 -0700223LOCAL_SRC_FILES_linux := $(LIBADB_TEST_linux_SRCS)
Dan Willemsen87a419c2015-08-13 14:43:34 -0700224LOCAL_SRC_FILES_darwin := $(LIBADB_TEST_darwin_SRCS)
Spencer Lowe6ae5732015-09-08 17:13:04 -0700225LOCAL_SRC_FILES_windows := $(LIBADB_TEST_windows_SRCS)
Dan Albert9113b472015-07-30 10:25:32 -0700226LOCAL_SANITIZE := $(adb_host_sanitize)
Dan Albert055f1aa2015-02-20 17:24:58 -0800227LOCAL_STATIC_LIBRARIES := \
228 libadb \
Josh Gao47330e22017-04-12 17:04:41 -0700229 libbase \
Josh Gao47763c32016-08-05 15:47:57 -0700230 libcrypto_utils \
231 libcrypto \
Dan Albert055f1aa2015-02-20 17:24:58 -0800232 libcutils \
Elliott Hughes1b708d32015-12-11 19:07:01 -0800233 libdiagnose_usb \
Casey Dahlin2fe9b602016-09-21 14:03:39 -0700234 libmdnssd \
Elliott Hughes8964fbf2017-05-10 08:41:33 -0700235 libgmock_host \
Dan Albert055f1aa2015-02-20 17:24:58 -0800236
Casey Dahlin2fe9b602016-09-21 14:03:39 -0700237LOCAL_STATIC_LIBRARIES_linux := libusb
Josh Gao1c70e1b2016-09-28 12:32:45 -0700238LOCAL_STATIC_LIBRARIES_darwin := libusb
239
Spencer Lowe6ae5732015-09-08 17:13:04 -0700240# Set entrypoint to wmain from sysdeps_win32.cpp instead of main
241LOCAL_LDFLAGS_windows := -municode
Dan Willemsen87a419c2015-08-13 14:43:34 -0700242LOCAL_LDLIBS_linux := -lrt -ldl -lpthread
Josh Gao1c70e1b2016-09-28 12:32:45 -0700243LOCAL_LDLIBS_darwin := -framework CoreFoundation -framework IOKit -lobjc
Josh Gao3d4d9732017-02-23 13:16:52 -0800244LOCAL_LDLIBS_windows := -lws2_32 -luserenv
Dan Willemsen87a419c2015-08-13 14:43:34 -0700245LOCAL_STATIC_LIBRARIES_windows := AdbWinApi
Dan Albert055f1aa2015-02-20 17:24:58 -0800246
Dan Willemsen1e20e0a2015-12-21 16:14:31 -0800247LOCAL_MULTILIB := first
248
Spencer Lowcf168a82015-05-24 15:36:28 -0700249include $(BUILD_HOST_NATIVE_TEST)
250
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800251# adb host tool
252# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800253include $(CLEAR_VARS)
254
Dan Willemsen87a419c2015-08-13 14:43:34 -0700255LOCAL_LDLIBS_linux := -lrt -ldl -lpthread
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800256
Josh Gao1c70e1b2016-09-28 12:32:45 -0700257LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon -lobjc
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800258
Dan Willemsen87a419c2015-08-13 14:43:34 -0700259# Use wmain instead of main
260LOCAL_LDFLAGS_windows := -municode
Josh Gao3d4d9732017-02-23 13:16:52 -0800261LOCAL_LDLIBS_windows := -lws2_32 -lgdi32
Dan Willemsen87a419c2015-08-13 14:43:34 -0700262LOCAL_STATIC_LIBRARIES_windows := AdbWinApi
263LOCAL_REQUIRED_MODULES_windows := AdbWinApi AdbWinUsbApi
Dan Albert9697ce52015-02-20 17:28:44 -0800264
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800265LOCAL_SRC_FILES := \
Elliott Hughesb708d162015-10-27 16:03:15 -0700266 adb_client.cpp \
Felipe Leme698e0652016-07-19 17:07:22 -0700267 bugreport.cpp \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700268 client/main.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800269 console.cpp \
270 commandline.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800271 file_sync_client.cpp \
Elliott Hughesb708d162015-10-27 16:03:15 -0700272 line_printer.cpp \
273 services.cpp \
David Pursellb9e2e842015-08-31 15:36:18 -0700274 shell_service_protocol.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800275
Dan Albert7fd821e2015-02-24 22:38:21 -0800276LOCAL_CFLAGS += \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700277 $(ADB_COMMON_CFLAGS) \
Dan Albert7fd821e2015-02-24 22:38:21 -0800278 -D_GNU_SOURCE \
279 -DADB_HOST=1 \
280
Dan Willemsen87a419c2015-08-13 14:43:34 -0700281LOCAL_CFLAGS_windows := \
282 $(ADB_COMMON_windows_CFLAGS)
283
Josh Gaob7b1edf2015-11-11 17:56:12 -0800284LOCAL_CFLAGS_linux := \
285 $(ADB_COMMON_linux_CFLAGS) \
286
287LOCAL_CFLAGS_darwin := \
288 $(ADB_COMMON_darwin_CFLAGS) \
289 -Wno-sizeof-pointer-memaccess -Wno-unused-parameter \
290
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800291LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700292LOCAL_MODULE_TAGS := debug
Dan Willemsen87a419c2015-08-13 14:43:34 -0700293LOCAL_MODULE_HOST_OS := darwin linux windows
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800294
Dan Albert9113b472015-07-30 10:25:32 -0700295LOCAL_SANITIZE := $(adb_host_sanitize)
Dan Albert630b9af2014-11-24 23:34:35 -0800296LOCAL_STATIC_LIBRARIES := \
297 libadb \
Elliott Hughes2baae3a2015-04-17 10:59:34 -0700298 libbase \
Josh Gao47763c32016-08-05 15:47:57 -0700299 libcrypto_utils \
300 libcrypto \
Elliott Hughes1b708d32015-12-11 19:07:01 -0800301 libdiagnose_usb \
Casey Dahlin2fe9b602016-09-21 14:03:39 -0700302 liblog \
Elliott Hughes8964fbf2017-05-10 08:41:33 -0700303 libmdnssd \
Dan Albert630b9af2014-11-24 23:34:35 -0800304
Josh Gaoa629e2e2015-11-13 17:55:45 -0800305# Don't use libcutils on Windows.
306LOCAL_STATIC_LIBRARIES_darwin := libcutils
Casey Dahlin2fe9b602016-09-21 14:03:39 -0700307LOCAL_STATIC_LIBRARIES_linux := libcutils
Josh Gaoa629e2e2015-11-13 17:55:45 -0800308
Josh Gao1c70e1b2016-09-28 12:32:45 -0700309LOCAL_STATIC_LIBRARIES_darwin += libusb
310LOCAL_STATIC_LIBRARIES_linux += libusb
311
Dan Willemsen87a419c2015-08-13 14:43:34 -0700312LOCAL_CXX_STL := libc++_static
Colin Cross55bf5f02015-04-16 16:21:44 -0700313
314# Don't add anything here, we don't want additional shared dependencies
315# on the host adb tool, and shared libraries that link against libc++
316# will violate ODR
317LOCAL_SHARED_LIBRARIES :=
318
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800319include $(BUILD_HOST_EXECUTABLE)
320
Ying Wang71edfc82016-02-29 19:27:06 -0800321$(call dist-for-goals,dist_files sdk win_sdk,$(LOCAL_BUILT_MODULE))
322ifdef HOST_CROSS_OS
323# Archive adb.exe for win_sdk build.
324$(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_adb.BUILT))
325endif
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800326
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800327
328# adbd device daemon
329# =========================================================
330
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800331include $(CLEAR_VARS)
332
Elliott Hughes53daee62015-04-19 13:17:01 -0700333LOCAL_CLANG := true
Dan Albert9697ce52015-02-20 17:28:44 -0800334
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800335LOCAL_SRC_FILES := \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700336 daemon/main.cpp \
Casey Dahlin6cd5e0b2016-05-06 16:19:13 -0700337 daemon/mdns.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800338 services.cpp \
339 file_sync_service.cpp \
340 framebuffer_service.cpp \
341 remount_service.cpp \
342 set_verity_enable_state_service.cpp \
David Pursell80f67022015-08-28 15:08:49 -0700343 shell_service.cpp \
David Pursellb9e2e842015-08-31 15:36:18 -0700344 shell_service_protocol.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800345
Christopher Ferris51448eb2014-09-03 19:48:48 -0700346LOCAL_CFLAGS := \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700347 $(ADB_COMMON_CFLAGS) \
Josh Gaob7b1edf2015-11-11 17:56:12 -0800348 $(ADB_COMMON_linux_CFLAGS) \
Dan Albertbac34742015-02-25 17:51:28 -0800349 -DADB_HOST=0 \
350 -D_GNU_SOURCE \
Dan Albertbac34742015-02-25 17:51:28 -0800351 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800352
Bowgo Tsaif1d3dbc2017-07-11 21:47:54 +0800353LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0)
Elliott Hughes5cba5042015-06-17 15:23:42 -0700354LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0)
Nick Kralevich5890fe32012-01-19 13:11:35 -0800355
Elliott Hughesec7a6672015-03-16 21:58:32 +0000356ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000357LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
358endif
359
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800360LOCAL_MODULE := adbd
361
362LOCAL_FORCE_STATIC_EXECUTABLE := true
363LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
364LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
365
Dan Albert9113b472015-07-30 10:25:32 -0700366LOCAL_SANITIZE := $(adb_target_sanitize)
Josh Gao809607a2016-06-15 18:33:11 -0700367LOCAL_STRIP_MODULE := keep_symbols
Dan Albert630b9af2014-11-24 23:34:35 -0800368LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800369 libadbd \
David Zeuthen1e033d62017-04-12 16:07:06 -0400370 libavb_user \
Tao Bao175b7bb2015-03-29 11:22:34 -0700371 libbase \
Tao Bao40e0ec92017-01-05 18:01:01 -0800372 libbootloader_message \
Dan Albert030b76f2015-01-26 17:13:54 -0800373 libfs_mgr \
Sami Tolvanen8ad80762015-10-20 13:24:24 +0100374 libfec \
375 libfec_rs \
William Robertsbd2d9612015-08-04 14:23:04 -0700376 libselinux \
Dan Albert630b9af2014-11-24 23:34:35 -0800377 liblog \
Alex Deymo705353a2017-01-11 14:03:11 -0800378 libext4_utils \
Sami Tolvanen8ad80762015-10-20 13:24:24 +0100379 libsquashfs_utils \
Dan Alberte2462192015-03-19 13:25:27 -0700380 libcutils \
381 libbase \
Josh Gao47763c32016-08-05 15:47:57 -0700382 libcrypto_utils \
383 libcrypto \
Josh Gao809607a2016-06-15 18:33:11 -0700384 libminijail \
Casey Dahlin6cd5e0b2016-05-06 16:19:13 -0700385 libmdnssd \
Josh Gaocbe70cb2016-10-18 18:17:52 -0700386 libdebuggerd_handler \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000387
Jeff Brown29e1e732011-07-11 22:12:32 -0700388include $(BUILD_EXECUTABLE)
Josh Gao44c688c2017-01-11 17:37:35 -0800389
GuangHui Liu41bda342017-05-10 14:37:17 -0700390# adb integration test
391# =========================================================
392$(call dist-for-goals,sdk,$(ALL_MODULES.adb_integration_test_adb.BUILT))
393$(call dist-for-goals,sdk,$(ALL_MODULES.adb_integration_test_device.BUILT))
394
Josh Gao44c688c2017-01-11 17:37:35 -0800395include $(call first-makefiles-under,$(LOCAL_PATH))