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 | |
| 8 | # adb host tool |
| 9 | # ========================================================= |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 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 -lncurses -lpthread |
| 20 | endif |
| 21 | |
| 22 | ifeq ($(HOST_OS),darwin) |
| 23 | USB_SRCS := usb_osx.c |
| 24 | EXTRA_SRCS := get_my_path_darwin.c |
| 25 | LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon |
| 26 | endif |
| 27 | |
Alexey Tarasov | 3b226f9 | 2009-10-25 01:37:37 +1100 | [diff] [blame] | 28 | ifeq ($(HOST_OS),freebsd) |
| 29 | USB_SRCS := usb_libusb.c |
| 30 | EXTRA_SRCS := get_my_path_freebsd.c |
| 31 | LOCAL_LDLIBS += -lpthread -lusb |
| 32 | endif |
| 33 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 34 | ifeq ($(HOST_OS),windows) |
| 35 | USB_SRCS := usb_windows.c |
| 36 | EXTRA_SRCS := get_my_path_windows.c |
| 37 | EXTRA_STATIC_LIBS := AdbWinApi |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 38 | ifneq ($(strip $(USE_CYGWIN)),) |
Raphael | b419c35 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 39 | # Pure cygwin case |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 40 | LOCAL_LDLIBS += -lpthread |
Raphael | b419c35 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 41 | LOCAL_C_INCLUDES += /usr/include/w32api/ddk |
| 42 | endif |
| 43 | ifneq ($(strip $(USE_MINGW)),) |
| 44 | # MinGW under Linux case |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 45 | LOCAL_LDLIBS += -lws2_32 |
| 46 | USE_SYSDEPS_WIN32 := 1 |
Raphael | b419c35 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 47 | LOCAL_C_INCLUDES += /usr/i586-mingw32msvc/include/ddk |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 48 | endif |
Raphael | b419c35 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 49 | LOCAL_C_INCLUDES += development/host/windows/usb/api/ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 50 | endif |
| 51 | |
| 52 | LOCAL_SRC_FILES := \ |
| 53 | adb.c \ |
| 54 | console.c \ |
| 55 | transport.c \ |
| 56 | transport_local.c \ |
| 57 | transport_usb.c \ |
| 58 | commandline.c \ |
| 59 | adb_client.c \ |
| 60 | sockets.c \ |
| 61 | services.c \ |
| 62 | file_sync_client.c \ |
| 63 | $(EXTRA_SRCS) \ |
| 64 | $(USB_SRCS) \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 65 | utils.c \ |
Raphael | 26f3de6 | 2009-08-11 11:08:45 -0700 | [diff] [blame] | 66 | usb_vendors.c |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 67 | |
| 68 | |
| 69 | ifneq ($(USE_SYSDEPS_WIN32),) |
| 70 | LOCAL_SRC_FILES += sysdeps_win32.c |
David 'Digit' Turner | 414ff7d | 2009-05-18 17:07:46 +0200 | [diff] [blame] | 71 | else |
| 72 | LOCAL_SRC_FILES += fdevent.c |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 73 | endif |
| 74 | |
| 75 | LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter |
Jack Palevich | 7fe202f | 2010-05-25 14:49:57 +0800 | [diff] [blame] | 76 | LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 77 | LOCAL_MODULE := adb |
| 78 | |
| 79 | LOCAL_STATIC_LIBRARIES := libzipfile libunz $(EXTRA_STATIC_LIBS) |
| 80 | ifeq ($(USE_SYSDEPS_WIN32),) |
| 81 | LOCAL_STATIC_LIBRARIES += libcutils |
| 82 | endif |
| 83 | |
| 84 | include $(BUILD_HOST_EXECUTABLE) |
| 85 | |
| 86 | $(call dist-for-goals,droid,$(LOCAL_BUILT_MODULE)) |
| 87 | |
| 88 | ifeq ($(HOST_OS),windows) |
Raphael | 26f3de6 | 2009-08-11 11:08:45 -0700 | [diff] [blame] | 89 | $(LOCAL_INSTALLED_MODULE): \ |
| 90 | $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \ |
| 91 | $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 92 | endif |
| 93 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 94 | |
| 95 | # adbd device daemon |
| 96 | # ========================================================= |
| 97 | |
| 98 | # build adbd in all non-simulator builds |
| 99 | BUILD_ADBD := false |
| 100 | ifneq ($(TARGET_SIMULATOR),true) |
| 101 | BUILD_ADBD := true |
| 102 | endif |
| 103 | |
| 104 | # build adbd for the Linux simulator build |
| 105 | # so we can use it to test the adb USB gadget driver on x86 |
Mike Lockwood | 63e6152 | 2009-08-06 10:58:00 -0400 | [diff] [blame] | 106 | #ifeq ($(HOST_OS),linux) |
| 107 | # BUILD_ADBD := true |
| 108 | #endif |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 109 | |
| 110 | |
| 111 | ifeq ($(BUILD_ADBD),true) |
| 112 | include $(CLEAR_VARS) |
| 113 | |
| 114 | LOCAL_SRC_FILES := \ |
| 115 | adb.c \ |
David 'Digit' Turner | 414ff7d | 2009-05-18 17:07:46 +0200 | [diff] [blame] | 116 | fdevent.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 117 | transport.c \ |
| 118 | transport_local.c \ |
| 119 | transport_usb.c \ |
| 120 | sockets.c \ |
| 121 | services.c \ |
| 122 | file_sync_service.c \ |
| 123 | jdwp_service.c \ |
| 124 | framebuffer_service.c \ |
| 125 | remount_service.c \ |
| 126 | usb_linux_client.c \ |
| 127 | log_service.c \ |
Raphael | 26f3de6 | 2009-08-11 11:08:45 -0700 | [diff] [blame] | 128 | utils.c |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 129 | |
| 130 | LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter |
| 131 | LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE |
| 132 | |
| 133 | # TODO: This should probably be board specific, whether or not the kernel has |
| 134 | # the gadget driver; rather than relying on the architecture type. |
| 135 | ifeq ($(TARGET_ARCH),arm) |
| 136 | LOCAL_CFLAGS += -DANDROID_GADGET=1 |
| 137 | endif |
| 138 | |
| 139 | LOCAL_MODULE := adbd |
| 140 | |
| 141 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
| 142 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) |
| 143 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) |
| 144 | |
| 145 | ifeq ($(TARGET_SIMULATOR),true) |
| 146 | LOCAL_STATIC_LIBRARIES := libcutils |
| 147 | LOCAL_LDLIBS += -lpthread |
| 148 | include $(BUILD_HOST_EXECUTABLE) |
| 149 | else |
| 150 | LOCAL_STATIC_LIBRARIES := libcutils libc |
| 151 | include $(BUILD_EXECUTABLE) |
| 152 | endif |
| 153 | |
| 154 | endif |