Android.mk revision d2f5415c603f7d9961f7a0b05579a0768e071410
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
83
84include $(BUILD_HOST_EXECUTABLE)
85
86$(call dist-for-goals,dist_files,$(LOCAL_BUILT_MODULE))
87
88ifeq ($(HOST_OS),windows)
89$(LOCAL_INSTALLED_MODULE): \
90    $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
91    $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
92endif
93
94
95# adbd device daemon
96# =========================================================
97
98# build adbd in all non-simulator builds
99BUILD_ADBD := false
100ifneq ($(TARGET_SIMULATOR),true)
101    BUILD_ADBD := true
102endif
103
104# build adbd for the Linux simulator build
105# so we can use it to test the adb USB gadget driver on x86
106#ifeq ($(HOST_OS),linux)
107#    BUILD_ADBD := true
108#endif
109
110
111ifeq ($(BUILD_ADBD),true)
112include $(CLEAR_VARS)
113
114LOCAL_SRC_FILES := \
115	adb.c \
116	backup_service.c \
117	fdevent.c \
118	transport.c \
119	transport_local.c \
120	transport_usb.c \
121	sockets.c \
122	services.c \
123	file_sync_service.c \
124	jdwp_service.c \
125	framebuffer_service.c \
126	remount_service.c \
127	usb_linux_client.c \
128	log_service.c \
129	utils.c
130
131LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter
132LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
133
134# TODO: This should probably be board specific, whether or not the kernel has
135# the gadget driver; rather than relying on the architecture type.
136ifeq ($(TARGET_ARCH),arm)
137LOCAL_CFLAGS += -DANDROID_GADGET=1
138endif
139
140LOCAL_MODULE := adbd
141
142LOCAL_FORCE_STATIC_EXECUTABLE := true
143LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
144LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
145
146ifeq ($(TARGET_SIMULATOR),true)
147  LOCAL_STATIC_LIBRARIES := libcutils
148  LOCAL_LDLIBS += -lpthread
149  include $(BUILD_HOST_EXECUTABLE)
150else
151  LOCAL_STATIC_LIBRARIES := libcutils libc
152  include $(BUILD_EXECUTABLE)
153endif
154
155endif
156
157
158# adb host tool for device-as-host
159# =========================================================
160ifneq ($(TARGET_SIMULATOR),true)
161ifneq ($(SDK_ONLY),true)
162include $(CLEAR_VARS)
163
164LOCAL_LDLIBS := -lrt -lncurses -lpthread
165
166LOCAL_SRC_FILES := \
167	adb.c \
168	backup_service.c \
169	console.c \
170	transport.c \
171	transport_local.c \
172	transport_usb.c \
173	commandline.c \
174	adb_client.c \
175	sockets.c \
176	services.c \
177	file_sync_client.c \
178	get_my_path_linux.c \
179	usb_linux.c \
180	utils.c \
181	usb_vendors.c \
182	fdevent.c
183
184LOCAL_CFLAGS := \
185	-O2 \
186	-g \
187	-DADB_HOST=1 \
188	-DADB_HOST_ON_TARGET=1 \
189	-Wall \
190	-Wno-unused-parameter \
191	-D_XOPEN_SOURCE \
192	-D_GNU_SOURCE
193
194LOCAL_MODULE := adb
195
196LOCAL_STATIC_LIBRARIES := libzipfile libunz libcutils
197
198include $(BUILD_EXECUTABLE)
199endif
200endif
201