blob: 6cbaf82b86a1e384d3caf5cc7f2fbe618be4d626 [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001# 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# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080010include $(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),windows)
29 USB_SRCS := usb_windows.c
30 EXTRA_SRCS := get_my_path_windows.c
31 EXTRA_STATIC_LIBS := AdbWinApi
32 LOCAL_C_INCLUDES += /usr/include/w32api/ddk development/host/windows/usb/api/
33 ifneq ($(strip $(USE_CYGWIN)),)
34 LOCAL_LDLIBS += -lpthread
35 else
36 LOCAL_LDLIBS += -lws2_32
37 USE_SYSDEPS_WIN32 := 1
38 endif
39endif
40
41LOCAL_SRC_FILES := \
42 adb.c \
43 console.c \
44 transport.c \
45 transport_local.c \
46 transport_usb.c \
47 commandline.c \
48 adb_client.c \
49 sockets.c \
50 services.c \
51 file_sync_client.c \
52 $(EXTRA_SRCS) \
53 $(USB_SRCS) \
54 shlist.c \
55 utils.c \
56
57
58ifneq ($(USE_SYSDEPS_WIN32),)
59 LOCAL_SRC_FILES += sysdeps_win32.c
David 'Digit' Turner414ff7d2009-05-18 17:07:46 +020060else
61 LOCAL_SRC_FILES += fdevent.c
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080062endif
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
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080081
82# adbd device daemon
83# =========================================================
84
85# build adbd in all non-simulator builds
86BUILD_ADBD := false
87ifneq ($(TARGET_SIMULATOR),true)
88 BUILD_ADBD := true
89endif
90
91# build adbd for the Linux simulator build
92# so we can use it to test the adb USB gadget driver on x86
93ifeq ($(HOST_OS),linux)
94 BUILD_ADBD := true
95endif
96
97
98ifeq ($(BUILD_ADBD),true)
99include $(CLEAR_VARS)
100
101LOCAL_SRC_FILES := \
102 adb.c \
David 'Digit' Turner414ff7d2009-05-18 17:07:46 +0200103 fdevent.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800104 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