blob: 7977009e7c0896314e3ce001225b1cb83aaf2d06 [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 := \
Dan Albert23fee8f2015-05-20 18:56:10 -070017 -Wall -Wextra -Werror \
Dan Albert459df8f2015-07-08 13:50:42 -070018 -Wno-unused-parameter \
Dan Albert286bb6d2015-07-09 20:35:09 +000019 -Wno-missing-field-initializers \
Dan Albert1ba1d7c2015-05-05 17:46:50 -070020 -DADB_REVISION='"$(adb_version)"' \
21
Dan Albert630b9af2014-11-24 23:34:35 -080022# libadb
23# =========================================================
24
25# Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes
26# made to adb rarely get ported to the other two, so the trees have diverged a
27# bit. We'd like to stop this because it is a maintenance nightmare, but the
28# divergence makes this difficult to do all at once. For now, we will start
29# small by moving common files into a static library. Hopefully some day we can
30# get enough of adb in here that we no longer need minadb. https://b/17626262
Dan Albertba3a2512015-02-18 17:47:33 -080031LIBADB_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -080032 adb.cpp \
33 adb_auth.cpp \
Dan Albertcc731cc2015-02-24 21:26:58 -080034 adb_io.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080035 adb_listeners.cpp \
Elliott Hughes58305772015-04-17 13:57:15 -070036 adb_utils.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080037 sockets.cpp \
38 transport.cpp \
39 transport_local.cpp \
40 transport_usb.cpp \
Dan Albertba3a2512015-02-18 17:47:33 -080041
Elliott Hughes53daee62015-04-19 13:17:01 -070042LIBADB_TEST_SRCS := \
43 adb_io_test.cpp \
44 adb_utils_test.cpp \
45 transport_test.cpp \
46
Dan Albertbf106472015-02-20 17:20:09 -080047LIBADB_CFLAGS := \
Dan Albert1ba1d7c2015-05-05 17:46:50 -070048 $(ADB_COMMON_CFLAGS) \
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 Alberte2462192015-03-19 13:25:27 -070080# Even though we're building a static library (and thus there's no link step for
81# this to take effect), this adds the includes to our path.
82LOCAL_STATIC_LIBRARIES := libbase
83
Dan Albert94493762014-11-25 11:00:56 -080084include $(BUILD_STATIC_LIBRARY)
85
Dan Albert630b9af2014-11-24 23:34:35 -080086include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -070087LOCAL_CLANG := $(adb_host_clang)
Dan Albert630b9af2014-11-24 23:34:35 -080088LOCAL_MODULE := libadb
Dan Albert94493762014-11-25 11:00:56 -080089LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Alberte1ca6232015-02-19 13:19:42 -080090LOCAL_SRC_FILES := \
91 $(LIBADB_SRC_FILES) \
Dan Albert3c438582015-02-20 17:24:30 -080092 $(LIBADB_$(HOST_OS)_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080093 adb_auth_host.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -080094
Elliott Hughes7b506092015-04-20 08:09:20 -070095LOCAL_SHARED_LIBRARIES := libbase
96
Dan Alberte1ca6232015-02-19 13:19:42 -080097# Even though we're building a static library (and thus there's no link step for
Dan Alberte2462192015-03-19 13:25:27 -070098# this to take effect), this adds the includes to our path.
99LOCAL_STATIC_LIBRARIES := libcrypto_static libbase
Dan Alberte1ca6232015-02-19 13:19:42 -0800100
Dan Albert88cf1c82015-02-24 14:08:03 -0800101ifeq ($(HOST_OS),windows)
102 LOCAL_C_INCLUDES += development/host/windows/usb/api/
103endif
104
Dan Albert630b9af2014-11-24 23:34:35 -0800105include $(BUILD_HOST_STATIC_LIBRARY)
106
Dan Albert055f1aa2015-02-20 17:24:58 -0800107include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700108LOCAL_CLANG := true
Dan Albert055f1aa2015-02-20 17:24:58 -0800109LOCAL_MODULE := adbd_test
110LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
111LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
112LOCAL_STATIC_LIBRARIES := libadbd
Dan Albertc007bc32015-03-16 10:08:46 -0700113LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
Dan Albert055f1aa2015-02-20 17:24:58 -0800114include $(BUILD_NATIVE_TEST)
115
Dan Alberta7a67c32015-05-05 14:50:09 -0700116ifneq ($(HOST_OS),windows)
Dan Albert055f1aa2015-02-20 17:24:58 -0800117include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700118LOCAL_CLANG := $(adb_host_clang)
Dan Albert055f1aa2015-02-20 17:24:58 -0800119LOCAL_MODULE := adb_test
120LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
Dan Albertbac34742015-02-25 17:51:28 -0800121LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
Dan Albertc007bc32015-03-16 10:08:46 -0700122LOCAL_SHARED_LIBRARIES := liblog libbase
Dan Albert055f1aa2015-02-20 17:24:58 -0800123LOCAL_STATIC_LIBRARIES := \
124 libadb \
125 libcrypto_static \
126 libcutils \
127
128ifeq ($(HOST_OS),linux)
Dan Alberta7a67c32015-05-05 14:50:09 -0700129 LOCAL_LDLIBS += -lrt -ldl -lpthread
Dan Albert055f1aa2015-02-20 17:24:58 -0800130endif
131
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700132ifeq ($(HOST_OS),darwin)
Dan Alberta7a67c32015-05-05 14:50:09 -0700133 LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700134endif
135
Dan Albert055f1aa2015-02-20 17:24:58 -0800136include $(BUILD_HOST_NATIVE_TEST)
Dan Alberta7a67c32015-05-05 14:50:09 -0700137endif
Dan Albert055f1aa2015-02-20 17:24:58 -0800138
Elliott Hughese67f1f82015-04-30 17:32:03 -0700139# adb device tracker (used by ddms) test tool
140# =========================================================
141
142ifeq ($(HOST_OS),linux)
143include $(CLEAR_VARS)
144LOCAL_CLANG := $(adb_host_clang)
145LOCAL_MODULE := adb_device_tracker_test
146LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
147LOCAL_SRC_FILES := test_track_devices.cpp
148LOCAL_SHARED_LIBRARIES := liblog libbase
149LOCAL_STATIC_LIBRARIES := libadb libcrypto_static libcutils
150LOCAL_LDLIBS += -lrt -ldl -lpthread
151include $(BUILD_HOST_EXECUTABLE)
152endif
153
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800154# adb host tool
155# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800156include $(CLEAR_VARS)
157
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800158ifeq ($(HOST_OS),linux)
Spencer Low142ec752015-05-06 16:13:42 -0700159 LOCAL_LDLIBS += -lrt -ldl -lpthread
160 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800161endif
162
163ifeq ($(HOST_OS),darwin)
Spencer Low142ec752015-05-06 16:13:42 -0700164 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
165 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800166endif
167
168ifeq ($(HOST_OS),windows)
Spencer Low142ec752015-05-06 16:13:42 -0700169 LOCAL_LDLIBS += -lws2_32 -lgdi32
170 EXTRA_STATIC_LIBS := AdbWinApi
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800171endif
172
Elliott Hughes53daee62015-04-19 13:17:01 -0700173LOCAL_CLANG := $(adb_host_clang)
Dan Albert9697ce52015-02-20 17:28:44 -0800174
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800175LOCAL_SRC_FILES := \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700176 client/main.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800177 console.cpp \
178 commandline.cpp \
179 adb_client.cpp \
180 services.cpp \
181 file_sync_client.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800182
Dan Albert7fd821e2015-02-24 22:38:21 -0800183LOCAL_CFLAGS += \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700184 $(ADB_COMMON_CFLAGS) \
Dan Albert7fd821e2015-02-24 22:38:21 -0800185 -D_GNU_SOURCE \
186 -DADB_HOST=1 \
187
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800188LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700189LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800190
Dan Albert630b9af2014-11-24 23:34:35 -0800191LOCAL_STATIC_LIBRARIES := \
192 libadb \
Elliott Hughes2baae3a2015-04-17 10:59:34 -0700193 libbase \
Dan Albert630b9af2014-11-24 23:34:35 -0800194 libcrypto_static \
Elliott Hughes53daee62015-04-19 13:17:01 -0700195 libcutils \
Elliott Hughes9309ecb2015-04-27 14:20:17 -0700196 liblog \
Dan Albert630b9af2014-11-24 23:34:35 -0800197 $(EXTRA_STATIC_LIBS) \
198
Colin Crossdc1e4822015-04-20 12:36:50 -0700199# libc++ not available on windows yet
200ifneq ($(HOST_OS),windows)
201 LOCAL_CXX_STL := libc++_static
202endif
Colin Cross55bf5f02015-04-16 16:21:44 -0700203
204# Don't add anything here, we don't want additional shared dependencies
205# on the host adb tool, and shared libraries that link against libc++
206# will violate ODR
207LOCAL_SHARED_LIBRARIES :=
208
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800209include $(BUILD_HOST_EXECUTABLE)
210
Ying Wang96535ba2012-09-05 10:26:43 -0700211$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800212
213ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700214$(LOCAL_INSTALLED_MODULE): \
215 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
216 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800217endif
218
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800219
220# adbd device daemon
221# =========================================================
222
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800223include $(CLEAR_VARS)
224
Elliott Hughes53daee62015-04-19 13:17:01 -0700225LOCAL_CLANG := true
Dan Albert9697ce52015-02-20 17:28:44 -0800226
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800227LOCAL_SRC_FILES := \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700228 daemon/main.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800229 services.cpp \
230 file_sync_service.cpp \
231 framebuffer_service.cpp \
232 remount_service.cpp \
233 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800234
Christopher Ferris51448eb2014-09-03 19:48:48 -0700235LOCAL_CFLAGS := \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700236 $(ADB_COMMON_CFLAGS) \
Dan Albertbac34742015-02-25 17:51:28 -0800237 -DADB_HOST=0 \
238 -D_GNU_SOURCE \
Dan Albertbac34742015-02-25 17:51:28 -0800239 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800240
Elliott Hughes5cba5042015-06-17 15:23:42 -0700241LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0)
Nick Kralevich5890fe32012-01-19 13:11:35 -0800242
Elliott Hughesec7a6672015-03-16 21:58:32 +0000243ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000244LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
Elliott Hughes5cba5042015-06-17 15:23:42 -0700245LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000246endif
247
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800248LOCAL_MODULE := adbd
249
250LOCAL_FORCE_STATIC_EXECUTABLE := true
251LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
252LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Tao Bao175b7bb2015-03-29 11:22:34 -0700253LOCAL_C_INCLUDES += system/extras/ext4_utils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800254
Dan Albert630b9af2014-11-24 23:34:35 -0800255LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800256 libadbd \
Tao Bao175b7bb2015-03-29 11:22:34 -0700257 libbase \
Dan Albert030b76f2015-01-26 17:13:54 -0800258 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800259 liblog \
Dan Albert630b9af2014-11-24 23:34:35 -0800260 libmincrypt \
261 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800262 libext4_utils_static \
Dan Alberte2462192015-03-19 13:25:27 -0700263 libcutils \
264 libbase \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000265
Jeff Brown29e1e732011-07-11 22:12:32 -0700266include $(BUILD_EXECUTABLE)