Android.mk revision b0e270fd2403532500e6ee6bb4021e4c7a9944bd
1# Copyright 2005 The Android Open Source Project 2# 3# Android.mk for adb 4# 5 6LOCAL_PATH:= $(call my-dir) 7 8# adb host tool 9# ========================================================= 10include $(CLEAR_VARS) 11 12# Default to a virtual (sockets) usb interface 13USB_SRCS := 14EXTRA_SRCS := 15 16ifeq ($(HOST_OS),linux) 17 USB_SRCS := usb_linux.c 18 EXTRA_SRCS := get_my_path_linux.c 19 LOCAL_LDLIBS += -lrt -lncurses -lpthread 20endif 21 22ifeq ($(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 26endif 27 28ifeq ($(HOST_OS),freebsd) 29 USB_SRCS := usb_libusb.c 30 EXTRA_SRCS := get_my_path_freebsd.c 31 LOCAL_LDLIBS += -lpthread -lusb 32endif 33 34ifeq ($(HOST_OS),windows) 35 USB_SRCS := usb_windows.c 36 EXTRA_SRCS := get_my_path_windows.c 37 EXTRA_STATIC_LIBS := AdbWinApi 38 ifneq ($(strip $(USE_CYGWIN)),) 39 # Pure cygwin case 40 LOCAL_LDLIBS += -lpthread 41 LOCAL_C_INCLUDES += /usr/include/w32api/ddk 42 endif 43 ifneq ($(strip $(USE_MINGW)),) 44 # MinGW under Linux case 45 LOCAL_LDLIBS += -lws2_32 46 USE_SYSDEPS_WIN32 := 1 47 LOCAL_C_INCLUDES += /usr/i586-mingw32msvc/include/ddk 48 endif 49 LOCAL_C_INCLUDES += development/host/windows/usb/api/ 50endif 51 52LOCAL_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) \ 65 utils.c \ 66 usb_vendors.c 67 68 69ifneq ($(USE_SYSDEPS_WIN32),) 70 LOCAL_SRC_FILES += sysdeps_win32.c 71else 72 LOCAL_SRC_FILES += fdevent.c 73endif 74 75LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter 76LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE 77LOCAL_MODULE := adb 78 79LOCAL_STATIC_LIBRARIES := libzipfile libunz $(EXTRA_STATIC_LIBS) 80ifeq ($(USE_SYSDEPS_WIN32),) 81 LOCAL_STATIC_LIBRARIES += libcutils 82endif 83ifeq ($(HOST_OS),linux) 84 LOCAL_STATIC_LIBRARIES += libusbhost 85endif 86 87include $(BUILD_HOST_EXECUTABLE) 88 89$(call dist-for-goals,droid,$(LOCAL_BUILT_MODULE)) 90 91ifeq ($(HOST_OS),windows) 92$(LOCAL_INSTALLED_MODULE): \ 93 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \ 94 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll 95endif 96 97 98# adbd device daemon 99# ========================================================= 100 101# build adbd in all non-simulator builds 102BUILD_ADBD := false 103ifneq ($(TARGET_SIMULATOR),true) 104 BUILD_ADBD := true 105endif 106 107# build adbd for the Linux simulator build 108# so we can use it to test the adb USB gadget driver on x86 109#ifeq ($(HOST_OS),linux) 110# BUILD_ADBD := true 111#endif 112 113 114ifeq ($(BUILD_ADBD),true) 115include $(CLEAR_VARS) 116 117LOCAL_SRC_FILES := \ 118 adb.c \ 119 fdevent.c \ 120 transport.c \ 121 transport_local.c \ 122 transport_usb.c \ 123 sockets.c \ 124 services.c \ 125 file_sync_service.c \ 126 jdwp_service.c \ 127 framebuffer_service.c \ 128 remount_service.c \ 129 usb_linux_client.c \ 130 log_service.c \ 131 utils.c 132 133LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter 134LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE 135 136# TODO: This should probably be board specific, whether or not the kernel has 137# the gadget driver; rather than relying on the architecture type. 138ifeq ($(TARGET_ARCH),arm) 139LOCAL_CFLAGS += -DANDROID_GADGET=1 140endif 141 142LOCAL_MODULE := adbd 143 144LOCAL_FORCE_STATIC_EXECUTABLE := true 145LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) 146LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) 147 148ifeq ($(TARGET_SIMULATOR),true) 149 LOCAL_STATIC_LIBRARIES := libcutils 150 LOCAL_LDLIBS += -lpthread 151 include $(BUILD_HOST_EXECUTABLE) 152else 153 LOCAL_STATIC_LIBRARIES := libcutils libc 154 include $(BUILD_EXECUTABLE) 155endif 156 157endif 158