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 | |
Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 8 | ifeq ($(HOST_OS),windows) |
| 9 | adb_host_clang := false # libc++ for mingw not ready yet. |
| 10 | else |
| 11 | adb_host_clang := true |
| 12 | endif |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 13 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 14 | # 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 Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 23 | LIBADB_SRC_FILES := \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 24 | adb.cpp \ |
| 25 | adb_auth.cpp \ |
Dan Albert | cc731cc | 2015-02-24 21:26:58 -0800 | [diff] [blame] | 26 | adb_io.cpp \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 27 | adb_listeners.cpp \ |
Elliott Hughes | 5830577 | 2015-04-17 13:57:15 -0700 | [diff] [blame] | 28 | adb_utils.cpp \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 29 | sockets.cpp \ |
| 30 | transport.cpp \ |
| 31 | transport_local.cpp \ |
| 32 | transport_usb.cpp \ |
Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 33 | |
Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 34 | LIBADB_TEST_SRCS := \ |
| 35 | adb_io_test.cpp \ |
| 36 | adb_utils_test.cpp \ |
| 37 | transport_test.cpp \ |
| 38 | |
Dan Albert | bf10647 | 2015-02-20 17:20:09 -0800 | [diff] [blame] | 39 | LIBADB_CFLAGS := \ |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 40 | -Wall -Werror \ |
| 41 | -Wno-unused-parameter \ |
| 42 | -Wno-missing-field-initializers \ |
Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 43 | -fvisibility=hidden \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 44 | |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 45 | LIBADB_darwin_SRC_FILES := \ |
| 46 | fdevent.cpp \ |
Elliott Hughes | 1a4d85a | 2015-04-16 13:24:58 -0700 | [diff] [blame] | 47 | get_my_path_darwin.cpp \ |
Dan Albert | 7447dd0 | 2015-04-16 19:20:40 -0700 | [diff] [blame] | 48 | usb_osx.cpp \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 49 | |
| 50 | LIBADB_linux_SRC_FILES := \ |
| 51 | fdevent.cpp \ |
| 52 | get_my_path_linux.cpp \ |
| 53 | usb_linux.cpp \ |
| 54 | |
| 55 | LIBADB_windows_SRC_FILES := \ |
| 56 | get_my_path_windows.cpp \ |
Elliott Hughes | a2f2e56 | 2015-04-16 16:47:02 -0700 | [diff] [blame] | 57 | sysdeps_win32.cpp \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 58 | usb_windows.cpp \ |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 59 | |
| 60 | include $(CLEAR_VARS) |
Elliott Hughes | 2acec91 | 2015-04-16 14:12:50 -0700 | [diff] [blame] | 61 | LOCAL_CLANG := true |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 62 | LOCAL_MODULE := libadbd |
| 63 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0 |
Dan Albert | 21c3eaf | 2015-02-18 17:20:44 -0800 | [diff] [blame] | 64 | LOCAL_SRC_FILES := \ |
| 65 | $(LIBADB_SRC_FILES) \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 66 | adb_auth_client.cpp \ |
Dan Albert | 3c43858 | 2015-02-20 17:24:30 -0800 | [diff] [blame] | 67 | fdevent.cpp \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 68 | jdwp_service.cpp \ |
| 69 | qemu_tracing.cpp \ |
Elliott Hughes | 2acec91 | 2015-04-16 14:12:50 -0700 | [diff] [blame] | 70 | usb_linux_client.cpp \ |
Dan Albert | 21c3eaf | 2015-02-18 17:20:44 -0800 | [diff] [blame] | 71 | |
Elliott Hughes | 7b50609 | 2015-04-20 08:09:20 -0700 | [diff] [blame] | 72 | LOCAL_SHARED_LIBRARIES := libbase |
| 73 | |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 74 | include $(BUILD_STATIC_LIBRARY) |
| 75 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 76 | include $(CLEAR_VARS) |
Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 77 | LOCAL_CLANG := $(adb_host_clang) |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 78 | LOCAL_MODULE := libadb |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 79 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1 |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 80 | LOCAL_SRC_FILES := \ |
| 81 | $(LIBADB_SRC_FILES) \ |
Dan Albert | 3c43858 | 2015-02-20 17:24:30 -0800 | [diff] [blame] | 82 | $(LIBADB_$(HOST_OS)_SRC_FILES) \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 83 | adb_auth_host.cpp \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 84 | |
Elliott Hughes | 7b50609 | 2015-04-20 08:09:20 -0700 | [diff] [blame] | 85 | LOCAL_SHARED_LIBRARIES := libbase |
| 86 | |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 87 | # 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. |
| 89 | LOCAL_STATIC_LIBRARIES := libcrypto_static |
| 90 | |
Dan Albert | 88cf1c8 | 2015-02-24 14:08:03 -0800 | [diff] [blame] | 91 | ifeq ($(HOST_OS),windows) |
| 92 | LOCAL_C_INCLUDES += development/host/windows/usb/api/ |
| 93 | endif |
| 94 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 95 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 96 | |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 97 | include $(CLEAR_VARS) |
Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 98 | LOCAL_CLANG := true |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 99 | LOCAL_MODULE := adbd_test |
| 100 | LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS) |
| 101 | LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) |
| 102 | LOCAL_STATIC_LIBRARIES := libadbd |
Dan Albert | c007bc3 | 2015-03-16 10:08:46 -0700 | [diff] [blame] | 103 | LOCAL_SHARED_LIBRARIES := liblog libbase libcutils |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 104 | include $(BUILD_NATIVE_TEST) |
| 105 | |
| 106 | include $(CLEAR_VARS) |
Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 107 | LOCAL_CLANG := $(adb_host_clang) |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 108 | LOCAL_MODULE := adb_test |
| 109 | LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS) |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 110 | LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp |
Dan Albert | c007bc3 | 2015-03-16 10:08:46 -0700 | [diff] [blame] | 111 | LOCAL_SHARED_LIBRARIES := liblog libbase |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 112 | LOCAL_STATIC_LIBRARIES := \ |
| 113 | libadb \ |
| 114 | libcrypto_static \ |
| 115 | libcutils \ |
| 116 | |
| 117 | ifeq ($(HOST_OS),linux) |
| 118 | LOCAL_LDLIBS += -lrt -ldl -lpthread |
| 119 | endif |
| 120 | |
Dan Albert | f8d6b9b | 2015-04-16 19:13:58 -0700 | [diff] [blame] | 121 | ifeq ($(HOST_OS),darwin) |
| 122 | LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit |
| 123 | endif |
| 124 | |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 125 | include $(BUILD_HOST_NATIVE_TEST) |
| 126 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 127 | # adb host tool |
| 128 | # ========================================================= |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 129 | include $(CLEAR_VARS) |
| 130 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 131 | ifeq ($(HOST_OS),linux) |
Chih-Wei Huang | 9c60755 | 2013-01-01 15:24:33 +0800 | [diff] [blame] | 132 | LOCAL_LDLIBS += -lrt -ldl -lpthread |
JP Abgrall | 571c136 | 2012-12-06 18:18:12 -0800 | [diff] [blame] | 133 | LOCAL_CFLAGS += -DWORKAROUND_BUG6558362 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 134 | endif |
| 135 | |
| 136 | ifeq ($(HOST_OS),darwin) |
Benoit Goby | 345ca13 | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 137 | LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon |
Tim Murray | 1efcdef | 2014-07-24 18:33:12 -0700 | [diff] [blame] | 138 | LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 139 | endif |
| 140 | |
| 141 | ifeq ($(HOST_OS),windows) |
Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 142 | LOCAL_LDLIBS += -lws2_32 -lgdi32 |
Benoit Goby | 345ca13 | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 143 | EXTRA_STATIC_LIBS := AdbWinApi |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 144 | endif |
| 145 | |
Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 146 | LOCAL_CLANG := $(adb_host_clang) |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 147 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 148 | LOCAL_SRC_FILES := \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 149 | 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 Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 155 | |
Dan Albert | 7fd821e | 2015-02-24 22:38:21 -0800 | [diff] [blame] | 156 | LOCAL_CFLAGS += \ |
| 157 | -Wall -Werror \ |
| 158 | -Wno-unused-parameter \ |
| 159 | -D_GNU_SOURCE \ |
| 160 | -DADB_HOST=1 \ |
| 161 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 162 | LOCAL_MODULE := adb |
Kenny Root | d5d6d97 | 2012-09-26 09:58:07 -0700 | [diff] [blame] | 163 | LOCAL_MODULE_TAGS := debug |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 164 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 165 | LOCAL_STATIC_LIBRARIES := \ |
| 166 | libadb \ |
Elliott Hughes | 2baae3a | 2015-04-17 10:59:34 -0700 | [diff] [blame] | 167 | libbase \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 168 | libcrypto_static \ |
Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 169 | libcutils \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 170 | $(EXTRA_STATIC_LIBS) \ |
| 171 | |
Colin Cross | dc1e482 | 2015-04-20 12:36:50 -0700 | [diff] [blame] | 172 | # libc++ not available on windows yet |
| 173 | ifneq ($(HOST_OS),windows) |
| 174 | LOCAL_CXX_STL := libc++_static |
| 175 | endif |
Colin Cross | 55bf5f0 | 2015-04-16 16:21:44 -0700 | [diff] [blame] | 176 | |
| 177 | # Don't add anything here, we don't want additional shared dependencies |
| 178 | # on the host adb tool, and shared libraries that link against libc++ |
| 179 | # will violate ODR |
| 180 | LOCAL_SHARED_LIBRARIES := |
| 181 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 182 | include $(BUILD_HOST_EXECUTABLE) |
| 183 | |
Ying Wang | 96535ba | 2012-09-05 10:26:43 -0700 | [diff] [blame] | 184 | $(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] | 185 | |
| 186 | ifeq ($(HOST_OS),windows) |
Raphael | 26f3de6 | 2009-08-11 11:08:45 -0700 | [diff] [blame] | 187 | $(LOCAL_INSTALLED_MODULE): \ |
| 188 | $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \ |
| 189 | $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 190 | endif |
| 191 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 192 | |
| 193 | # adbd device daemon |
| 194 | # ========================================================= |
| 195 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 196 | include $(CLEAR_VARS) |
| 197 | |
Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 198 | LOCAL_CLANG := true |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 199 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 200 | LOCAL_SRC_FILES := \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 201 | adb_main.cpp \ |
| 202 | services.cpp \ |
| 203 | file_sync_service.cpp \ |
| 204 | framebuffer_service.cpp \ |
| 205 | remount_service.cpp \ |
| 206 | set_verity_enable_state_service.cpp \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 207 | |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 208 | LOCAL_CFLAGS := \ |
Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 209 | -DADB_HOST=0 \ |
| 210 | -D_GNU_SOURCE \ |
| 211 | -Wall -Werror \ |
| 212 | -Wno-unused-parameter \ |
| 213 | -Wno-deprecated-declarations \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 214 | |
Nick Kralevich | 5890fe3 | 2012-01-19 13:11:35 -0800 | [diff] [blame] | 215 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
| 216 | LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 |
| 217 | endif |
| 218 | |
Elliott Hughes | ec7a667 | 2015-03-16 21:58:32 +0000 | [diff] [blame] | 219 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 220 | LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 |
| 221 | endif |
| 222 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 223 | LOCAL_MODULE := adbd |
| 224 | |
| 225 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
| 226 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) |
| 227 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) |
Tao Bao | 175b7bb | 2015-03-29 11:22:34 -0700 | [diff] [blame] | 228 | LOCAL_C_INCLUDES += system/extras/ext4_utils |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 229 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 230 | LOCAL_STATIC_LIBRARIES := \ |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 231 | libadbd \ |
Tao Bao | 175b7bb | 2015-03-29 11:22:34 -0700 | [diff] [blame] | 232 | libbase \ |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 233 | libfs_mgr \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 234 | liblog \ |
| 235 | libcutils \ |
| 236 | libc \ |
| 237 | libmincrypt \ |
| 238 | libselinux \ |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 239 | libext4_utils_static \ |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 240 | |
Jeff Brown | 29e1e73 | 2011-07-11 22:12:32 -0700 | [diff] [blame] | 241 | include $(BUILD_EXECUTABLE) |