Android.mk revision 66e4691ad097cfc37bdb7d3b1705ee9132f3234e
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# =========================================================
10ifneq ($(TARGET_SIMULATOR),true) # not 64 bit clean (also unused with the sim)
11include $(CLEAR_VARS)
12
13# Default to a virtual (sockets) usb interface
14USB_SRCS :=
15EXTRA_SRCS :=
16
17ifeq ($(HOST_OS),linux)
18  USB_SRCS := usb_linux.c
19  EXTRA_SRCS := get_my_path_linux.c
20  LOCAL_LDLIBS += -lrt -lncurses -lpthread
21endif
22
23ifeq ($(HOST_OS),darwin)
24  USB_SRCS := usb_osx.c
25  EXTRA_SRCS := get_my_path_darwin.c
26  LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
27endif
28
29ifeq ($(HOST_OS),windows)
30  USB_SRCS := usb_windows.c
31  EXTRA_SRCS := get_my_path_windows.c
32  EXTRA_STATIC_LIBS := AdbWinApi
33  LOCAL_C_INCLUDES += /usr/include/w32api/ddk development/host/windows/usb/api/
34  ifneq ($(strip $(USE_CYGWIN)),)
35    LOCAL_LDLIBS += -lpthread
36  else
37    LOCAL_LDLIBS += -lws2_32
38    USE_SYSDEPS_WIN32 := 1
39  endif
40endif
41
42LOCAL_SRC_FILES := \
43	adb.c \
44	console.c \
45	transport.c \
46	transport_local.c \
47	transport_usb.c \
48	commandline.c \
49	adb_client.c \
50	sockets.c \
51	services.c \
52	file_sync_client.c \
53	$(EXTRA_SRCS) \
54	$(USB_SRCS) \
55	shlist.c \
56	utils.c \
57	usb_vendors.c \
58
59
60ifneq ($(USE_SYSDEPS_WIN32),)
61  LOCAL_SRC_FILES += sysdeps_win32.c
62endif
63
64LOCAL_CFLAGS += -O2 -g -DADB_HOST=1  -Wall -Wno-unused-parameter
65LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE -DSH_HISTORY
66LOCAL_MODULE := adb
67
68LOCAL_STATIC_LIBRARIES := libzipfile libunz $(EXTRA_STATIC_LIBS)
69ifeq ($(USE_SYSDEPS_WIN32),)
70	LOCAL_STATIC_LIBRARIES += libcutils
71endif
72
73include $(BUILD_HOST_EXECUTABLE)
74
75$(call dist-for-goals,droid,$(LOCAL_BUILT_MODULE))
76
77ifeq ($(HOST_OS),windows)
78$(LOCAL_INSTALLED_MODULE): $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll
79endif
80
81endif
82
83# adbd device daemon
84# =========================================================
85
86# build adbd in all non-simulator builds
87BUILD_ADBD := false
88ifneq ($(TARGET_SIMULATOR),true)
89    BUILD_ADBD := true
90endif
91
92# build adbd for the Linux simulator build
93# so we can use it to test the adb USB gadget driver on x86
94ifeq ($(HOST_OS),linux)
95    BUILD_ADBD := true
96endif
97
98
99ifeq ($(BUILD_ADBD),true)
100include $(CLEAR_VARS)
101
102LOCAL_SRC_FILES := \
103	adb.c \
104	transport.c \
105	transport_local.c \
106	transport_usb.c \
107	sockets.c \
108	services.c \
109	file_sync_service.c \
110	jdwp_service.c \
111	framebuffer_service.c \
112	remount_service.c \
113	usb_linux_client.c \
114	log_service.c \
115	utils.c \
116
117LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter
118LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
119
120# TODO: This should probably be board specific, whether or not the kernel has
121# the gadget driver; rather than relying on the architecture type.
122ifeq ($(TARGET_ARCH),arm)
123LOCAL_CFLAGS += -DANDROID_GADGET=1
124endif
125
126LOCAL_MODULE := adbd
127
128LOCAL_FORCE_STATIC_EXECUTABLE := true
129LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
130LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
131
132ifeq ($(TARGET_SIMULATOR),true)
133  LOCAL_STATIC_LIBRARIES := libcutils
134  LOCAL_LDLIBS += -lpthread
135  include $(BUILD_HOST_EXECUTABLE)
136else
137  LOCAL_STATIC_LIBRARIES := libcutils libc
138  include $(BUILD_EXECUTABLE)
139endif
140
141endif
142