blob: 0124b261c8ee6139ddbe2238a9dc48721df2730c [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 -Wformat-nonliteral \
Dan Albertc7915a32015-05-18 16:46:31 -070019 -Wno-missing-field-initializers \
Dan Albert459df8f2015-07-08 13:50:42 -070020 -Wno-unused-parameter \
Dan Albert1ba1d7c2015-05-05 17:46:50 -070021 -DADB_REVISION='"$(adb_version)"' \
22
Dan Albert630b9af2014-11-24 23:34:35 -080023# libadb
24# =========================================================
25
26# Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes
27# made to adb rarely get ported to the other two, so the trees have diverged a
28# bit. We'd like to stop this because it is a maintenance nightmare, but the
29# divergence makes this difficult to do all at once. For now, we will start
30# small by moving common files into a static library. Hopefully some day we can
31# get enough of adb in here that we no longer need minadb. https://b/17626262
Dan Albertba3a2512015-02-18 17:47:33 -080032LIBADB_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -080033 adb.cpp \
34 adb_auth.cpp \
Dan Albertcc731cc2015-02-24 21:26:58 -080035 adb_io.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080036 adb_listeners.cpp \
Elliott Hughes58305772015-04-17 13:57:15 -070037 adb_utils.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080038 sockets.cpp \
39 transport.cpp \
40 transport_local.cpp \
41 transport_usb.cpp \
Dan Albertba3a2512015-02-18 17:47:33 -080042
Elliott Hughes53daee62015-04-19 13:17:01 -070043LIBADB_TEST_SRCS := \
44 adb_io_test.cpp \
45 adb_utils_test.cpp \
46 transport_test.cpp \
47
Dan Albertbf106472015-02-20 17:20:09 -080048LIBADB_CFLAGS := \
Dan Albert1ba1d7c2015-05-05 17:46:50 -070049 $(ADB_COMMON_CFLAGS) \
Dan Albertba3a2512015-02-18 17:47:33 -080050 -fvisibility=hidden \
Dan Albert630b9af2014-11-24 23:34:35 -080051
Dan Albertbac34742015-02-25 17:51:28 -080052LIBADB_darwin_SRC_FILES := \
53 fdevent.cpp \
Elliott Hughes1a4d85a2015-04-16 13:24:58 -070054 get_my_path_darwin.cpp \
Dan Albert7447dd02015-04-16 19:20:40 -070055 usb_osx.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080056
57LIBADB_linux_SRC_FILES := \
58 fdevent.cpp \
59 get_my_path_linux.cpp \
60 usb_linux.cpp \
61
62LIBADB_windows_SRC_FILES := \
63 get_my_path_windows.cpp \
Elliott Hughesa2f2e562015-04-16 16:47:02 -070064 sysdeps_win32.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080065 usb_windows.cpp \
Dan Albert94493762014-11-25 11:00:56 -080066
67include $(CLEAR_VARS)
Elliott Hughes2acec912015-04-16 14:12:50 -070068LOCAL_CLANG := true
Dan Albert94493762014-11-25 11:00:56 -080069LOCAL_MODULE := libadbd
70LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
Dan Albert21c3eaf2015-02-18 17:20:44 -080071LOCAL_SRC_FILES := \
72 $(LIBADB_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080073 adb_auth_client.cpp \
Dan Albert3c438582015-02-20 17:24:30 -080074 fdevent.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080075 jdwp_service.cpp \
76 qemu_tracing.cpp \
Elliott Hughes2acec912015-04-16 14:12:50 -070077 usb_linux_client.cpp \
Dan Albert21c3eaf2015-02-18 17:20:44 -080078
Elliott Hughes7b506092015-04-20 08:09:20 -070079LOCAL_SHARED_LIBRARIES := libbase
80
Dan Alberte2462192015-03-19 13:25:27 -070081# Even though we're building a static library (and thus there's no link step for
82# this to take effect), this adds the includes to our path.
83LOCAL_STATIC_LIBRARIES := libbase
84
Dan Albert94493762014-11-25 11:00:56 -080085include $(BUILD_STATIC_LIBRARY)
86
Dan Albert630b9af2014-11-24 23:34:35 -080087include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -070088LOCAL_CLANG := $(adb_host_clang)
Dan Albert630b9af2014-11-24 23:34:35 -080089LOCAL_MODULE := libadb
Dan Albert94493762014-11-25 11:00:56 -080090LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Alberte1ca6232015-02-19 13:19:42 -080091LOCAL_SRC_FILES := \
92 $(LIBADB_SRC_FILES) \
Dan Albert3c438582015-02-20 17:24:30 -080093 $(LIBADB_$(HOST_OS)_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080094 adb_auth_host.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -080095
Elliott Hughes7b506092015-04-20 08:09:20 -070096LOCAL_SHARED_LIBRARIES := libbase
97
Dan Alberte1ca6232015-02-19 13:19:42 -080098# Even though we're building a static library (and thus there's no link step for
Dan Alberte2462192015-03-19 13:25:27 -070099# this to take effect), this adds the includes to our path.
100LOCAL_STATIC_LIBRARIES := libcrypto_static libbase
Dan Alberte1ca6232015-02-19 13:19:42 -0800101
Dan Albert88cf1c82015-02-24 14:08:03 -0800102ifeq ($(HOST_OS),windows)
103 LOCAL_C_INCLUDES += development/host/windows/usb/api/
104endif
105
Dan Albert630b9af2014-11-24 23:34:35 -0800106include $(BUILD_HOST_STATIC_LIBRARY)
107
Dan Albert055f1aa2015-02-20 17:24:58 -0800108include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700109LOCAL_CLANG := true
Dan Albert055f1aa2015-02-20 17:24:58 -0800110LOCAL_MODULE := adbd_test
111LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
112LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
113LOCAL_STATIC_LIBRARIES := libadbd
Dan Albertc007bc32015-03-16 10:08:46 -0700114LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
Dan Albert055f1aa2015-02-20 17:24:58 -0800115include $(BUILD_NATIVE_TEST)
116
Dan Alberta7a67c32015-05-05 14:50:09 -0700117ifneq ($(HOST_OS),windows)
Dan Albert055f1aa2015-02-20 17:24:58 -0800118include $(CLEAR_VARS)
Elliott Hughes53daee62015-04-19 13:17:01 -0700119LOCAL_CLANG := $(adb_host_clang)
Dan Albert055f1aa2015-02-20 17:24:58 -0800120LOCAL_MODULE := adb_test
121LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
Dan Albertbac34742015-02-25 17:51:28 -0800122LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
Dan Albertc007bc32015-03-16 10:08:46 -0700123LOCAL_SHARED_LIBRARIES := liblog libbase
Dan Albert055f1aa2015-02-20 17:24:58 -0800124LOCAL_STATIC_LIBRARIES := \
125 libadb \
126 libcrypto_static \
127 libcutils \
128
129ifeq ($(HOST_OS),linux)
Dan Alberta7a67c32015-05-05 14:50:09 -0700130 LOCAL_LDLIBS += -lrt -ldl -lpthread
Dan Albert055f1aa2015-02-20 17:24:58 -0800131endif
132
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700133ifeq ($(HOST_OS),darwin)
Dan Alberta7a67c32015-05-05 14:50:09 -0700134 LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700135endif
136
Dan Albert055f1aa2015-02-20 17:24:58 -0800137include $(BUILD_HOST_NATIVE_TEST)
Dan Alberta7a67c32015-05-05 14:50:09 -0700138endif
Dan Albert055f1aa2015-02-20 17:24:58 -0800139
Elliott Hughese67f1f82015-04-30 17:32:03 -0700140# adb device tracker (used by ddms) test tool
141# =========================================================
142
143ifeq ($(HOST_OS),linux)
144include $(CLEAR_VARS)
145LOCAL_CLANG := $(adb_host_clang)
146LOCAL_MODULE := adb_device_tracker_test
147LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
148LOCAL_SRC_FILES := test_track_devices.cpp
149LOCAL_SHARED_LIBRARIES := liblog libbase
150LOCAL_STATIC_LIBRARIES := libadb libcrypto_static libcutils
151LOCAL_LDLIBS += -lrt -ldl -lpthread
152include $(BUILD_HOST_EXECUTABLE)
153endif
154
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800155# adb host tool
156# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800157include $(CLEAR_VARS)
158
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800159ifeq ($(HOST_OS),linux)
Spencer Low142ec752015-05-06 16:13:42 -0700160 LOCAL_LDLIBS += -lrt -ldl -lpthread
161 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800162endif
163
164ifeq ($(HOST_OS),darwin)
Spencer Low142ec752015-05-06 16:13:42 -0700165 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
166 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800167endif
168
169ifeq ($(HOST_OS),windows)
Spencer Low142ec752015-05-06 16:13:42 -0700170 LOCAL_LDLIBS += -lws2_32 -lgdi32
171 EXTRA_STATIC_LIBS := AdbWinApi
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800172endif
173
Elliott Hughes53daee62015-04-19 13:17:01 -0700174LOCAL_CLANG := $(adb_host_clang)
Dan Albert9697ce52015-02-20 17:28:44 -0800175
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800176LOCAL_SRC_FILES := \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700177 client/main.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800178 console.cpp \
179 commandline.cpp \
180 adb_client.cpp \
181 services.cpp \
182 file_sync_client.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800183
Dan Albert7fd821e2015-02-24 22:38:21 -0800184LOCAL_CFLAGS += \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700185 $(ADB_COMMON_CFLAGS) \
Dan Albert7fd821e2015-02-24 22:38:21 -0800186 -D_GNU_SOURCE \
187 -DADB_HOST=1 \
188
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800189LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700190LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800191
Dan Albert630b9af2014-11-24 23:34:35 -0800192LOCAL_STATIC_LIBRARIES := \
193 libadb \
Elliott Hughes2baae3a2015-04-17 10:59:34 -0700194 libbase \
Dan Albert630b9af2014-11-24 23:34:35 -0800195 libcrypto_static \
Elliott Hughes53daee62015-04-19 13:17:01 -0700196 libcutils \
Elliott Hughes9309ecb2015-04-27 14:20:17 -0700197 liblog \
Dan Albert630b9af2014-11-24 23:34:35 -0800198 $(EXTRA_STATIC_LIBS) \
199
Colin Crossdc1e4822015-04-20 12:36:50 -0700200# libc++ not available on windows yet
201ifneq ($(HOST_OS),windows)
202 LOCAL_CXX_STL := libc++_static
203endif
Colin Cross55bf5f02015-04-16 16:21:44 -0700204
205# Don't add anything here, we don't want additional shared dependencies
206# on the host adb tool, and shared libraries that link against libc++
207# will violate ODR
208LOCAL_SHARED_LIBRARIES :=
209
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800210include $(BUILD_HOST_EXECUTABLE)
211
Ying Wang96535ba2012-09-05 10:26:43 -0700212$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800213
214ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700215$(LOCAL_INSTALLED_MODULE): \
216 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
217 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800218endif
219
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800220
221# adbd device daemon
222# =========================================================
223
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800224include $(CLEAR_VARS)
225
Elliott Hughes53daee62015-04-19 13:17:01 -0700226LOCAL_CLANG := true
Dan Albert9697ce52015-02-20 17:28:44 -0800227
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800228LOCAL_SRC_FILES := \
Dan Albertc89e0cc2015-05-08 16:13:53 -0700229 daemon/main.cpp \
Dan Albertbac34742015-02-25 17:51:28 -0800230 services.cpp \
231 file_sync_service.cpp \
232 framebuffer_service.cpp \
233 remount_service.cpp \
234 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800235
Christopher Ferris51448eb2014-09-03 19:48:48 -0700236LOCAL_CFLAGS := \
Dan Albert1ba1d7c2015-05-05 17:46:50 -0700237 $(ADB_COMMON_CFLAGS) \
Dan Albertbac34742015-02-25 17:51:28 -0800238 -DADB_HOST=0 \
239 -D_GNU_SOURCE \
Dan Albertbac34742015-02-25 17:51:28 -0800240 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800241
Elliott Hughes5cba5042015-06-17 15:23:42 -0700242LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0)
Nick Kralevich5890fe32012-01-19 13:11:35 -0800243
Elliott Hughesec7a6672015-03-16 21:58:32 +0000244ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000245LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
Elliott Hughes5cba5042015-06-17 15:23:42 -0700246LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000247endif
248
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800249LOCAL_MODULE := adbd
250
251LOCAL_FORCE_STATIC_EXECUTABLE := true
252LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
253LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Tao Bao175b7bb2015-03-29 11:22:34 -0700254LOCAL_C_INCLUDES += system/extras/ext4_utils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800255
Dan Albert630b9af2014-11-24 23:34:35 -0800256LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800257 libadbd \
Tao Bao175b7bb2015-03-29 11:22:34 -0700258 libbase \
Dan Albert030b76f2015-01-26 17:13:54 -0800259 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800260 liblog \
Dan Albert630b9af2014-11-24 23:34:35 -0800261 libmincrypt \
262 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800263 libext4_utils_static \
Dan Alberte2462192015-03-19 13:25:27 -0700264 libcutils \
265 libbase \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000266
Jeff Brown29e1e732011-07-11 22:12:32 -0700267include $(BUILD_EXECUTABLE)