1 # Copyright 2005 The Android Open Source Project 2 # 3 # Android.mk for adb 4 # 5 6 LOCAL_PATH:= $(call my-dir) 7 8 # adb host tool 9 # ========================================================= 10 include $(CLEAR_VARS) 11 12 # Default to a virtual (sockets) usb interface 13 USB_SRCS := 14 EXTRA_SRCS := 15 16 ifeq ($(HOST_OS),linux) 17 USB_SRCS := usb_linux.c 18 EXTRA_SRCS := get_my_path_linux.c 19 LOCAL_LDLIBS += -lrt -ldl -lpthread 20 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362 21 endif 22 23 ifeq ($(HOST_OS),darwin) 24 USB_SRCS := usb_osx.c 25 EXTRA_SRCS := get_my_path_darwin.c 26 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon 27 endif 28 29 ifeq ($(HOST_OS),freebsd) 30 USB_SRCS := usb_libusb.c 31 EXTRA_SRCS := get_my_path_freebsd.c 32 LOCAL_LDLIBS += -lpthread -lusb 33 endif 34 35 ifeq ($(HOST_OS),windows) 36 USB_SRCS := usb_windows.c 37 EXTRA_SRCS := get_my_path_windows.c ../libcutils/list.c 38 EXTRA_STATIC_LIBS := AdbWinApi 39 ifneq ($(strip $(USE_CYGWIN)),) 40 # Pure cygwin case 41 LOCAL_LDLIBS += -lpthread -lgdi32 42 LOCAL_C_INCLUDES += /usr/include/w32api/ddk 43 endif 44 ifneq ($(strip $(USE_MINGW)),) 45 # MinGW under Linux case 46 LOCAL_LDLIBS += -lws2_32 -lgdi32 47 USE_SYSDEPS_WIN32 := 1 48 LOCAL_C_INCLUDES += /usr/i586-mingw32msvc/include/ddk 49 endif 50 LOCAL_C_INCLUDES += development/host/windows/usb/api/ 51 endif 52 53 LOCAL_SRC_FILES := \ 54 adb.c \ 55 console.c \ 56 transport.c \ 57 transport_local.c \ 58 transport_usb.c \ 59 commandline.c \ 60 adb_client.c \ 61 adb_auth_host.c \ 62 sockets.c \ 63 services.c \ 64 file_sync_client.c \ 65 $(EXTRA_SRCS) \ 66 $(USB_SRCS) \ 67 usb_vendors.c 68 69 LOCAL_C_INCLUDES += external/openssl/include 70 71 ifneq ($(USE_SYSDEPS_WIN32),) 72 LOCAL_SRC_FILES += sysdeps_win32.c 73 else 74 LOCAL_SRC_FILES += fdevent.c 75 endif 76 77 LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter 78 LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE 79 LOCAL_MODULE := adb 80 LOCAL_MODULE_TAGS := debug 81 82 LOCAL_STATIC_LIBRARIES := libzipfile libunz libcrypto_static $(EXTRA_STATIC_LIBS) 83 ifeq ($(USE_SYSDEPS_WIN32),) 84 LOCAL_STATIC_LIBRARIES += libcutils 85 endif 86 87 include $(BUILD_HOST_EXECUTABLE) 88 89 $(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE)) 90 91 ifeq ($(HOST_OS),windows) 92 $(LOCAL_INSTALLED_MODULE): \ 93 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \ 94 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll 95 endif 96 97 98 # adbd device daemon 99 # ========================================================= 100 101 include $(CLEAR_VARS) 102 103 LOCAL_SRC_FILES := \ 104 adb.c \ 105 backup_service.c \ 106 fdevent.c \ 107 transport.c \ 108 transport_local.c \ 109 transport_usb.c \ 110 adb_auth_client.c \ 111 sockets.c \ 112 services.c \ 113 file_sync_service.c \ 114 jdwp_service.c \ 115 framebuffer_service.c \ 116 remount_service.c \ 117 usb_linux_client.c \ 118 log_service.c 119 120 LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter 121 LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE 122 123 ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 124 LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 125 endif 126 127 LOCAL_MODULE := adbd 128 129 LOCAL_FORCE_STATIC_EXECUTABLE := true 130 LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) 131 LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) 132 133 LOCAL_STATIC_LIBRARIES := liblog libcutils libc libmincrypt 134 include $(BUILD_EXECUTABLE) 135 136 137 # adb host tool for device-as-host 138 # ========================================================= 139 ifneq ($(SDK_ONLY),true) 140 include $(CLEAR_VARS) 141 142 LOCAL_LDLIBS := -lrt -ldl -lpthread 143 144 LOCAL_SRC_FILES := \ 145 adb.c \ 146 console.c \ 147 transport.c \ 148 transport_local.c \ 149 transport_usb.c \ 150 commandline.c \ 151 adb_client.c \ 152 adb_auth_host.c \ 153 sockets.c \ 154 services.c \ 155 file_sync_client.c \ 156 get_my_path_linux.c \ 157 usb_linux.c \ 158 usb_vendors.c \ 159 fdevent.c 160 161 LOCAL_CFLAGS := \ 162 -O2 \ 163 -g \ 164 -DADB_HOST=1 \ 165 -DADB_HOST_ON_TARGET=1 \ 166 -Wall \ 167 -Wno-unused-parameter \ 168 -D_XOPEN_SOURCE \ 169 -D_GNU_SOURCE 170 171 LOCAL_C_INCLUDES += external/openssl/include 172 173 LOCAL_MODULE := adb 174 175 LOCAL_STATIC_LIBRARIES := libzipfile libunz libcutils 176 177 LOCAL_SHARED_LIBRARIES := libcrypto 178 179 include $(BUILD_EXECUTABLE) 180 endif 181