Android.mk revision d7249c45f6c245652de7c510d450f4577dc19197
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 shlist.c \ 66 utils.c \ 67 usb_vendors.c 68 69 70ifneq ($(USE_SYSDEPS_WIN32),) 71 LOCAL_SRC_FILES += sysdeps_win32.c 72else 73 LOCAL_SRC_FILES += fdevent.c 74endif 75 76LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter 77LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE -DSH_HISTORY 78LOCAL_MODULE := adb 79 80LOCAL_STATIC_LIBRARIES := libzipfile libunz $(EXTRA_STATIC_LIBS) 81ifeq ($(USE_SYSDEPS_WIN32),) 82 LOCAL_STATIC_LIBRARIES += libcutils 83endif 84ifeq ($(HOST_OS),linux) 85 LOCAL_STATIC_LIBRARIES += libusbhost 86endif 87 88include $(BUILD_HOST_EXECUTABLE) 89 90$(call dist-for-goals,droid,$(LOCAL_BUILT_MODULE)) 91 92ifeq ($(HOST_OS),windows) 93$(LOCAL_INSTALLED_MODULE): \ 94 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \ 95 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll 96endif 97 98 99# adbd device daemon 100# ========================================================= 101 102# build adbd in all non-simulator builds 103BUILD_ADBD := false 104ifneq ($(TARGET_SIMULATOR),true) 105 BUILD_ADBD := true 106endif 107 108# build adbd for the Linux simulator build 109# so we can use it to test the adb USB gadget driver on x86 110#ifeq ($(HOST_OS),linux) 111# BUILD_ADBD := true 112#endif 113 114 115ifeq ($(BUILD_ADBD),true) 116include $(CLEAR_VARS) 117 118LOCAL_SRC_FILES := \ 119 adb.c \ 120 fdevent.c \ 121 transport.c \ 122 transport_local.c \ 123 transport_usb.c \ 124 sockets.c \ 125 services.c \ 126 file_sync_service.c \ 127 jdwp_service.c \ 128 framebuffer_service.c \ 129 remount_service.c \ 130 usb_linux_client.c \ 131 log_service.c \ 132 utils.c 133 134LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter 135LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE 136 137# TODO: This should probably be board specific, whether or not the kernel has 138# the gadget driver; rather than relying on the architecture type. 139ifeq ($(TARGET_ARCH),arm) 140LOCAL_CFLAGS += -DANDROID_GADGET=1 141endif 142 143LOCAL_MODULE := adbd 144 145LOCAL_FORCE_STATIC_EXECUTABLE := true 146LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) 147LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) 148 149ifeq ($(TARGET_SIMULATOR),true) 150 LOCAL_STATIC_LIBRARIES := libcutils 151 LOCAL_LDLIBS += -lpthread 152 include $(BUILD_HOST_EXECUTABLE) 153else 154 LOCAL_STATIC_LIBRARIES := libcutils libc 155 include $(BUILD_EXECUTABLE) 156endif 157 158endif 159