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