blob: e091ba8be3769ccac4fbea22f13dbb657eb8b07f [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 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
Elliott Hughes7b506092015-04-20 08:09:20 -070072LOCAL_SHARED_LIBRARIES := libbase
73
Dan Albert94493762014-11-25 11:00:56 -080074include $(BUILD_STATIC_LIBRARY)
75
Dan Albert630b9af2014-11-24 23:34:35 -080076include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -070077LOCAL_CLANG := $(adb_host_clang)
Dan Albert630b9af2014-11-24 23:34:35 -080078LOCAL_MODULE := libadb
Dan Albert94493762014-11-25 11:00:56 -080079LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Alberte1ca6232015-02-19 13:19:42 -080080LOCAL_SRC_FILES := \
81 $(LIBADB_SRC_FILES) \
Dan Albert3c438582015-02-20 17:24:30 -080082 $(LIBADB_$(HOST_OS)_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080083 adb_auth_host.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -080084
Elliott Hughes7b506092015-04-20 08:09:20 -070085LOCAL_SHARED_LIBRARIES := libbase
86
Dan Alberte1ca6232015-02-19 13:19:42 -080087# Even though we're building a static library (and thus there's no link step for
88# this to take effect), this adds the SSL includes to our path.
89LOCAL_STATIC_LIBRARIES := libcrypto_static
90
Dan Albert88cf1c82015-02-24 14:08:03 -080091ifeq ($(HOST_OS),windows)
92 LOCAL_C_INCLUDES += development/host/windows/usb/api/
93endif
94
Dan Albert630b9af2014-11-24 23:34:35 -080095include $(BUILD_HOST_STATIC_LIBRARY)
96
Dan Albert055f1aa2015-02-20 17:24:58 -080097include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -070098LOCAL_CLANG := true
Dan Albert055f1aa2015-02-20 17:24:58 -080099LOCAL_MODULE := adbd_test
100LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
101LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
102LOCAL_STATIC_LIBRARIES := libadbd
Dan Albertc007bc32015-03-16 10:08:46 -0700103LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
Dan Albert055f1aa2015-02-20 17:24:58 -0800104include $(BUILD_NATIVE_TEST)
105
Dan Alberta7a67c32015-05-05 14:50:09 -0700106ifneq ($(HOST_OS),windows)
Dan Albert055f1aa2015-02-20 17:24:58 -0800107include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700108LOCAL_CLANG := $(adb_host_clang)
Dan Albert055f1aa2015-02-20 17:24:58 -0800109LOCAL_MODULE := adb_test
110LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
Dan Albertbac34742015-02-25 17:51:28 -0800111LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
Dan Albertc007bc32015-03-16 10:08:46 -0700112LOCAL_SHARED_LIBRARIES := liblog libbase
Dan Albert055f1aa2015-02-20 17:24:58 -0800113LOCAL_STATIC_LIBRARIES := \
114 libadb \
115 libcrypto_static \
116 libcutils \
117
118ifeq ($(HOST_OS),linux)
Dan Alberta7a67c32015-05-05 14:50:09 -0700119 LOCAL_LDLIBS += -lrt -ldl -lpthread
Dan Albert055f1aa2015-02-20 17:24:58 -0800120endif
121
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700122ifeq ($(HOST_OS),darwin)
Dan Alberta7a67c32015-05-05 14:50:09 -0700123 LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700124endif
125
Dan Albert055f1aa2015-02-20 17:24:58 -0800126include $(BUILD_HOST_NATIVE_TEST)
Dan Alberta7a67c32015-05-05 14:50:09 -0700127endif
Dan Albert055f1aa2015-02-20 17:24:58 -0800128
Elliott Hughese67f1f82015-04-30 17:32:03 -0700129# adb device tracker (used by ddms) test tool
130# =========================================================
131
132ifeq ($(HOST_OS),linux)
133include $(CLEAR_VARS)
134LOCAL_CLANG := $(adb_host_clang)
135LOCAL_MODULE := adb_device_tracker_test
136LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
137LOCAL_SRC_FILES := test_track_devices.cpp
138LOCAL_SHARED_LIBRARIES := liblog libbase
139LOCAL_STATIC_LIBRARIES := libadb libcrypto_static libcutils
140LOCAL_LDLIBS += -lrt -ldl -lpthread
141include $(BUILD_HOST_EXECUTABLE)
142endif
143
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800144# adb host tool
145# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800146include $(CLEAR_VARS)
147
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800148ifeq ($(HOST_OS),linux)
Chih-Wei Huang9c607552013-01-01 15:24:33 +0800149 LOCAL_LDLIBS += -lrt -ldl -lpthread
JP Abgrall571c1362012-12-06 18:18:12 -0800150 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800151endif
152
153ifeq ($(HOST_OS),darwin)
Benoit Goby345ca132012-08-31 17:44:27 -0700154 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
Tim Murray1efcdef2014-07-24 18:33:12 -0700155 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800156endif
157
158ifeq ($(HOST_OS),windows)
Elliott Hughes53daee62015-04-19 13:17:01 -0700159 LOCAL_LDLIBS += -lws2_32 -lgdi32
Benoit Goby345ca132012-08-31 17:44:27 -0700160 EXTRA_STATIC_LIBS := AdbWinApi
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800161endif
162
Elliott Hughes53daee62015-04-19 13:17:01 -0700163LOCAL_CLANG := $(adb_host_clang)
Dan Albert9697ce52015-02-20 17:28:44 -0800164
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800165LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800166 adb_main.cpp \
167 console.cpp \
168 commandline.cpp \
169 adb_client.cpp \
170 services.cpp \
171 file_sync_client.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800172
Dan Albert7fd821e2015-02-24 22:38:21 -0800173LOCAL_CFLAGS += \
174 -Wall -Werror \
175 -Wno-unused-parameter \
176 -D_GNU_SOURCE \
177 -DADB_HOST=1 \
178
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800179LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700180LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800181
Dan Albert630b9af2014-11-24 23:34:35 -0800182LOCAL_STATIC_LIBRARIES := \
183 libadb \
Elliott Hughes2baae3a2015-04-17 10:59:34 -0700184 libbase \
Dan Albert630b9af2014-11-24 23:34:35 -0800185 libcrypto_static \
Elliott Hughes53daee62015-04-19 13:17:01 -0700186 libcutils \
Elliott Hughes9309ecb2015-04-27 14:20:17 -0700187 liblog \
Dan Albert630b9af2014-11-24 23:34:35 -0800188 $(EXTRA_STATIC_LIBS) \
189
Colin Crossdc1e4822015-04-20 12:36:50 -0700190# libc++ not available on windows yet
191ifneq ($(HOST_OS),windows)
192 LOCAL_CXX_STL := libc++_static
193endif
Colin Cross55bf5f02015-04-16 16:21:44 -0700194
195# Don't add anything here, we don't want additional shared dependencies
196# on the host adb tool, and shared libraries that link against libc++
197# will violate ODR
198LOCAL_SHARED_LIBRARIES :=
199
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800200include $(BUILD_HOST_EXECUTABLE)
201
Ying Wang96535ba2012-09-05 10:26:43 -0700202$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800203
204ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700205$(LOCAL_INSTALLED_MODULE): \
206 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
207 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800208endif
209
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800210
211# adbd device daemon
212# =========================================================
213
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800214include $(CLEAR_VARS)
215
Elliott Hughes53daee62015-04-19 13:17:01 -0700216LOCAL_CLANG := true
Dan Albert9697ce52015-02-20 17:28:44 -0800217
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800218LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800219 adb_main.cpp \
220 services.cpp \
221 file_sync_service.cpp \
222 framebuffer_service.cpp \
223 remount_service.cpp \
224 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800225
Christopher Ferris51448eb2014-09-03 19:48:48 -0700226LOCAL_CFLAGS := \
Dan Albertbac34742015-02-25 17:51:28 -0800227 -DADB_HOST=0 \
228 -D_GNU_SOURCE \
229 -Wall -Werror \
230 -Wno-unused-parameter \
231 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800232
Nick Kralevich5890fe32012-01-19 13:11:35 -0800233ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
234LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
235endif
236
Elliott Hughesec7a6672015-03-16 21:58:32 +0000237ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000238LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
239endif
240
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800241LOCAL_MODULE := adbd
242
243LOCAL_FORCE_STATIC_EXECUTABLE := true
244LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
245LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Tao Bao175b7bb2015-03-29 11:22:34 -0700246LOCAL_C_INCLUDES += system/extras/ext4_utils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800247
Dan Albert630b9af2014-11-24 23:34:35 -0800248LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800249 libadbd \
Tao Bao175b7bb2015-03-29 11:22:34 -0700250 libbase \
Dan Albert030b76f2015-01-26 17:13:54 -0800251 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800252 liblog \
253 libcutils \
254 libc \
255 libmincrypt \
256 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800257 libext4_utils_static \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000258
Jeff Brown29e1e732011-07-11 22:12:32 -0700259include $(BUILD_EXECUTABLE)