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