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 | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 8 | # libadb |
| 9 | # ========================================================= |
| 10 | |
| 11 | # Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes |
| 12 | # made to adb rarely get ported to the other two, so the trees have diverged a |
| 13 | # bit. We'd like to stop this because it is a maintenance nightmare, but the |
| 14 | # divergence makes this difficult to do all at once. For now, we will start |
| 15 | # small by moving common files into a static library. Hopefully some day we can |
| 16 | # get enough of adb in here that we no longer need minadb. https://b/17626262 |
| 17 | LIBADB_SRC_FILES := |
| 18 | LIBADB_C_FLAGS := -Wall -Werror -D_XOPEN_SOURCE -D_GNU_SOURCE |
| 19 | |
| 20 | include $(CLEAR_VARS) |
| 21 | LOCAL_MODULE := libadb |
| 22 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0 |
| 23 | LOCAL_SRC_FILES := $(LIBADB_SRC_FILES) fdevent.cpp |
| 24 | include $(BUILD_STATIC_LIBRARY) |
| 25 | |
| 26 | include $(CLEAR_VARS) |
| 27 | LOCAL_MODULE := libadb |
| 28 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1 |
| 29 | LOCAL_SRC_FILES := $(LIBADB_SRC_FILES) |
| 30 | ifeq ($(HOST_OS),windows) |
| 31 | LOCAL_SRC_FILES += sysdeps_wind32.c |
| 32 | else |
| 33 | LOCAL_SRC_FILES += fdevent.cpp |
| 34 | endif |
| 35 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 36 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 37 | # adb host tool |
| 38 | # ========================================================= |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 39 | include $(CLEAR_VARS) |
| 40 | |
| 41 | # Default to a virtual (sockets) usb interface |
| 42 | USB_SRCS := |
| 43 | EXTRA_SRCS := |
| 44 | |
| 45 | ifeq ($(HOST_OS),linux) |
| 46 | USB_SRCS := usb_linux.c |
| 47 | EXTRA_SRCS := get_my_path_linux.c |
Chih-Wei Huang | 9c60755 | 2013-01-01 15:24:33 +0800 | [diff] [blame] | 48 | LOCAL_LDLIBS += -lrt -ldl -lpthread |
JP Abgrall | 571c136 | 2012-12-06 18:18:12 -0800 | [diff] [blame] | 49 | LOCAL_CFLAGS += -DWORKAROUND_BUG6558362 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 50 | endif |
| 51 | |
| 52 | ifeq ($(HOST_OS),darwin) |
| 53 | USB_SRCS := usb_osx.c |
| 54 | EXTRA_SRCS := get_my_path_darwin.c |
Benoit Goby | 345ca13 | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 55 | LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon |
Tim Murray | 1efcdef | 2014-07-24 18:33:12 -0700 | [diff] [blame] | 56 | LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 57 | endif |
| 58 | |
Alexey Tarasov | 3b226f9 | 2009-10-25 01:37:37 +1100 | [diff] [blame] | 59 | ifeq ($(HOST_OS),freebsd) |
| 60 | USB_SRCS := usb_libusb.c |
| 61 | EXTRA_SRCS := get_my_path_freebsd.c |
| 62 | LOCAL_LDLIBS += -lpthread -lusb |
| 63 | endif |
| 64 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 65 | ifeq ($(HOST_OS),windows) |
| 66 | USB_SRCS := usb_windows.c |
Mark Salyzyn | c788278 | 2013-12-06 15:50:48 -0800 | [diff] [blame] | 67 | EXTRA_SRCS := get_my_path_windows.c |
Benoit Goby | 345ca13 | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 68 | EXTRA_STATIC_LIBS := AdbWinApi |
Raphael | fab1678 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 69 | ifneq ($(strip $(USE_MINGW)),) |
| 70 | # MinGW under Linux case |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 71 | LOCAL_LDLIBS += -lws2_32 -lgdi32 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 72 | USE_SYSDEPS_WIN32 := 1 |
| 73 | endif |
Raphael | fab1678 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 74 | LOCAL_C_INCLUDES += development/host/windows/usb/api/ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 75 | endif |
| 76 | |
| 77 | LOCAL_SRC_FILES := \ |
| 78 | adb.c \ |
| 79 | console.c \ |
| 80 | transport.c \ |
| 81 | transport_local.c \ |
| 82 | transport_usb.c \ |
| 83 | commandline.c \ |
| 84 | adb_client.c \ |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 85 | adb_auth_host.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 86 | sockets.c \ |
| 87 | services.c \ |
| 88 | file_sync_client.c \ |
| 89 | $(EXTRA_SRCS) \ |
| 90 | $(USB_SRCS) \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 91 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 92 | ifneq ($(USE_SYSDEPS_WIN32),) |
| 93 | LOCAL_SRC_FILES += sysdeps_win32.c |
| 94 | endif |
| 95 | |
Stephen Hines | 3ea87c3 | 2014-10-01 17:16:37 -0700 | [diff] [blame] | 96 | LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter -Werror |
Jack Palevich | 7fe202f | 2010-05-25 14:49:57 +0800 | [diff] [blame] | 97 | LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 98 | LOCAL_MODULE := adb |
Kenny Root | d5d6d97 | 2012-09-26 09:58:07 -0700 | [diff] [blame] | 99 | LOCAL_MODULE_TAGS := debug |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 100 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 101 | LOCAL_STATIC_LIBRARIES := \ |
| 102 | libadb \ |
| 103 | libzipfile \ |
| 104 | libz \ |
| 105 | libcrypto_static \ |
| 106 | $(EXTRA_STATIC_LIBS) \ |
| 107 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 108 | ifeq ($(USE_SYSDEPS_WIN32),) |
| 109 | LOCAL_STATIC_LIBRARIES += libcutils |
| 110 | endif |
| 111 | |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 112 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 113 | include $(BUILD_HOST_EXECUTABLE) |
| 114 | |
Ying Wang | 96535ba | 2012-09-05 10:26:43 -0700 | [diff] [blame] | 115 | $(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] | 116 | |
| 117 | ifeq ($(HOST_OS),windows) |
Raphael | 26f3de6 | 2009-08-11 11:08:45 -0700 | [diff] [blame] | 118 | $(LOCAL_INSTALLED_MODULE): \ |
| 119 | $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \ |
| 120 | $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 121 | endif |
| 122 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 123 | |
| 124 | # adbd device daemon |
| 125 | # ========================================================= |
| 126 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 127 | include $(CLEAR_VARS) |
| 128 | |
| 129 | LOCAL_SRC_FILES := \ |
| 130 | adb.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 131 | transport.c \ |
| 132 | transport_local.c \ |
| 133 | transport_usb.c \ |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 134 | adb_auth_client.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 135 | sockets.c \ |
| 136 | services.c \ |
| 137 | file_sync_service.c \ |
| 138 | jdwp_service.c \ |
| 139 | framebuffer_service.c \ |
| 140 | remount_service.c \ |
Paul Lawrence | 982089d | 2014-12-03 15:31:57 -0800 | [diff] [blame] | 141 | set_verity_enable_state_service.c \ |
Mark Salyzyn | 7aa39a7 | 2013-12-10 12:37:57 -0800 | [diff] [blame] | 142 | usb_linux_client.c |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 143 | |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 144 | LOCAL_CFLAGS := \ |
| 145 | -O2 \ |
| 146 | -g \ |
| 147 | -DADB_HOST=0 \ |
| 148 | -D_XOPEN_SOURCE \ |
| 149 | -D_GNU_SOURCE \ |
| 150 | -Wall -Wno-unused-parameter -Werror -Wno-deprecated-declarations \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 151 | |
Nick Kralevich | 5890fe3 | 2012-01-19 13:11:35 -0800 | [diff] [blame] | 152 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
| 153 | LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 |
| 154 | endif |
| 155 | |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 156 | ifneq (,$(filter userdebug,$(TARGET_BUILD_VARIANT))) |
| 157 | LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 |
| 158 | endif |
| 159 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 160 | LOCAL_MODULE := adbd |
| 161 | |
| 162 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
| 163 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) |
| 164 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame^] | 165 | LOCAL_C_INCLUDES += system/extras/ext4_utils system/core/fs_mgr/include |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 166 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 167 | LOCAL_STATIC_LIBRARIES := \ |
| 168 | libadb \ |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame^] | 169 | libfs_mgr \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 170 | liblog \ |
| 171 | libcutils \ |
| 172 | libc \ |
| 173 | libmincrypt \ |
| 174 | libselinux \ |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame^] | 175 | libext4_utils_static \ |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 176 | |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 177 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 178 | |
Jeff Brown | 29e1e73 | 2011-07-11 22:12:32 -0700 | [diff] [blame] | 179 | include $(BUILD_EXECUTABLE) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 180 | |
John Michelau | c318833 | 2010-09-23 17:08:34 -0500 | [diff] [blame] | 181 | |
| 182 | # adb host tool for device-as-host |
| 183 | # ========================================================= |
Benoit Goby | dff0237 | 2010-10-06 18:30:55 -0700 | [diff] [blame] | 184 | ifneq ($(SDK_ONLY),true) |
John Michelau | c318833 | 2010-09-23 17:08:34 -0500 | [diff] [blame] | 185 | include $(CLEAR_VARS) |
| 186 | |
John Michelau | c318833 | 2010-09-23 17:08:34 -0500 | [diff] [blame] | 187 | LOCAL_SRC_FILES := \ |
| 188 | adb.c \ |
| 189 | console.c \ |
| 190 | transport.c \ |
| 191 | transport_local.c \ |
| 192 | transport_usb.c \ |
| 193 | commandline.c \ |
| 194 | adb_client.c \ |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 195 | adb_auth_host.c \ |
John Michelau | c318833 | 2010-09-23 17:08:34 -0500 | [diff] [blame] | 196 | sockets.c \ |
| 197 | services.c \ |
| 198 | file_sync_client.c \ |
| 199 | get_my_path_linux.c \ |
| 200 | usb_linux.c \ |
John Michelau | c318833 | 2010-09-23 17:08:34 -0500 | [diff] [blame] | 201 | |
| 202 | LOCAL_CFLAGS := \ |
| 203 | -O2 \ |
| 204 | -g \ |
| 205 | -DADB_HOST=1 \ |
| 206 | -DADB_HOST_ON_TARGET=1 \ |
Mark Salyzyn | 60299df | 2014-04-30 09:10:31 -0700 | [diff] [blame] | 207 | -Wall -Wno-unused-parameter -Werror \ |
John Michelau | c318833 | 2010-09-23 17:08:34 -0500 | [diff] [blame] | 208 | -D_XOPEN_SOURCE \ |
| 209 | -D_GNU_SOURCE |
| 210 | |
| 211 | LOCAL_MODULE := adb |
| 212 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 213 | LOCAL_STATIC_LIBRARIES := libadb libzipfile libz libcutils liblog |
John Michelau | c318833 | 2010-09-23 17:08:34 -0500 | [diff] [blame] | 214 | |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 215 | LOCAL_SHARED_LIBRARIES := libcrypto |
| 216 | |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 217 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
John Michelau | c318833 | 2010-09-23 17:08:34 -0500 | [diff] [blame] | 218 | include $(BUILD_EXECUTABLE) |
Benoit Goby | cb56b71 | 2010-10-06 17:11:59 -0700 | [diff] [blame] | 219 | endif |