blob: f0117d3bba92bc81deba973b96a1022487b2e93d [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)
9 adb_host_clang := false # libc++ for mingw not ready yet.
10else
11 adb_host_clang := true
12endif
Dan Albert9697ce52015-02-20 17:28:44 -080013
Dan Albert630b9af2014-11-24 23:34:35 -080014# libadb
15# =========================================================
16
17# Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes
18# made to adb rarely get ported to the other two, so the trees have diverged a
19# bit. We'd like to stop this because it is a maintenance nightmare, but the
20# divergence makes this difficult to do all at once. For now, we will start
21# small by moving common files into a static library. Hopefully some day we can
22# get enough of adb in here that we no longer need minadb. https://b/17626262
Dan Albertba3a2512015-02-18 17:47:33 -080023LIBADB_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -080024 adb.cpp \
25 adb_auth.cpp \
Dan Albertcc731cc2015-02-24 21:26:58 -080026 adb_io.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080027 adb_listeners.cpp \
Elliott Hughes58305772015-04-17 13:57:15 -070028 adb_utils.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080029 sockets.cpp \
30 transport.cpp \
31 transport_local.cpp \
32 transport_usb.cpp \
Dan Albertba3a2512015-02-18 17:47:33 -080033
Elliott Hughes53daee62015-04-19 13:17:01 -070034LIBADB_TEST_SRCS := \
35 adb_io_test.cpp \
36 adb_utils_test.cpp \
37 transport_test.cpp \
38
Dan Albertbf106472015-02-20 17:20:09 -080039LIBADB_CFLAGS := \
Dan Albert055f1aa2015-02-20 17:24:58 -080040 -Wall -Werror \
41 -Wno-unused-parameter \
42 -Wno-missing-field-initializers \
Dan Albertba3a2512015-02-18 17:47:33 -080043 -fvisibility=hidden \
Dan Albert630b9af2014-11-24 23:34:35 -080044
Dan Albertbac34742015-02-25 17:51:28 -080045LIBADB_darwin_SRC_FILES := \
46 fdevent.cpp \
Elliott Hughes1a4d85a2015-04-16 13:24:58 -070047 get_my_path_darwin.cpp \
Dan Albert7447dd02015-04-16 19:20:40 -070048 usb_osx.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080049
50LIBADB_linux_SRC_FILES := \
51 fdevent.cpp \
52 get_my_path_linux.cpp \
53 usb_linux.cpp \
54
55LIBADB_windows_SRC_FILES := \
56 get_my_path_windows.cpp \
Elliott Hughesa2f2e562015-04-16 16:47:02 -070057 sysdeps_win32.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080058 usb_windows.cpp \
Dan Albert94493762014-11-25 11:00:56 -080059
60include $(CLEAR_VARS)
Elliott Hughes2acec912015-04-16 14:12:50 -070061LOCAL_CLANG := true
Dan Albert94493762014-11-25 11:00:56 -080062LOCAL_MODULE := libadbd
63LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
Dan Albert21c3eaf2015-02-18 17:20:44 -080064LOCAL_SRC_FILES := \
65 $(LIBADB_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080066 adb_auth_client.cpp \
Dan Albert3c438582015-02-20 17:24:30 -080067 fdevent.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080068 jdwp_service.cpp \
69 qemu_tracing.cpp \
Elliott Hughes2acec912015-04-16 14:12:50 -070070 usb_linux_client.cpp \
Dan Albert21c3eaf2015-02-18 17:20:44 -080071
Dan Albert94493762014-11-25 11:00:56 -080072include $(BUILD_STATIC_LIBRARY)
73
Dan Albert630b9af2014-11-24 23:34:35 -080074include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -070075LOCAL_CLANG := $(adb_host_clang)
Dan Albert630b9af2014-11-24 23:34:35 -080076LOCAL_MODULE := libadb
Dan Albert94493762014-11-25 11:00:56 -080077LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Alberte1ca6232015-02-19 13:19:42 -080078LOCAL_SRC_FILES := \
79 $(LIBADB_SRC_FILES) \
Dan Albert3c438582015-02-20 17:24:30 -080080 $(LIBADB_$(HOST_OS)_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080081 adb_auth_host.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -080082
Dan Alberte1ca6232015-02-19 13:19:42 -080083# Even though we're building a static library (and thus there's no link step for
84# this to take effect), this adds the SSL includes to our path.
85LOCAL_STATIC_LIBRARIES := libcrypto_static
86
Dan Albert88cf1c82015-02-24 14:08:03 -080087ifeq ($(HOST_OS),windows)
88 LOCAL_C_INCLUDES += development/host/windows/usb/api/
89endif
90
Dan Albert630b9af2014-11-24 23:34:35 -080091include $(BUILD_HOST_STATIC_LIBRARY)
92
Dan Albert055f1aa2015-02-20 17:24:58 -080093include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -070094LOCAL_CLANG := true
Dan Albert055f1aa2015-02-20 17:24:58 -080095LOCAL_MODULE := adbd_test
96LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
97LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
98LOCAL_STATIC_LIBRARIES := libadbd
Dan Albertc007bc32015-03-16 10:08:46 -070099LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
Dan Albert055f1aa2015-02-20 17:24:58 -0800100include $(BUILD_NATIVE_TEST)
101
102include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700103LOCAL_CLANG := $(adb_host_clang)
Dan Albert055f1aa2015-02-20 17:24:58 -0800104LOCAL_MODULE := adb_test
105LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
Dan Albertbac34742015-02-25 17:51:28 -0800106LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
Dan Albertc007bc32015-03-16 10:08:46 -0700107LOCAL_SHARED_LIBRARIES := liblog libbase
Dan Albert055f1aa2015-02-20 17:24:58 -0800108LOCAL_STATIC_LIBRARIES := \
109 libadb \
110 libcrypto_static \
111 libcutils \
112
113ifeq ($(HOST_OS),linux)
114 LOCAL_LDLIBS += -lrt -ldl -lpthread
115endif
116
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700117ifeq ($(HOST_OS),darwin)
118 LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
119endif
120
Dan Albert055f1aa2015-02-20 17:24:58 -0800121include $(BUILD_HOST_NATIVE_TEST)
122
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800123# adb host tool
124# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800125include $(CLEAR_VARS)
126
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800127ifeq ($(HOST_OS),linux)
Chih-Wei Huang9c607552013-01-01 15:24:33 +0800128 LOCAL_LDLIBS += -lrt -ldl -lpthread
JP Abgrall571c1362012-12-06 18:18:12 -0800129 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800130endif
131
132ifeq ($(HOST_OS),darwin)
Benoit Goby345ca132012-08-31 17:44:27 -0700133 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
Tim Murray1efcdef2014-07-24 18:33:12 -0700134 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800135endif
136
137ifeq ($(HOST_OS),windows)
Elliott Hughes53daee62015-04-19 13:17:01 -0700138 LOCAL_LDLIBS += -lws2_32 -lgdi32
Benoit Goby345ca132012-08-31 17:44:27 -0700139 EXTRA_STATIC_LIBS := AdbWinApi
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800140endif
141
Elliott Hughes53daee62015-04-19 13:17:01 -0700142LOCAL_CLANG := $(adb_host_clang)
Dan Albert9697ce52015-02-20 17:28:44 -0800143
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800144LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800145 adb_main.cpp \
146 console.cpp \
147 commandline.cpp \
148 adb_client.cpp \
149 services.cpp \
150 file_sync_client.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800151
Dan Albert7fd821e2015-02-24 22:38:21 -0800152LOCAL_CFLAGS += \
153 -Wall -Werror \
154 -Wno-unused-parameter \
155 -D_GNU_SOURCE \
156 -DADB_HOST=1 \
157
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800158LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700159LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800160
Dan Albert630b9af2014-11-24 23:34:35 -0800161LOCAL_STATIC_LIBRARIES := \
162 libadb \
Elliott Hughes2baae3a2015-04-17 10:59:34 -0700163 libbase \
Dan Albert630b9af2014-11-24 23:34:35 -0800164 libcrypto_static \
Elliott Hughes53daee62015-04-19 13:17:01 -0700165 libcutils \
Dan Albert630b9af2014-11-24 23:34:35 -0800166 $(EXTRA_STATIC_LIBS) \
167
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800168include $(BUILD_HOST_EXECUTABLE)
169
Ying Wang96535ba2012-09-05 10:26:43 -0700170$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800171
172ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700173$(LOCAL_INSTALLED_MODULE): \
174 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
175 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800176endif
177
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800178
179# adbd device daemon
180# =========================================================
181
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800182include $(CLEAR_VARS)
183
Elliott Hughes53daee62015-04-19 13:17:01 -0700184LOCAL_CLANG := true
Dan Albert9697ce52015-02-20 17:28:44 -0800185
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800186LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800187 adb_main.cpp \
188 services.cpp \
189 file_sync_service.cpp \
190 framebuffer_service.cpp \
191 remount_service.cpp \
192 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800193
Christopher Ferris51448eb2014-09-03 19:48:48 -0700194LOCAL_CFLAGS := \
Dan Albertbac34742015-02-25 17:51:28 -0800195 -DADB_HOST=0 \
196 -D_GNU_SOURCE \
197 -Wall -Werror \
198 -Wno-unused-parameter \
199 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800200
Nick Kralevich5890fe32012-01-19 13:11:35 -0800201ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
202LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
203endif
204
Elliott Hughesec7a6672015-03-16 21:58:32 +0000205ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000206LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
207endif
208
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800209LOCAL_MODULE := adbd
210
211LOCAL_FORCE_STATIC_EXECUTABLE := true
212LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
213LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Tao Bao175b7bb2015-03-29 11:22:34 -0700214LOCAL_C_INCLUDES += system/extras/ext4_utils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800215
Dan Albert630b9af2014-11-24 23:34:35 -0800216LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800217 libadbd \
Tao Bao175b7bb2015-03-29 11:22:34 -0700218 libbase \
Dan Albert030b76f2015-01-26 17:13:54 -0800219 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800220 liblog \
221 libcutils \
222 libc \
223 libmincrypt \
224 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800225 libext4_utils_static \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000226
Jeff Brown29e1e732011-07-11 22:12:32 -0700227include $(BUILD_EXECUTABLE)