blob: 85d1730884b41b37df3b5a2efeb92b9de2fab2e6 [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 Hughes2083fa62015-04-17 15:27:13 -07008ADB_CLANG := true
Dan Albert9697ce52015-02-20 17:28:44 -08009
Dan Albert630b9af2014-11-24 23:34:35 -080010# libadb
11# =========================================================
12
13# Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes
14# made to adb rarely get ported to the other two, so the trees have diverged a
15# bit. We'd like to stop this because it is a maintenance nightmare, but the
16# divergence makes this difficult to do all at once. For now, we will start
17# small by moving common files into a static library. Hopefully some day we can
18# get enough of adb in here that we no longer need minadb. https://b/17626262
Dan Albertba3a2512015-02-18 17:47:33 -080019LIBADB_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -080020 adb.cpp \
21 adb_auth.cpp \
Dan Albertcc731cc2015-02-24 21:26:58 -080022 adb_io.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080023 adb_listeners.cpp \
Elliott Hughes58305772015-04-17 13:57:15 -070024 adb_utils.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080025 sockets.cpp \
26 transport.cpp \
27 transport_local.cpp \
28 transport_usb.cpp \
Dan Albertba3a2512015-02-18 17:47:33 -080029
Dan Albertbf106472015-02-20 17:20:09 -080030LIBADB_CFLAGS := \
Dan Albert055f1aa2015-02-20 17:24:58 -080031 -Wall -Werror \
32 -Wno-unused-parameter \
33 -Wno-missing-field-initializers \
Dan Albertba3a2512015-02-18 17:47:33 -080034 -fvisibility=hidden \
Dan Albert630b9af2014-11-24 23:34:35 -080035
Dan Albertbac34742015-02-25 17:51:28 -080036LIBADB_darwin_SRC_FILES := \
37 fdevent.cpp \
Elliott Hughes1a4d85a2015-04-16 13:24:58 -070038 get_my_path_darwin.cpp \
Dan Albert7447dd02015-04-16 19:20:40 -070039 usb_osx.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080040
41LIBADB_linux_SRC_FILES := \
42 fdevent.cpp \
43 get_my_path_linux.cpp \
44 usb_linux.cpp \
45
46LIBADB_windows_SRC_FILES := \
47 get_my_path_windows.cpp \
Elliott Hughesa2f2e562015-04-16 16:47:02 -070048 sysdeps_win32.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080049 usb_windows.cpp \
Dan Albert94493762014-11-25 11:00:56 -080050
51include $(CLEAR_VARS)
Elliott Hughes2acec912015-04-16 14:12:50 -070052LOCAL_CLANG := true
Dan Albert94493762014-11-25 11:00:56 -080053LOCAL_MODULE := libadbd
54LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
Dan Albert21c3eaf2015-02-18 17:20:44 -080055LOCAL_SRC_FILES := \
56 $(LIBADB_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080057 adb_auth_client.cpp \
Dan Albert3c438582015-02-20 17:24:30 -080058 fdevent.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080059 jdwp_service.cpp \
60 qemu_tracing.cpp \
Elliott Hughes2acec912015-04-16 14:12:50 -070061 usb_linux_client.cpp \
Dan Albert21c3eaf2015-02-18 17:20:44 -080062
Elliott Hughes7b506092015-04-20 08:09:20 -070063LOCAL_SHARED_LIBRARIES := libbase
64
Dan Albert94493762014-11-25 11:00:56 -080065include $(BUILD_STATIC_LIBRARY)
66
Dan Albert630b9af2014-11-24 23:34:35 -080067include $(CLEAR_VARS)
Dan Albert9697ce52015-02-20 17:28:44 -080068LOCAL_CLANG := $(ADB_CLANG)
Dan Albert630b9af2014-11-24 23:34:35 -080069LOCAL_MODULE := libadb
Dan Albert94493762014-11-25 11:00:56 -080070LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Alberte1ca6232015-02-19 13:19:42 -080071LOCAL_SRC_FILES := \
72 $(LIBADB_SRC_FILES) \
Dan Albert3c438582015-02-20 17:24:30 -080073 $(LIBADB_$(HOST_OS)_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080074 adb_auth_host.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -080075
Elliott Hughes7b506092015-04-20 08:09:20 -070076LOCAL_SHARED_LIBRARIES := libbase
77
Dan Alberte1ca6232015-02-19 13:19:42 -080078# Even though we're building a static library (and thus there's no link step for
79# this to take effect), this adds the SSL includes to our path.
80LOCAL_STATIC_LIBRARIES := libcrypto_static
81
Dan Albert88cf1c82015-02-24 14:08:03 -080082ifeq ($(HOST_OS),windows)
83 LOCAL_C_INCLUDES += development/host/windows/usb/api/
84endif
85
Dan Albert630b9af2014-11-24 23:34:35 -080086include $(BUILD_HOST_STATIC_LIBRARY)
87
Dan Albert055f1aa2015-02-20 17:24:58 -080088LIBADB_TEST_SRCS := \
Dan Albertcc731cc2015-02-24 21:26:58 -080089 adb_io_test.cpp \
Elliott Hughes58305772015-04-17 13:57:15 -070090 adb_utils_test.cpp \
Dan Albert055f1aa2015-02-20 17:24:58 -080091 transport_test.cpp \
92
93include $(CLEAR_VARS)
94LOCAL_CLANG := $(ADB_CLANG)
95LOCAL_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)
103LOCAL_CLANG := $(ADB_CLANG)
104LOCAL_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)
Benoit Goby345ca132012-08-31 17:44:27 -0700138 EXTRA_STATIC_LIBS := AdbWinApi
Raphaelfab16782010-04-13 15:25:50 -0700139 ifneq ($(strip $(USE_MINGW)),)
140 # MinGW under Linux case
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700141 LOCAL_LDLIBS += -lws2_32 -lgdi32
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800142 USE_SYSDEPS_WIN32 := 1
143 endif
144endif
145
Dan Albert9697ce52015-02-20 17:28:44 -0800146LOCAL_CLANG := $(ADB_CLANG)
147
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800148LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800149 adb_main.cpp \
150 console.cpp \
151 commandline.cpp \
152 adb_client.cpp \
153 services.cpp \
154 file_sync_client.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800155
Dan Albert7fd821e2015-02-24 22:38:21 -0800156LOCAL_CFLAGS += \
157 -Wall -Werror \
158 -Wno-unused-parameter \
159 -D_GNU_SOURCE \
160 -DADB_HOST=1 \
161
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800162LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700163LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800164
Dan Albert630b9af2014-11-24 23:34:35 -0800165LOCAL_STATIC_LIBRARIES := \
166 libadb \
Elliott Hughes2baae3a2015-04-17 10:59:34 -0700167 libbase \
Dan Albert630b9af2014-11-24 23:34:35 -0800168 libcrypto_static \
169 $(EXTRA_STATIC_LIBS) \
170
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800171ifeq ($(USE_SYSDEPS_WIN32),)
Dan Albertbac34742015-02-25 17:51:28 -0800172 LOCAL_STATIC_LIBRARIES += libcutils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800173endif
174
175include $(BUILD_HOST_EXECUTABLE)
176
Ying Wang96535ba2012-09-05 10:26:43 -0700177$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800178
179ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700180$(LOCAL_INSTALLED_MODULE): \
181 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
182 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800183endif
184
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800185
186# adbd device daemon
187# =========================================================
188
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800189include $(CLEAR_VARS)
190
Dan Albert9697ce52015-02-20 17:28:44 -0800191LOCAL_CLANG := $(ADB_CLANG)
192
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800193LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800194 adb_main.cpp \
195 services.cpp \
196 file_sync_service.cpp \
197 framebuffer_service.cpp \
198 remount_service.cpp \
199 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800200
Christopher Ferris51448eb2014-09-03 19:48:48 -0700201LOCAL_CFLAGS := \
Dan Albertbac34742015-02-25 17:51:28 -0800202 -DADB_HOST=0 \
203 -D_GNU_SOURCE \
204 -Wall -Werror \
205 -Wno-unused-parameter \
206 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800207
Nick Kralevich5890fe32012-01-19 13:11:35 -0800208ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
209LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
210endif
211
Elliott Hughesec7a6672015-03-16 21:58:32 +0000212ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000213LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
214endif
215
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800216LOCAL_MODULE := adbd
217
218LOCAL_FORCE_STATIC_EXECUTABLE := true
219LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
220LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Tao Bao175b7bb2015-03-29 11:22:34 -0700221LOCAL_C_INCLUDES += system/extras/ext4_utils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800222
Dan Albert630b9af2014-11-24 23:34:35 -0800223LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800224 libadbd \
Tao Bao175b7bb2015-03-29 11:22:34 -0700225 libbase \
Dan Albert030b76f2015-01-26 17:13:54 -0800226 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800227 liblog \
228 libcutils \
229 libc \
230 libmincrypt \
231 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800232 libext4_utils_static \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000233
Jeff Brown29e1e732011-07-11 22:12:32 -0700234include $(BUILD_EXECUTABLE)