The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | # Copyright 2005 The Android Open Source Project |
| 2 | # |
| 3 | # Android.mk for adb |
| 4 | # |
| 5 | |
| 6 | LOCAL_PATH:= $(call my-dir) |
| 7 | |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 8 | ADB_CLANG := |
| 9 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 10 | # 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 Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 19 | LIBADB_SRC_FILES := \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 20 | adb.cpp \ |
| 21 | adb_auth.cpp \ |
Dan Albert | cc731cc | 2015-02-24 21:26:58 -0800 | [diff] [blame] | 22 | adb_io.cpp \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 23 | adb_listeners.cpp \ |
| 24 | sockets.cpp \ |
| 25 | transport.cpp \ |
| 26 | transport_local.cpp \ |
| 27 | transport_usb.cpp \ |
Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 28 | |
Dan Albert | bf10647 | 2015-02-20 17:20:09 -0800 | [diff] [blame] | 29 | LIBADB_CFLAGS := \ |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 30 | -Wall -Werror \ |
| 31 | -Wno-unused-parameter \ |
| 32 | -Wno-missing-field-initializers \ |
Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 33 | -fvisibility=hidden \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 34 | |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 35 | LIBADB_darwin_SRC_FILES := \ |
| 36 | fdevent.cpp \ |
Elliott Hughes | 1a4d85a | 2015-04-16 13:24:58 -0700 | [diff] [blame^] | 37 | get_my_path_darwin.cpp \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 38 | usb_osx.c \ |
| 39 | |
| 40 | LIBADB_linux_SRC_FILES := \ |
| 41 | fdevent.cpp \ |
| 42 | get_my_path_linux.cpp \ |
| 43 | usb_linux.cpp \ |
| 44 | |
| 45 | LIBADB_windows_SRC_FILES := \ |
| 46 | get_my_path_windows.cpp \ |
| 47 | sysdeps_win32.c \ |
| 48 | usb_windows.cpp \ |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 49 | |
| 50 | include $(CLEAR_VARS) |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 51 | LOCAL_CLANG := $(ADB_CLANG) |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 52 | LOCAL_MODULE := libadbd |
| 53 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0 |
Dan Albert | 21c3eaf | 2015-02-18 17:20:44 -0800 | [diff] [blame] | 54 | LOCAL_SRC_FILES := \ |
| 55 | $(LIBADB_SRC_FILES) \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 56 | adb_auth_client.cpp \ |
Dan Albert | 3c43858 | 2015-02-20 17:24:30 -0800 | [diff] [blame] | 57 | fdevent.cpp \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 58 | jdwp_service.cpp \ |
| 59 | qemu_tracing.cpp \ |
Dan Albert | 21c3eaf | 2015-02-18 17:20:44 -0800 | [diff] [blame] | 60 | usb_linux_client.c \ |
| 61 | |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 62 | include $(BUILD_STATIC_LIBRARY) |
| 63 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 64 | include $(CLEAR_VARS) |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 65 | LOCAL_CLANG := $(ADB_CLANG) |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 66 | LOCAL_MODULE := libadb |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 67 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1 |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 68 | LOCAL_SRC_FILES := \ |
| 69 | $(LIBADB_SRC_FILES) \ |
Dan Albert | 3c43858 | 2015-02-20 17:24:30 -0800 | [diff] [blame] | 70 | $(LIBADB_$(HOST_OS)_SRC_FILES) \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 71 | adb_auth_host.cpp \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 72 | |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 73 | # Even though we're building a static library (and thus there's no link step for |
| 74 | # this to take effect), this adds the SSL includes to our path. |
| 75 | LOCAL_STATIC_LIBRARIES := libcrypto_static |
| 76 | |
Dan Albert | 88cf1c8 | 2015-02-24 14:08:03 -0800 | [diff] [blame] | 77 | ifeq ($(HOST_OS),windows) |
| 78 | LOCAL_C_INCLUDES += development/host/windows/usb/api/ |
| 79 | endif |
| 80 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 81 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 82 | |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 83 | LIBADB_TEST_SRCS := \ |
Dan Albert | cc731cc | 2015-02-24 21:26:58 -0800 | [diff] [blame] | 84 | adb_io_test.cpp \ |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 85 | transport_test.cpp \ |
| 86 | |
| 87 | include $(CLEAR_VARS) |
| 88 | LOCAL_CLANG := $(ADB_CLANG) |
| 89 | LOCAL_MODULE := adbd_test |
| 90 | LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS) |
| 91 | LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) |
| 92 | LOCAL_STATIC_LIBRARIES := libadbd |
Dan Albert | c007bc3 | 2015-03-16 10:08:46 -0700 | [diff] [blame] | 93 | LOCAL_SHARED_LIBRARIES := liblog libbase libcutils |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 94 | include $(BUILD_NATIVE_TEST) |
| 95 | |
| 96 | include $(CLEAR_VARS) |
| 97 | LOCAL_CLANG := $(ADB_CLANG) |
| 98 | LOCAL_MODULE := adb_test |
| 99 | LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS) |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 100 | LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp |
Dan Albert | c007bc3 | 2015-03-16 10:08:46 -0700 | [diff] [blame] | 101 | LOCAL_SHARED_LIBRARIES := liblog libbase |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 102 | LOCAL_STATIC_LIBRARIES := \ |
| 103 | libadb \ |
| 104 | libcrypto_static \ |
| 105 | libcutils \ |
| 106 | |
| 107 | ifeq ($(HOST_OS),linux) |
| 108 | LOCAL_LDLIBS += -lrt -ldl -lpthread |
| 109 | endif |
| 110 | |
| 111 | include $(BUILD_HOST_NATIVE_TEST) |
| 112 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 113 | # adb host tool |
| 114 | # ========================================================= |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 115 | include $(CLEAR_VARS) |
| 116 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 117 | ifeq ($(HOST_OS),linux) |
Chih-Wei Huang | 9c60755 | 2013-01-01 15:24:33 +0800 | [diff] [blame] | 118 | LOCAL_LDLIBS += -lrt -ldl -lpthread |
JP Abgrall | 571c136 | 2012-12-06 18:18:12 -0800 | [diff] [blame] | 119 | LOCAL_CFLAGS += -DWORKAROUND_BUG6558362 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 120 | endif |
| 121 | |
| 122 | ifeq ($(HOST_OS),darwin) |
Benoit Goby | 345ca13 | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 123 | LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon |
Tim Murray | 1efcdef | 2014-07-24 18:33:12 -0700 | [diff] [blame] | 124 | LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 125 | endif |
| 126 | |
| 127 | ifeq ($(HOST_OS),windows) |
Benoit Goby | 345ca13 | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 128 | EXTRA_STATIC_LIBS := AdbWinApi |
Raphael | fab1678 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 129 | ifneq ($(strip $(USE_MINGW)),) |
| 130 | # MinGW under Linux case |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 131 | LOCAL_LDLIBS += -lws2_32 -lgdi32 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 132 | USE_SYSDEPS_WIN32 := 1 |
| 133 | endif |
| 134 | endif |
| 135 | |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 136 | LOCAL_CLANG := $(ADB_CLANG) |
| 137 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 138 | LOCAL_SRC_FILES := \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 139 | adb_main.cpp \ |
| 140 | console.cpp \ |
| 141 | commandline.cpp \ |
| 142 | adb_client.cpp \ |
| 143 | services.cpp \ |
| 144 | file_sync_client.cpp \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 145 | |
Dan Albert | 7fd821e | 2015-02-24 22:38:21 -0800 | [diff] [blame] | 146 | LOCAL_CFLAGS += \ |
| 147 | -Wall -Werror \ |
| 148 | -Wno-unused-parameter \ |
| 149 | -D_GNU_SOURCE \ |
| 150 | -DADB_HOST=1 \ |
| 151 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 152 | LOCAL_MODULE := adb |
Kenny Root | d5d6d97 | 2012-09-26 09:58:07 -0700 | [diff] [blame] | 153 | LOCAL_MODULE_TAGS := debug |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 154 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 155 | LOCAL_STATIC_LIBRARIES := \ |
| 156 | libadb \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 157 | libcrypto_static \ |
| 158 | $(EXTRA_STATIC_LIBS) \ |
| 159 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 160 | ifeq ($(USE_SYSDEPS_WIN32),) |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 161 | LOCAL_STATIC_LIBRARIES += libcutils |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 162 | endif |
| 163 | |
| 164 | include $(BUILD_HOST_EXECUTABLE) |
| 165 | |
Ying Wang | 96535ba | 2012-09-05 10:26:43 -0700 | [diff] [blame] | 166 | $(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE)) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 167 | |
| 168 | ifeq ($(HOST_OS),windows) |
Raphael | 26f3de6 | 2009-08-11 11:08:45 -0700 | [diff] [blame] | 169 | $(LOCAL_INSTALLED_MODULE): \ |
| 170 | $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \ |
| 171 | $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 172 | endif |
| 173 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 174 | |
| 175 | # adbd device daemon |
| 176 | # ========================================================= |
| 177 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 178 | include $(CLEAR_VARS) |
| 179 | |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 180 | LOCAL_CLANG := $(ADB_CLANG) |
| 181 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 182 | LOCAL_SRC_FILES := \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 183 | adb_main.cpp \ |
| 184 | services.cpp \ |
| 185 | file_sync_service.cpp \ |
| 186 | framebuffer_service.cpp \ |
| 187 | remount_service.cpp \ |
| 188 | set_verity_enable_state_service.cpp \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 189 | |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 190 | LOCAL_CFLAGS := \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 191 | -DADB_HOST=0 \ |
| 192 | -D_GNU_SOURCE \ |
| 193 | -Wall -Werror \ |
| 194 | -Wno-unused-parameter \ |
| 195 | -Wno-deprecated-declarations \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 196 | |
Nick Kralevich | 5890fe3 | 2012-01-19 13:11:35 -0800 | [diff] [blame] | 197 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
| 198 | LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 |
| 199 | endif |
| 200 | |
Elliott Hughes | ec7a667 | 2015-03-16 21:58:32 +0000 | [diff] [blame] | 201 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 202 | LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 |
| 203 | endif |
| 204 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 205 | LOCAL_MODULE := adbd |
| 206 | |
| 207 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
| 208 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) |
| 209 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) |
Tao Bao | 175b7bb | 2015-03-29 11:22:34 -0700 | [diff] [blame] | 210 | LOCAL_C_INCLUDES += system/extras/ext4_utils |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 211 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 212 | LOCAL_STATIC_LIBRARIES := \ |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 213 | libadbd \ |
Tao Bao | 175b7bb | 2015-03-29 11:22:34 -0700 | [diff] [blame] | 214 | libbase \ |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 215 | libfs_mgr \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 216 | liblog \ |
| 217 | libcutils \ |
| 218 | libc \ |
| 219 | libmincrypt \ |
| 220 | libselinux \ |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 221 | libext4_utils_static \ |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 222 | |
Jeff Brown | 29e1e73 | 2011-07-11 22:12:32 -0700 | [diff] [blame] | 223 | include $(BUILD_EXECUTABLE) |