blob: 3b8972e0be0e53b329e26f5bb1e62f56f20a6980 [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
Dan Albert9697ce52015-02-20 17:28:44 -08008ADB_CLANG :=
9
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
Dan Albert94493762014-11-25 11:00:56 -080063include $(BUILD_STATIC_LIBRARY)
64
Dan Albert630b9af2014-11-24 23:34:35 -080065include $(CLEAR_VARS)
Dan Albert9697ce52015-02-20 17:28:44 -080066LOCAL_CLANG := $(ADB_CLANG)
Dan Albert630b9af2014-11-24 23:34:35 -080067LOCAL_MODULE := libadb
Dan Albert94493762014-11-25 11:00:56 -080068LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Alberte1ca6232015-02-19 13:19:42 -080069LOCAL_SRC_FILES := \
70 $(LIBADB_SRC_FILES) \
Dan Albert3c438582015-02-20 17:24:30 -080071 $(LIBADB_$(HOST_OS)_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080072 adb_auth_host.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -080073
Dan Alberte1ca6232015-02-19 13:19:42 -080074# Even though we're building a static library (and thus there's no link step for
75# this to take effect), this adds the SSL includes to our path.
76LOCAL_STATIC_LIBRARIES := libcrypto_static
77
Dan Albert88cf1c82015-02-24 14:08:03 -080078ifeq ($(HOST_OS),windows)
79 LOCAL_C_INCLUDES += development/host/windows/usb/api/
80endif
81
Dan Albert630b9af2014-11-24 23:34:35 -080082include $(BUILD_HOST_STATIC_LIBRARY)
83
Dan Albert055f1aa2015-02-20 17:24:58 -080084LIBADB_TEST_SRCS := \
Dan Albertcc731cc2015-02-24 21:26:58 -080085 adb_io_test.cpp \
Elliott Hughes58305772015-04-17 13:57:15 -070086 adb_utils_test.cpp \
Dan Albert055f1aa2015-02-20 17:24:58 -080087 transport_test.cpp \
88
89include $(CLEAR_VARS)
90LOCAL_CLANG := $(ADB_CLANG)
91LOCAL_MODULE := adbd_test
92LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
93LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
94LOCAL_STATIC_LIBRARIES := libadbd
Dan Albertc007bc32015-03-16 10:08:46 -070095LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
Dan Albert055f1aa2015-02-20 17:24:58 -080096include $(BUILD_NATIVE_TEST)
97
98include $(CLEAR_VARS)
99LOCAL_CLANG := $(ADB_CLANG)
100LOCAL_MODULE := adb_test
101LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
Dan Albertbac34742015-02-25 17:51:28 -0800102LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
Dan Albertc007bc32015-03-16 10:08:46 -0700103LOCAL_SHARED_LIBRARIES := liblog libbase
Dan Albert055f1aa2015-02-20 17:24:58 -0800104LOCAL_STATIC_LIBRARIES := \
105 libadb \
106 libcrypto_static \
107 libcutils \
108
109ifeq ($(HOST_OS),linux)
110 LOCAL_LDLIBS += -lrt -ldl -lpthread
111endif
112
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700113ifeq ($(HOST_OS),darwin)
114 LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
115endif
116
Dan Albert055f1aa2015-02-20 17:24:58 -0800117include $(BUILD_HOST_NATIVE_TEST)
118
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800119# adb host tool
120# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800121include $(CLEAR_VARS)
122
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800123ifeq ($(HOST_OS),linux)
Chih-Wei Huang9c607552013-01-01 15:24:33 +0800124 LOCAL_LDLIBS += -lrt -ldl -lpthread
JP Abgrall571c1362012-12-06 18:18:12 -0800125 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800126endif
127
128ifeq ($(HOST_OS),darwin)
Benoit Goby345ca132012-08-31 17:44:27 -0700129 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
Tim Murray1efcdef2014-07-24 18:33:12 -0700130 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800131endif
132
133ifeq ($(HOST_OS),windows)
Benoit Goby345ca132012-08-31 17:44:27 -0700134 EXTRA_STATIC_LIBS := AdbWinApi
Raphaelfab16782010-04-13 15:25:50 -0700135 ifneq ($(strip $(USE_MINGW)),)
136 # MinGW under Linux case
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700137 LOCAL_LDLIBS += -lws2_32 -lgdi32
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800138 USE_SYSDEPS_WIN32 := 1
139 endif
140endif
141
Dan Albert9697ce52015-02-20 17:28:44 -0800142LOCAL_CLANG := $(ADB_CLANG)
143
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 \
165 $(EXTRA_STATIC_LIBS) \
166
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800167ifeq ($(USE_SYSDEPS_WIN32),)
Dan Albertbac34742015-02-25 17:51:28 -0800168 LOCAL_STATIC_LIBRARIES += libcutils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800169endif
170
171include $(BUILD_HOST_EXECUTABLE)
172
Ying Wang96535ba2012-09-05 10:26:43 -0700173$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800174
175ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700176$(LOCAL_INSTALLED_MODULE): \
177 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
178 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800179endif
180
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800181
182# adbd device daemon
183# =========================================================
184
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800185include $(CLEAR_VARS)
186
Dan Albert9697ce52015-02-20 17:28:44 -0800187LOCAL_CLANG := $(ADB_CLANG)
188
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800189LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800190 adb_main.cpp \
191 services.cpp \
192 file_sync_service.cpp \
193 framebuffer_service.cpp \
194 remount_service.cpp \
195 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800196
Christopher Ferris51448eb2014-09-03 19:48:48 -0700197LOCAL_CFLAGS := \
Dan Albertbac34742015-02-25 17:51:28 -0800198 -DADB_HOST=0 \
199 -D_GNU_SOURCE \
200 -Wall -Werror \
201 -Wno-unused-parameter \
202 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800203
Nick Kralevich5890fe32012-01-19 13:11:35 -0800204ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
205LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
206endif
207
Elliott Hughesec7a6672015-03-16 21:58:32 +0000208ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000209LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
210endif
211
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800212LOCAL_MODULE := adbd
213
214LOCAL_FORCE_STATIC_EXECUTABLE := true
215LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
216LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Tao Bao175b7bb2015-03-29 11:22:34 -0700217LOCAL_C_INCLUDES += system/extras/ext4_utils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800218
Dan Albert630b9af2014-11-24 23:34:35 -0800219LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800220 libadbd \
Tao Bao175b7bb2015-03-29 11:22:34 -0700221 libbase \
Dan Albert030b76f2015-01-26 17:13:54 -0800222 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800223 liblog \
224 libcutils \
225 libc \
226 libmincrypt \
227 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800228 libext4_utils_static \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000229
Jeff Brown29e1e732011-07-11 22:12:32 -0700230include $(BUILD_EXECUTABLE)