| 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 | 9113b47 | 2015-07-30 10:25:32 -0700 | [diff] [blame] | 8 | adb_host_sanitize := | 
|  | 9 | adb_target_sanitize := | 
|  | 10 |  | 
| Dan Albert | 1ba1d7c | 2015-05-05 17:46:50 -0700 | [diff] [blame] | 11 | adb_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android | 
|  | 12 |  | 
|  | 13 | ADB_COMMON_CFLAGS := \ | 
| Dan Albert | 23fee8f | 2015-05-20 18:56:10 -0700 | [diff] [blame] | 14 | -Wall -Wextra -Werror \ | 
| Dan Albert | 459df8f | 2015-07-08 13:50:42 -0700 | [diff] [blame] | 15 | -Wno-unused-parameter \ | 
| Dan Albert | 286bb6d | 2015-07-09 20:35:09 +0000 | [diff] [blame] | 16 | -Wno-missing-field-initializers \ | 
| Elliott Hughes | 6d92997 | 2015-10-27 13:40:35 -0700 | [diff] [blame] | 17 | -Wvla \ | 
| Dan Albert | 1ba1d7c | 2015-05-05 17:46:50 -0700 | [diff] [blame] | 18 | -DADB_REVISION='"$(adb_version)"' \ | 
|  | 19 |  | 
| Josh Gao | b7b1edf | 2015-11-11 17:56:12 -0800 | [diff] [blame] | 20 | ADB_COMMON_linux_CFLAGS := \ | 
|  | 21 | -std=c++14 \ | 
|  | 22 | -Wexit-time-destructors \ | 
|  | 23 |  | 
|  | 24 | ADB_COMMON_darwin_CFLAGS := \ | 
|  | 25 | -std=c++14 \ | 
|  | 26 | -Wexit-time-destructors \ | 
|  | 27 |  | 
| Spencer Low | e347c1d | 2015-08-02 18:13:54 -0700 | [diff] [blame] | 28 | # Define windows.h and tchar.h Unicode preprocessor symbols so that | 
|  | 29 | # CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the | 
|  | 30 | # build if you accidentally pass char*. Fix by calling like: | 
| Spencer Low | d21dc82 | 2015-11-12 15:20:15 -0800 | [diff] [blame] | 31 | #   std::wstring path_wide; | 
|  | 32 | #   if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ } | 
|  | 33 | #   CreateFileW(path_wide.c_str()); | 
| Spencer Low | e347c1d | 2015-08-02 18:13:54 -0700 | [diff] [blame] | 34 | ADB_COMMON_windows_CFLAGS := \ | 
|  | 35 | -DUNICODE=1 -D_UNICODE=1 \ | 
|  | 36 |  | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 37 | # libadb | 
|  | 38 | # ========================================================= | 
|  | 39 |  | 
|  | 40 | # Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes | 
|  | 41 | # made to adb rarely get ported to the other two, so the trees have diverged a | 
|  | 42 | # bit. We'd like to stop this because it is a maintenance nightmare, but the | 
|  | 43 | # divergence makes this difficult to do all at once. For now, we will start | 
|  | 44 | # small by moving common files into a static library. Hopefully some day we can | 
|  | 45 | # 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] | 46 | LIBADB_SRC_FILES := \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 47 | adb.cpp \ | 
|  | 48 | adb_auth.cpp \ | 
| Dan Albert | cc731cc | 2015-02-24 21:26:58 -0800 | [diff] [blame] | 49 | adb_io.cpp \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 50 | adb_listeners.cpp \ | 
| Yabin Cui | aed3c61 | 2015-09-22 15:52:57 -0700 | [diff] [blame] | 51 | adb_trace.cpp \ | 
| Elliott Hughes | 5830577 | 2015-04-17 13:57:15 -0700 | [diff] [blame] | 52 | adb_utils.cpp \ | 
| Josh Gao | addab3d | 2016-02-16 17:34:53 -0800 | [diff] [blame] | 53 | fdevent.cpp \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 54 | sockets.cpp \ | 
|  | 55 | transport.cpp \ | 
|  | 56 | transport_local.cpp \ | 
|  | 57 | transport_usb.cpp \ | 
| Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 58 |  | 
| Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 59 | LIBADB_TEST_SRCS := \ | 
|  | 60 | adb_io_test.cpp \ | 
|  | 61 | adb_utils_test.cpp \ | 
| Josh Gao | b582fa3 | 2016-02-10 14:49:00 -0800 | [diff] [blame] | 62 | fdevent_test.cpp \ | 
|  | 63 | socket_test.cpp \ | 
| Josh Gao | d302a15 | 2016-02-09 14:59:09 -0800 | [diff] [blame] | 64 | sysdeps_test.cpp \ | 
| Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 65 | transport_test.cpp \ | 
|  | 66 |  | 
| Dan Albert | bf10647 | 2015-02-20 17:20:09 -0800 | [diff] [blame] | 67 | LIBADB_CFLAGS := \ | 
| Dan Albert | 1ba1d7c | 2015-05-05 17:46:50 -0700 | [diff] [blame] | 68 | $(ADB_COMMON_CFLAGS) \ | 
| Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 69 | -fvisibility=hidden \ | 
| Elliott Hughes | 4f1d7b5 | 2015-07-24 14:32:46 -0700 | [diff] [blame] | 70 |  | 
|  | 71 | LIBADB_linux_CFLAGS := \ | 
| Josh Gao | b7b1edf | 2015-11-11 17:56:12 -0800 | [diff] [blame] | 72 | $(ADB_COMMON_linux_CFLAGS) \ | 
|  | 73 |  | 
|  | 74 | LIBADB_darwin_CFLAGS := \ | 
|  | 75 | $(ADB_COMMON_darwin_CFLAGS) \ | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 76 |  | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 77 | LIBADB_windows_CFLAGS := \ | 
|  | 78 | $(ADB_COMMON_windows_CFLAGS) \ | 
| Elliott Hughes | 4f1d7b5 | 2015-07-24 14:32:46 -0700 | [diff] [blame] | 79 |  | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 80 | LIBADB_darwin_SRC_FILES := \ | 
| Elliott Hughes | 1a4d85a | 2015-04-16 13:24:58 -0700 | [diff] [blame] | 81 | get_my_path_darwin.cpp \ | 
| David Pursell | a76e5f0 | 2016-02-22 14:27:23 -0800 | [diff] [blame] | 82 | sysdeps_unix.cpp \ | 
| Dan Albert | 7447dd0 | 2015-04-16 19:20:40 -0700 | [diff] [blame] | 83 | usb_osx.cpp \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 84 |  | 
|  | 85 | LIBADB_linux_SRC_FILES := \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 86 | get_my_path_linux.cpp \ | 
| David Pursell | a76e5f0 | 2016-02-22 14:27:23 -0800 | [diff] [blame] | 87 | sysdeps_unix.cpp \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 88 | usb_linux.cpp \ | 
|  | 89 |  | 
|  | 90 | LIBADB_windows_SRC_FILES := \ | 
| Elliott Hughes | a2f2e56 | 2015-04-16 16:47:02 -0700 | [diff] [blame] | 91 | sysdeps_win32.cpp \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 92 | usb_windows.cpp \ | 
| Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 93 |  | 
| Spencer Low | e6ae573 | 2015-09-08 17:13:04 -0700 | [diff] [blame] | 94 | LIBADB_TEST_windows_SRCS := \ | 
|  | 95 | sysdeps_win32_test.cpp \ | 
|  | 96 |  | 
| Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 97 | include $(CLEAR_VARS) | 
| Elliott Hughes | 2acec91 | 2015-04-16 14:12:50 -0700 | [diff] [blame] | 98 | LOCAL_CLANG := true | 
| Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 99 | LOCAL_MODULE := libadbd | 
|  | 100 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0 | 
| Dan Albert | 21c3eaf | 2015-02-18 17:20:44 -0800 | [diff] [blame] | 101 | LOCAL_SRC_FILES := \ | 
|  | 102 | $(LIBADB_SRC_FILES) \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 103 | adb_auth_client.cpp \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 104 | jdwp_service.cpp \ | 
| Elliott Hughes | 2acec91 | 2015-04-16 14:12:50 -0700 | [diff] [blame] | 105 | usb_linux_client.cpp \ | 
| Dan Albert | 21c3eaf | 2015-02-18 17:20:44 -0800 | [diff] [blame] | 106 |  | 
| Dan Albert | 9113b47 | 2015-07-30 10:25:32 -0700 | [diff] [blame] | 107 | LOCAL_SANITIZE := $(adb_target_sanitize) | 
| Elliott Hughes | 7b50609 | 2015-04-20 08:09:20 -0700 | [diff] [blame] | 108 |  | 
| Dan Albert | e246219 | 2015-03-19 13:25:27 -0700 | [diff] [blame] | 109 | # Even though we're building a static library (and thus there's no link step for | 
|  | 110 | # this to take effect), this adds the includes to our path. | 
|  | 111 | LOCAL_STATIC_LIBRARIES := libbase | 
|  | 112 |  | 
| Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 113 | include $(BUILD_STATIC_LIBRARY) | 
|  | 114 |  | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 115 | include $(CLEAR_VARS) | 
|  | 116 | LOCAL_MODULE := libadb | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 117 | LOCAL_MODULE_HOST_OS := darwin linux windows | 
| Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 118 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1 | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 119 | LOCAL_CFLAGS_windows := $(LIBADB_windows_CFLAGS) | 
|  | 120 | LOCAL_CFLAGS_linux := $(LIBADB_linux_CFLAGS) | 
| Josh Gao | b7b1edf | 2015-11-11 17:56:12 -0800 | [diff] [blame] | 121 | LOCAL_CFLAGS_darwin := $(LIBADB_darwin_CFLAGS) | 
| Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 122 | LOCAL_SRC_FILES := \ | 
|  | 123 | $(LIBADB_SRC_FILES) \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 124 | adb_auth_host.cpp \ | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 125 |  | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 126 | LOCAL_SRC_FILES_darwin := $(LIBADB_darwin_SRC_FILES) | 
|  | 127 | LOCAL_SRC_FILES_linux := $(LIBADB_linux_SRC_FILES) | 
|  | 128 | LOCAL_SRC_FILES_windows := $(LIBADB_windows_SRC_FILES) | 
|  | 129 |  | 
| Dan Albert | 9113b47 | 2015-07-30 10:25:32 -0700 | [diff] [blame] | 130 | LOCAL_SANITIZE := $(adb_host_sanitize) | 
| Elliott Hughes | 7b50609 | 2015-04-20 08:09:20 -0700 | [diff] [blame] | 131 |  | 
| Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 132 | # Even though we're building a static library (and thus there's no link step for | 
| Dan Albert | e246219 | 2015-03-19 13:25:27 -0700 | [diff] [blame] | 133 | # this to take effect), this adds the includes to our path. | 
|  | 134 | LOCAL_STATIC_LIBRARIES := libcrypto_static libbase | 
| Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 135 |  | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 136 | LOCAL_C_INCLUDES_windows := development/host/windows/usb/api/ | 
| Dan Willemsen | 66680c5 | 2015-09-03 20:29:56 -0700 | [diff] [blame] | 137 | LOCAL_MULTILIB := first | 
| Dan Albert | 88cf1c8 | 2015-02-24 14:08:03 -0800 | [diff] [blame] | 138 |  | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 139 | include $(BUILD_HOST_STATIC_LIBRARY) | 
|  | 140 |  | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 141 | include $(CLEAR_VARS) | 
| Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 142 | LOCAL_CLANG := true | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 143 | LOCAL_MODULE := adbd_test | 
|  | 144 | LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS) | 
| Yabin Cui | bec02fc | 2015-08-28 15:44:27 -0700 | [diff] [blame] | 145 | LOCAL_SRC_FILES := \ | 
|  | 146 | $(LIBADB_TEST_SRCS) \ | 
|  | 147 | $(LIBADB_TEST_linux_SRCS) \ | 
| David Pursell | 0955c66 | 2015-08-31 10:42:13 -0700 | [diff] [blame] | 148 | shell_service.cpp \ | 
| David Pursell | b9e2e84 | 2015-08-31 15:36:18 -0700 | [diff] [blame] | 149 | shell_service_protocol.cpp \ | 
|  | 150 | shell_service_protocol_test.cpp \ | 
| David Pursell | 0955c66 | 2015-08-31 10:42:13 -0700 | [diff] [blame] | 151 | shell_service_test.cpp \ | 
| Yabin Cui | bec02fc | 2015-08-28 15:44:27 -0700 | [diff] [blame] | 152 |  | 
| Dan Albert | 9113b47 | 2015-07-30 10:25:32 -0700 | [diff] [blame] | 153 | LOCAL_SANITIZE := $(adb_target_sanitize) | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 154 | LOCAL_STATIC_LIBRARIES := libadbd | 
| Dimitry Ivanov | 8b642e4 | 2016-02-12 18:40:29 -0800 | [diff] [blame] | 155 | LOCAL_SHARED_LIBRARIES := liblog libbase libcutils | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 156 | include $(BUILD_NATIVE_TEST) | 
|  | 157 |  | 
| Elliott Hughes | 1b708d3 | 2015-12-11 19:07:01 -0800 | [diff] [blame] | 158 | # libdiagnose_usb | 
|  | 159 | # ========================================================= | 
|  | 160 |  | 
|  | 161 | include $(CLEAR_VARS) | 
|  | 162 | LOCAL_MODULE := libdiagnose_usb | 
|  | 163 | LOCAL_MODULE_HOST_OS := darwin linux windows | 
|  | 164 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) | 
|  | 165 | LOCAL_SRC_FILES := diagnose_usb.cpp | 
|  | 166 | # Even though we're building a static library (and thus there's no link step for | 
|  | 167 | # this to take effect), this adds the includes to our path. | 
|  | 168 | LOCAL_STATIC_LIBRARIES := libbase | 
|  | 169 | include $(BUILD_HOST_STATIC_LIBRARY) | 
|  | 170 |  | 
| Spencer Low | cf168a8 | 2015-05-24 15:36:28 -0700 | [diff] [blame] | 171 | # adb_test | 
|  | 172 | # ========================================================= | 
|  | 173 |  | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 174 | include $(CLEAR_VARS) | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 175 | LOCAL_MODULE := adb_test | 
| Spencer Low | ebf770f | 2015-09-07 23:39:02 -0700 | [diff] [blame] | 176 | LOCAL_MODULE_HOST_OS := darwin linux windows | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 177 | LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS) | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 178 | LOCAL_CFLAGS_windows := $(LIBADB_windows_CFLAGS) | 
|  | 179 | LOCAL_CFLAGS_linux := $(LIBADB_linux_CFLAGS) | 
| Josh Gao | b7b1edf | 2015-11-11 17:56:12 -0800 | [diff] [blame] | 180 | LOCAL_CFLAGS_darwin := $(LIBADB_darwin_CFLAGS) | 
| David Pursell | b9e2e84 | 2015-08-31 15:36:18 -0700 | [diff] [blame] | 181 | LOCAL_SRC_FILES := \ | 
|  | 182 | $(LIBADB_TEST_SRCS) \ | 
|  | 183 | services.cpp \ | 
|  | 184 | shell_service_protocol.cpp \ | 
|  | 185 | shell_service_protocol_test.cpp \ | 
|  | 186 |  | 
| David Pursell | b404dec | 2015-09-11 16:06:59 -0700 | [diff] [blame] | 187 | LOCAL_SRC_FILES_linux := $(LIBADB_TEST_linux_SRCS) | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 188 | LOCAL_SRC_FILES_darwin := $(LIBADB_TEST_darwin_SRCS) | 
| Spencer Low | e6ae573 | 2015-09-08 17:13:04 -0700 | [diff] [blame] | 189 | LOCAL_SRC_FILES_windows := $(LIBADB_TEST_windows_SRCS) | 
| Dan Albert | 9113b47 | 2015-07-30 10:25:32 -0700 | [diff] [blame] | 190 | LOCAL_SANITIZE := $(adb_host_sanitize) | 
| Yabin Cui | cb992d9 | 2015-09-08 18:27:10 -0700 | [diff] [blame] | 191 | LOCAL_SHARED_LIBRARIES := libbase | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 192 | LOCAL_STATIC_LIBRARIES := \ | 
|  | 193 | libadb \ | 
|  | 194 | libcrypto_static \ | 
|  | 195 | libcutils \ | 
| Elliott Hughes | 1b708d3 | 2015-12-11 19:07:01 -0800 | [diff] [blame] | 196 | libdiagnose_usb \ | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 197 |  | 
| Spencer Low | e6ae573 | 2015-09-08 17:13:04 -0700 | [diff] [blame] | 198 | # Set entrypoint to wmain from sysdeps_win32.cpp instead of main | 
|  | 199 | LOCAL_LDFLAGS_windows := -municode | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 200 | LOCAL_LDLIBS_linux := -lrt -ldl -lpthread | 
|  | 201 | LOCAL_LDLIBS_darwin := -framework CoreFoundation -framework IOKit | 
|  | 202 | LOCAL_LDLIBS_windows := -lws2_32 -luserenv | 
|  | 203 | LOCAL_STATIC_LIBRARIES_windows := AdbWinApi | 
| Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 204 |  | 
| Dan Willemsen | 1e20e0a | 2015-12-21 16:14:31 -0800 | [diff] [blame] | 205 | LOCAL_MULTILIB := first | 
|  | 206 |  | 
| Spencer Low | cf168a8 | 2015-05-24 15:36:28 -0700 | [diff] [blame] | 207 | include $(BUILD_HOST_NATIVE_TEST) | 
|  | 208 |  | 
| Elliott Hughes | e67f1f8 | 2015-04-30 17:32:03 -0700 | [diff] [blame] | 209 | # adb device tracker (used by ddms) test tool | 
|  | 210 | # ========================================================= | 
|  | 211 |  | 
|  | 212 | ifeq ($(HOST_OS),linux) | 
|  | 213 | include $(CLEAR_VARS) | 
| Elliott Hughes | e67f1f8 | 2015-04-30 17:32:03 -0700 | [diff] [blame] | 214 | LOCAL_MODULE := adb_device_tracker_test | 
|  | 215 | LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS) | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 216 | LOCAL_CFLAGS_windows := $(LIBADB_windows_CFLAGS) | 
|  | 217 | LOCAL_CFLAGS_linux := $(LIBADB_linux_CFLAGS) | 
| Josh Gao | b7b1edf | 2015-11-11 17:56:12 -0800 | [diff] [blame] | 218 | LOCAL_CFLAGS_darwin := $(LIBADB_darwin_CFLAGS) | 
| Elliott Hughes | e67f1f8 | 2015-04-30 17:32:03 -0700 | [diff] [blame] | 219 | LOCAL_SRC_FILES := test_track_devices.cpp | 
| Dan Albert | 9113b47 | 2015-07-30 10:25:32 -0700 | [diff] [blame] | 220 | LOCAL_SANITIZE := $(adb_host_sanitize) | 
| Yabin Cui | cb992d9 | 2015-09-08 18:27:10 -0700 | [diff] [blame] | 221 | LOCAL_SHARED_LIBRARIES := libbase | 
| Elliott Hughes | e67f1f8 | 2015-04-30 17:32:03 -0700 | [diff] [blame] | 222 | LOCAL_STATIC_LIBRARIES := libadb libcrypto_static libcutils | 
|  | 223 | LOCAL_LDLIBS += -lrt -ldl -lpthread | 
|  | 224 | include $(BUILD_HOST_EXECUTABLE) | 
|  | 225 | endif | 
|  | 226 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 227 | # adb host tool | 
|  | 228 | # ========================================================= | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 229 | include $(CLEAR_VARS) | 
|  | 230 |  | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 231 | LOCAL_LDLIBS_linux := -lrt -ldl -lpthread | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 232 |  | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 233 | LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 234 |  | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 235 | # Use wmain instead of main | 
|  | 236 | LOCAL_LDFLAGS_windows := -municode | 
|  | 237 | LOCAL_LDLIBS_windows := -lws2_32 -lgdi32 | 
|  | 238 | LOCAL_STATIC_LIBRARIES_windows := AdbWinApi | 
|  | 239 | LOCAL_REQUIRED_MODULES_windows := AdbWinApi AdbWinUsbApi | 
| Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 240 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 241 | LOCAL_SRC_FILES := \ | 
| Elliott Hughes | b708d16 | 2015-10-27 16:03:15 -0700 | [diff] [blame] | 242 | adb_client.cpp \ | 
| Dan Albert | c89e0cc | 2015-05-08 16:13:53 -0700 | [diff] [blame] | 243 | client/main.cpp \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 244 | console.cpp \ | 
|  | 245 | commandline.cpp \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 246 | file_sync_client.cpp \ | 
| Elliott Hughes | b708d16 | 2015-10-27 16:03:15 -0700 | [diff] [blame] | 247 | line_printer.cpp \ | 
|  | 248 | services.cpp \ | 
| David Pursell | b9e2e84 | 2015-08-31 15:36:18 -0700 | [diff] [blame] | 249 | shell_service_protocol.cpp \ | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 250 |  | 
| Dan Albert | 7fd821e | 2015-02-24 22:38:21 -0800 | [diff] [blame] | 251 | LOCAL_CFLAGS += \ | 
| Dan Albert | 1ba1d7c | 2015-05-05 17:46:50 -0700 | [diff] [blame] | 252 | $(ADB_COMMON_CFLAGS) \ | 
| Dan Albert | 7fd821e | 2015-02-24 22:38:21 -0800 | [diff] [blame] | 253 | -D_GNU_SOURCE \ | 
|  | 254 | -DADB_HOST=1 \ | 
|  | 255 |  | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 256 | LOCAL_CFLAGS_windows := \ | 
|  | 257 | $(ADB_COMMON_windows_CFLAGS) | 
|  | 258 |  | 
| Josh Gao | b7b1edf | 2015-11-11 17:56:12 -0800 | [diff] [blame] | 259 | LOCAL_CFLAGS_linux := \ | 
|  | 260 | $(ADB_COMMON_linux_CFLAGS) \ | 
|  | 261 |  | 
|  | 262 | LOCAL_CFLAGS_darwin := \ | 
|  | 263 | $(ADB_COMMON_darwin_CFLAGS) \ | 
|  | 264 | -Wno-sizeof-pointer-memaccess -Wno-unused-parameter \ | 
|  | 265 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 266 | LOCAL_MODULE := adb | 
| Kenny Root | d5d6d97 | 2012-09-26 09:58:07 -0700 | [diff] [blame] | 267 | LOCAL_MODULE_TAGS := debug | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 268 | LOCAL_MODULE_HOST_OS := darwin linux windows | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 269 |  | 
| Dan Albert | 9113b47 | 2015-07-30 10:25:32 -0700 | [diff] [blame] | 270 | LOCAL_SANITIZE := $(adb_host_sanitize) | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 271 | LOCAL_STATIC_LIBRARIES := \ | 
|  | 272 | libadb \ | 
| Elliott Hughes | 2baae3a | 2015-04-17 10:59:34 -0700 | [diff] [blame] | 273 | libbase \ | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 274 | libcrypto_static \ | 
| Elliott Hughes | 1b708d3 | 2015-12-11 19:07:01 -0800 | [diff] [blame] | 275 | libdiagnose_usb \ | 
| Elliott Hughes | 9309ecb | 2015-04-27 14:20:17 -0700 | [diff] [blame] | 276 | liblog \ | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 277 |  | 
| Josh Gao | a629e2e | 2015-11-13 17:55:45 -0800 | [diff] [blame] | 278 | # Don't use libcutils on Windows. | 
|  | 279 | LOCAL_STATIC_LIBRARIES_darwin := libcutils | 
|  | 280 | LOCAL_STATIC_LIBRARIES_linux := libcutils | 
|  | 281 |  | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 282 | LOCAL_CXX_STL := libc++_static | 
| Colin Cross | 55bf5f0 | 2015-04-16 16:21:44 -0700 | [diff] [blame] | 283 |  | 
|  | 284 | # Don't add anything here, we don't want additional shared dependencies | 
|  | 285 | # on the host adb tool, and shared libraries that link against libc++ | 
|  | 286 | # will violate ODR | 
|  | 287 | LOCAL_SHARED_LIBRARIES := | 
|  | 288 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 289 | include $(BUILD_HOST_EXECUTABLE) | 
|  | 290 |  | 
| Ying Wang | f48503b | 2016-02-29 19:27:06 -0800 | [diff] [blame] | 291 | $(call dist-for-goals,dist_files sdk win_sdk,$(LOCAL_BUILT_MODULE)) | 
|  | 292 | ifdef HOST_CROSS_OS | 
|  | 293 | # Archive adb.exe for win_sdk build. | 
|  | 294 | $(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_adb.BUILT)) | 
|  | 295 | endif | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 296 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 297 |  | 
|  | 298 | # adbd device daemon | 
|  | 299 | # ========================================================= | 
|  | 300 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 301 | include $(CLEAR_VARS) | 
|  | 302 |  | 
| Elliott Hughes | 53daee6 | 2015-04-19 13:17:01 -0700 | [diff] [blame] | 303 | LOCAL_CLANG := true | 
| Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 304 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 305 | LOCAL_SRC_FILES := \ | 
| Dan Albert | c89e0cc | 2015-05-08 16:13:53 -0700 | [diff] [blame] | 306 | daemon/main.cpp \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 307 | services.cpp \ | 
|  | 308 | file_sync_service.cpp \ | 
|  | 309 | framebuffer_service.cpp \ | 
|  | 310 | remount_service.cpp \ | 
|  | 311 | set_verity_enable_state_service.cpp \ | 
| David Pursell | 80f6702 | 2015-08-28 15:08:49 -0700 | [diff] [blame] | 312 | shell_service.cpp \ | 
| David Pursell | b9e2e84 | 2015-08-31 15:36:18 -0700 | [diff] [blame] | 313 | shell_service_protocol.cpp \ | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 314 |  | 
| Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 315 | LOCAL_CFLAGS := \ | 
| Dan Albert | 1ba1d7c | 2015-05-05 17:46:50 -0700 | [diff] [blame] | 316 | $(ADB_COMMON_CFLAGS) \ | 
| Josh Gao | b7b1edf | 2015-11-11 17:56:12 -0800 | [diff] [blame] | 317 | $(ADB_COMMON_linux_CFLAGS) \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 318 | -DADB_HOST=0 \ | 
|  | 319 | -D_GNU_SOURCE \ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 320 | -Wno-deprecated-declarations \ | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 321 |  | 
| Elliott Hughes | 5cba504 | 2015-06-17 15:23:42 -0700 | [diff] [blame] | 322 | LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0) | 
| Nick Kralevich | 5890fe3 | 2012-01-19 13:11:35 -0800 | [diff] [blame] | 323 |  | 
| Elliott Hughes | ec7a667 | 2015-03-16 21:58:32 +0000 | [diff] [blame] | 324 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) | 
| Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 325 | LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 | 
| Elliott Hughes | 5cba504 | 2015-06-17 15:23:42 -0700 | [diff] [blame] | 326 | LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 | 
| Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 327 | endif | 
|  | 328 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 329 | LOCAL_MODULE := adbd | 
|  | 330 |  | 
|  | 331 | LOCAL_FORCE_STATIC_EXECUTABLE := true | 
|  | 332 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) | 
|  | 333 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) | 
| Tao Bao | 175b7bb | 2015-03-29 11:22:34 -0700 | [diff] [blame] | 334 | LOCAL_C_INCLUDES += system/extras/ext4_utils | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 335 |  | 
| Dan Albert | 9113b47 | 2015-07-30 10:25:32 -0700 | [diff] [blame] | 336 | LOCAL_SANITIZE := $(adb_target_sanitize) | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 337 | LOCAL_STATIC_LIBRARIES := \ | 
| Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 338 | libadbd \ | 
| Tao Bao | 175b7bb | 2015-03-29 11:22:34 -0700 | [diff] [blame] | 339 | libbase \ | 
| Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 340 | libfs_mgr \ | 
| Sami Tolvanen | 8ad8076 | 2015-10-20 13:24:24 +0100 | [diff] [blame] | 341 | libfec \ | 
|  | 342 | libfec_rs \ | 
| William Roberts | bd2d961 | 2015-08-04 14:23:04 -0700 | [diff] [blame] | 343 | libselinux \ | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 344 | liblog \ | 
| Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 345 | libmincrypt \ | 
| Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 346 | libext4_utils_static \ | 
| Sami Tolvanen | 8ad8076 | 2015-10-20 13:24:24 +0100 | [diff] [blame] | 347 | libsquashfs_utils \ | 
| Dan Albert | e246219 | 2015-03-19 13:25:27 -0700 | [diff] [blame] | 348 | libcutils \ | 
|  | 349 | libbase \ | 
| Jorge Lucangeli Obes | 683dc48 | 2015-12-14 13:18:57 -0800 | [diff] [blame] | 350 | libcrypto_static \ | 
| Jorge Lucangeli Obes | 218eb7c | 2016-01-08 13:24:13 -0800 | [diff] [blame] | 351 | libminijail | 
| Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 352 |  | 
| Jeff Brown | 29e1e73 | 2011-07-11 22:12:32 -0700 | [diff] [blame] | 353 | include $(BUILD_EXECUTABLE) |