The Android Open Source Project | 9ca14dc | 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 | bbbbea6 | 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 |
Dan Albert | dfef94a | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 17 | LIBADB_SRC_FILES := transport.c transport_usb.c |
Dan Albert | bbbbea6 | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 18 | LIBADB_C_FLAGS := -Wall -Werror -D_XOPEN_SOURCE -D_GNU_SOURCE |
| 19 | |
Dan Albert | dfef94a | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 20 | LIBADB_LINUX_SRC_FILES := fdevent.cpp |
| 21 | LIBADB_WINDOWS_SRC_FILES := sysdeps_win32.c |
| 22 | |
| 23 | include $(CLEAR_VARS) |
| 24 | LOCAL_MODULE := libadbd |
| 25 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0 |
| 26 | LOCAL_SRC_FILES := $(LIBADB_SRC_FILES) $(LIBADB_LINUX_SRC_FILES) usb_linux_client.c |
| 27 | include $(BUILD_STATIC_LIBRARY) |
| 28 | |
Dan Albert | bbbbea6 | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 29 | include $(CLEAR_VARS) |
| 30 | LOCAL_MODULE := libadb |
Dan Albert | dfef94a | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 31 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1 |
| 32 | LOCAL_SRC_FILES := $(LIBADB_SRC_FILES) $(LIBADB_LINUX_SRC_FILES) |
Dan Albert | bbbbea6 | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 33 | include $(BUILD_STATIC_LIBRARY) |
| 34 | |
| 35 | include $(CLEAR_VARS) |
| 36 | LOCAL_MODULE := libadb |
| 37 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1 |
| 38 | LOCAL_SRC_FILES := $(LIBADB_SRC_FILES) |
| 39 | ifeq ($(HOST_OS),windows) |
Dan Albert | dfef94a | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 40 | LOCAL_SRC_FILES += $(LIBADB_WINDOWS_SRC_FILES) |
Dan Albert | bbbbea6 | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 41 | else |
Dan Albert | dfef94a | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 42 | LOCAL_SRC_FILES += $(LIBADB_LINUX_SRC_FILES) |
Dan Albert | bbbbea6 | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 43 | endif |
| 44 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 45 | |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 46 | # adb host tool |
| 47 | # ========================================================= |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 48 | include $(CLEAR_VARS) |
| 49 | |
| 50 | # Default to a virtual (sockets) usb interface |
| 51 | USB_SRCS := |
| 52 | EXTRA_SRCS := |
| 53 | |
| 54 | ifeq ($(HOST_OS),linux) |
| 55 | USB_SRCS := usb_linux.c |
| 56 | EXTRA_SRCS := get_my_path_linux.c |
Chih-Wei Huang | ed1107d | 2013-01-01 15:24:33 +0800 | [diff] [blame] | 57 | LOCAL_LDLIBS += -lrt -ldl -lpthread |
Benoit Goby | 12dc369 | 2013-02-20 15:04:53 -0800 | [diff] [blame] | 58 | LOCAL_CFLAGS += -DWORKAROUND_BUG6558362 |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 59 | endif |
| 60 | |
| 61 | ifeq ($(HOST_OS),darwin) |
| 62 | USB_SRCS := usb_osx.c |
| 63 | EXTRA_SRCS := get_my_path_darwin.c |
Benoit Goby | ed7bc3f | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 64 | LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon |
Tim Murray | ce2f106 | 2014-07-24 18:33:12 -0700 | [diff] [blame] | 65 | LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 66 | endif |
| 67 | |
| 68 | ifeq ($(HOST_OS),windows) |
| 69 | USB_SRCS := usb_windows.c |
Mark Salyzyn | bec305f | 2013-12-06 15:50:48 -0800 | [diff] [blame] | 70 | EXTRA_SRCS := get_my_path_windows.c |
Benoit Goby | ed7bc3f | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 71 | EXTRA_STATIC_LIBS := AdbWinApi |
Raphael | 173b0c6 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 72 | ifneq ($(strip $(USE_MINGW)),) |
| 73 | # MinGW under Linux case |
Benoit Goby | 2cc19e4 | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 74 | LOCAL_LDLIBS += -lws2_32 -lgdi32 |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 75 | USE_SYSDEPS_WIN32 := 1 |
| 76 | endif |
Raphael | 173b0c6 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 77 | LOCAL_C_INCLUDES += development/host/windows/usb/api/ |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 78 | endif |
| 79 | |
| 80 | LOCAL_SRC_FILES := \ |
| 81 | adb.c \ |
| 82 | console.c \ |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 83 | transport_local.c \ |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 84 | commandline.c \ |
| 85 | adb_client.c \ |
Benoit Goby | 2cc19e4 | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 86 | adb_auth_host.c \ |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 87 | sockets.c \ |
| 88 | services.c \ |
| 89 | file_sync_client.c \ |
| 90 | $(EXTRA_SRCS) \ |
| 91 | $(USB_SRCS) \ |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 92 | |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 93 | ifneq ($(USE_SYSDEPS_WIN32),) |
| 94 | LOCAL_SRC_FILES += sysdeps_win32.c |
| 95 | endif |
| 96 | |
Stephen Hines | e7c06ee | 2014-10-01 17:16:37 -0700 | [diff] [blame] | 97 | LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter -Werror |
Jack Palevich | 5563d52 | 2010-05-25 14:49:57 +0800 | [diff] [blame] | 98 | LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 99 | LOCAL_MODULE := adb |
Benoit Goby | 12dc369 | 2013-02-20 15:04:53 -0800 | [diff] [blame] | 100 | LOCAL_MODULE_TAGS := debug |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 101 | |
Dan Albert | bbbbea6 | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 102 | LOCAL_STATIC_LIBRARIES := \ |
| 103 | libadb \ |
| 104 | libzipfile \ |
Dan Albert | bbbbea6 | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 105 | libcrypto_static \ |
| 106 | $(EXTRA_STATIC_LIBS) \ |
| 107 | |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 108 | ifeq ($(USE_SYSDEPS_WIN32),) |
| 109 | LOCAL_STATIC_LIBRARIES += libcutils |
| 110 | endif |
| 111 | |
Christopher Ferris | d930691 | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 112 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 113 | include $(BUILD_HOST_EXECUTABLE) |
| 114 | |
Ying Wang | 9dc5069 | 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 | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 116 | |
| 117 | ifeq ($(HOST_OS),windows) |
Raphael | 121c4ec | 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 | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 121 | endif |
| 122 | |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 123 | |
| 124 | # adbd device daemon |
| 125 | # ========================================================= |
| 126 | |
The Android Open Source Project | 9ca14dc | 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 | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 131 | transport_local.c \ |
Benoit Goby | 2cc19e4 | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 132 | adb_auth_client.c \ |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 133 | sockets.c \ |
| 134 | services.c \ |
| 135 | file_sync_service.c \ |
| 136 | jdwp_service.c \ |
| 137 | framebuffer_service.c \ |
| 138 | remount_service.c \ |
Paul Lawrence | 8ba2b02 | 2014-12-03 15:31:57 -0800 | [diff] [blame] | 139 | set_verity_enable_state_service.c \ |
Mark Salyzyn | ea06716 | 2013-12-10 12:37:57 -0800 | [diff] [blame] | 140 | usb_linux_client.c |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 141 | |
Christopher Ferris | d930691 | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 142 | LOCAL_CFLAGS := \ |
| 143 | -O2 \ |
| 144 | -g \ |
| 145 | -DADB_HOST=0 \ |
| 146 | -D_XOPEN_SOURCE \ |
| 147 | -D_GNU_SOURCE \ |
| 148 | -Wall -Wno-unused-parameter -Werror -Wno-deprecated-declarations \ |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 149 | |
Nick Kralevich | 0926403 | 2012-01-19 13:11:35 -0800 | [diff] [blame] | 150 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
| 151 | LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 |
| 152 | endif |
| 153 | |
Paul Lawrence | 5f35648 | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 154 | ifneq (,$(filter userdebug,$(TARGET_BUILD_VARIANT))) |
| 155 | LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 |
| 156 | endif |
| 157 | |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 158 | LOCAL_MODULE := adbd |
| 159 | |
| 160 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
| 161 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) |
| 162 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) |
Dan Albert | 0ca996b | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 163 | LOCAL_C_INCLUDES += system/extras/ext4_utils system/core/fs_mgr/include |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 164 | |
Dan Albert | bbbbea6 | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 165 | LOCAL_STATIC_LIBRARIES := \ |
Dan Albert | dfef94a | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 166 | libadbd \ |
Dan Albert | 0ca996b | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 167 | libfs_mgr \ |
Dan Albert | bbbbea6 | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 168 | liblog \ |
| 169 | libcutils \ |
| 170 | libc \ |
| 171 | libmincrypt \ |
| 172 | libselinux \ |
Dan Albert | 0ca996b | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 173 | libext4_utils_static \ |
Paul Lawrence | 5f35648 | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 174 | |
Christopher Ferris | d930691 | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 175 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Paul Lawrence | 5f35648 | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 176 | |
Jeff Brown | f5287b7 | 2011-07-11 22:12:32 -0700 | [diff] [blame] | 177 | include $(BUILD_EXECUTABLE) |