blob: 355bb7f38a33cfabddf8e52c70bd789d3499c388 [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 \
Elliott Hughes4f1d7b52015-07-24 14:32:46 -070050
51LIBADB_linux_CFLAGS := \
Elliott Hughes812f0302015-07-23 15:20:09 -070052 -std=c++14 \
Dan Albert630b9af2014-11-24 23:34:35 -080053
Elliott Hughes4f1d7b52015-07-24 14:32:46 -070054LIBADB_CFLAGS += $(LIBADB_$(HOST_OS)_CFLAGS)
55
Dan Albertbac34742015-02-25 17:51:28 -080056LIBADB_darwin_SRC_FILES := \
57 fdevent.cpp \
Elliott Hughes1a4d85a2015-04-16 13:24:58 -070058 get_my_path_darwin.cpp \
Dan Albert7447dd02015-04-16 19:20:40 -070059 usb_osx.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080060
61LIBADB_linux_SRC_FILES := \
62 fdevent.cpp \
63 get_my_path_linux.cpp \
64 usb_linux.cpp \
65
66LIBADB_windows_SRC_FILES := \
67 get_my_path_windows.cpp \
Elliott Hughesa2f2e562015-04-16 16:47:02 -070068 sysdeps_win32.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080069 usb_windows.cpp \
Dan Albert94493762014-11-25 11:00:56 -080070
71include $(CLEAR_VARS)
Elliott Hughes2acec912015-04-16 14:12:50 -070072LOCAL_CLANG := true
Dan Albert94493762014-11-25 11:00:56 -080073LOCAL_MODULE := libadbd
74LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
Dan Albert21c3eaf2015-02-18 17:20:44 -080075LOCAL_SRC_FILES := \
76 $(LIBADB_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080077 adb_auth_client.cpp \
Dan Albert3c438582015-02-20 17:24:30 -080078 fdevent.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080079 jdwp_service.cpp \
80 qemu_tracing.cpp \
Elliott Hughes2acec912015-04-16 14:12:50 -070081 usb_linux_client.cpp \
Dan Albert21c3eaf2015-02-18 17:20:44 -080082
Elliott Hughes7b506092015-04-20 08:09:20 -070083LOCAL_SHARED_LIBRARIES := libbase
84
Dan Alberte2462192015-03-19 13:25:27 -070085# Even though we're building a static library (and thus there's no link step for
86# this to take effect), this adds the includes to our path.
87LOCAL_STATIC_LIBRARIES := libbase
88
Dan Albert94493762014-11-25 11:00:56 -080089include $(BUILD_STATIC_LIBRARY)
90
Dan Albert630b9af2014-11-24 23:34:35 -080091include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -070092LOCAL_CLANG := $(adb_host_clang)
Dan Albert630b9af2014-11-24 23:34:35 -080093LOCAL_MODULE := libadb
Dan Albert94493762014-11-25 11:00:56 -080094LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Alberte1ca6232015-02-19 13:19:42 -080095LOCAL_SRC_FILES := \
96 $(LIBADB_SRC_FILES) \
Dan Albert3c438582015-02-20 17:24:30 -080097 $(LIBADB_$(HOST_OS)_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080098 adb_auth_host.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -080099
Elliott Hughes7b506092015-04-20 08:09:20 -0700100LOCAL_SHARED_LIBRARIES := libbase
101
Dan Alberte1ca6232015-02-19 13:19:42 -0800102# Even though we're building a static library (and thus there's no link step for
Dan Alberte2462192015-03-19 13:25:27 -0700103# this to take effect), this adds the includes to our path.
104LOCAL_STATIC_LIBRARIES := libcrypto_static libbase
Dan Alberte1ca6232015-02-19 13:19:42 -0800105
Dan Albert88cf1c82015-02-24 14:08:03 -0800106ifeq ($(HOST_OS),windows)
107 LOCAL_C_INCLUDES += development/host/windows/usb/api/
108endif
109
Dan Albert630b9af2014-11-24 23:34:35 -0800110include $(BUILD_HOST_STATIC_LIBRARY)
111
Dan Albert055f1aa2015-02-20 17:24:58 -0800112include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700113LOCAL_CLANG := true
Dan Albert055f1aa2015-02-20 17:24:58 -0800114LOCAL_MODULE := adbd_test
115LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
116LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
117LOCAL_STATIC_LIBRARIES := libadbd
Dan Albertc007bc32015-03-16 10:08:46 -0700118LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
Dan Albert055f1aa2015-02-20 17:24:58 -0800119include $(BUILD_NATIVE_TEST)
120
Dan Alberta7a67c32015-05-05 14:50:09 -0700121ifneq ($(HOST_OS),windows)
Dan Albert055f1aa2015-02-20 17:24:58 -0800122include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700123LOCAL_CLANG := $(adb_host_clang)
Dan Albert055f1aa2015-02-20 17:24:58 -0800124LOCAL_MODULE := adb_test
125LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
Dan Albertbac34742015-02-25 17:51:28 -0800126LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
Dan Albertc007bc32015-03-16 10:08:46 -0700127LOCAL_SHARED_LIBRARIES := liblog libbase
Dan Albert055f1aa2015-02-20 17:24:58 -0800128LOCAL_STATIC_LIBRARIES := \
129 libadb \
130 libcrypto_static \
131 libcutils \
132
133ifeq ($(HOST_OS),linux)
Dan Alberta7a67c32015-05-05 14:50:09 -0700134 LOCAL_LDLIBS += -lrt -ldl -lpthread
Dan Albert055f1aa2015-02-20 17:24:58 -0800135endif
136
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700137ifeq ($(HOST_OS),darwin)
Dan Alberta7a67c32015-05-05 14:50:09 -0700138 LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700139endif
140
Dan Albert055f1aa2015-02-20 17:24:58 -0800141include $(BUILD_HOST_NATIVE_TEST)
Dan Alberta7a67c32015-05-05 14:50:09 -0700142endif
Dan Albert055f1aa2015-02-20 17:24:58 -0800143
Elliott Hughese67f1f82015-04-30 17:32:03 -0700144# adb device tracker (used by ddms) test tool
145# =========================================================
146
147ifeq ($(HOST_OS),linux)
148include $(CLEAR_VARS)
149LOCAL_CLANG := $(adb_host_clang)
150LOCAL_MODULE := adb_device_tracker_test
151LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
152LOCAL_SRC_FILES := test_track_devices.cpp
153LOCAL_SHARED_LIBRARIES := liblog libbase
154LOCAL_STATIC_LIBRARIES := libadb libcrypto_static libcutils
155LOCAL_LDLIBS += -lrt -ldl -lpthread
156include $(BUILD_HOST_EXECUTABLE)
157endif
158
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800159# adb host tool
160# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800161include $(CLEAR_VARS)
162
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800163ifeq ($(HOST_OS),linux)
Spencer Low142ec752015-05-06 16:13:42 -0700164 LOCAL_LDLIBS += -lrt -ldl -lpthread
165 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800166endif
167
168ifeq ($(HOST_OS),darwin)
Spencer Low142ec752015-05-06 16:13:42 -0700169 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
170 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800171endif
172
173ifeq ($(HOST_OS),windows)
Spencer Low142ec752015-05-06 16:13:42 -0700174 LOCAL_LDLIBS += -lws2_32 -lgdi32
175 EXTRA_STATIC_LIBS := AdbWinApi
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800176endif
177
Elliott Hughes53daee62015-04-19 13:17:01 -0700178LOCAL_CLANG := $(adb_host_clang)
Dan Albert9697ce52015-02-20 17:28:44 -0800179
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800180LOCAL_SRC_FILES := \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700181 client/main.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800182 console.cpp \
183 commandline.cpp \
184 adb_client.cpp \
185 services.cpp \
186 file_sync_client.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800187
Dan Albert7fd821e2015-02-24 22:38:21 -0800188LOCAL_CFLAGS += \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700189 $(ADB_COMMON_CFLAGS) \
Dan Albert7fd821e2015-02-24 22:38:21 -0800190 -D_GNU_SOURCE \
191 -DADB_HOST=1 \
192
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800193LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700194LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800195
Dan Albert630b9af2014-11-24 23:34:35 -0800196LOCAL_STATIC_LIBRARIES := \
197 libadb \
Elliott Hughes2baae3a2015-04-17 10:59:34 -0700198 libbase \
Dan Albert630b9af2014-11-24 23:34:35 -0800199 libcrypto_static \
Elliott Hughes53daee62015-04-19 13:17:01 -0700200 libcutils \
Elliott Hughes9309ecb2015-04-27 14:20:17 -0700201 liblog \
Dan Albert630b9af2014-11-24 23:34:35 -0800202 $(EXTRA_STATIC_LIBS) \
203
Colin Crossdc1e4822015-04-20 12:36:50 -0700204# libc++ not available on windows yet
205ifneq ($(HOST_OS),windows)
206 LOCAL_CXX_STL := libc++_static
207endif
Colin Cross55bf5f02015-04-16 16:21:44 -0700208
209# Don't add anything here, we don't want additional shared dependencies
210# on the host adb tool, and shared libraries that link against libc++
211# will violate ODR
212LOCAL_SHARED_LIBRARIES :=
213
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800214include $(BUILD_HOST_EXECUTABLE)
215
Ying Wang96535ba2012-09-05 10:26:43 -0700216$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800217
218ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700219$(LOCAL_INSTALLED_MODULE): \
220 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
221 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800222endif
223
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800224
225# adbd device daemon
226# =========================================================
227
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800228include $(CLEAR_VARS)
229
Elliott Hughes53daee62015-04-19 13:17:01 -0700230LOCAL_CLANG := true
Dan Albert9697ce52015-02-20 17:28:44 -0800231
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800232LOCAL_SRC_FILES := \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700233 daemon/main.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800234 services.cpp \
235 file_sync_service.cpp \
236 framebuffer_service.cpp \
237 remount_service.cpp \
238 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800239
Christopher Ferris51448eb2014-09-03 19:48:48 -0700240LOCAL_CFLAGS := \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700241 $(ADB_COMMON_CFLAGS) \
Dan Albertbac34742015-02-25 17:51:28 -0800242 -DADB_HOST=0 \
243 -D_GNU_SOURCE \
Dan Albertbac34742015-02-25 17:51:28 -0800244 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800245
Elliott Hughes5cba5042015-06-17 15:23:42 -0700246LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0)
Nick Kralevich5890fe32012-01-19 13:11:35 -0800247
Elliott Hughesec7a6672015-03-16 21:58:32 +0000248ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000249LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
Elliott Hughes5cba5042015-06-17 15:23:42 -0700250LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000251endif
252
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800253LOCAL_MODULE := adbd
254
255LOCAL_FORCE_STATIC_EXECUTABLE := true
256LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
257LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Tao Bao175b7bb2015-03-29 11:22:34 -0700258LOCAL_C_INCLUDES += system/extras/ext4_utils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800259
Dan Albert630b9af2014-11-24 23:34:35 -0800260LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800261 libadbd \
Tao Bao175b7bb2015-03-29 11:22:34 -0700262 libbase \
Dan Albert030b76f2015-01-26 17:13:54 -0800263 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800264 liblog \
Dan Albert630b9af2014-11-24 23:34:35 -0800265 libmincrypt \
266 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800267 libext4_utils_static \
Dan Alberte2462192015-03-19 13:25:27 -0700268 libcutils \
269 libbase \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000270
Jeff Brown29e1e732011-07-11 22:12:32 -0700271include $(BUILD_EXECUTABLE)