blob: d6bda332d37c9d5c3a8b4cbc6e77129305e5acc2 [file] [log] [blame]
The Android Open Source Project9ca14dc2009-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 Project9ca14dc2009-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 \
Xavier Ducrohet2ef5fc22009-05-20 17:33:53 -070056 usb_vendors.c \
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080057
58
59ifneq ($(USE_SYSDEPS_WIN32),)
60 LOCAL_SRC_FILES += sysdeps_win32.c
David 'Digit' Turnerb1c2c952009-05-18 17:07:46 +020061else
62 LOCAL_SRC_FILES += fdevent.c
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080063endif
64
65LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter
66LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE -DSH_HISTORY
67LOCAL_MODULE := adb
68
69LOCAL_STATIC_LIBRARIES := libzipfile libunz $(EXTRA_STATIC_LIBS)
70ifeq ($(USE_SYSDEPS_WIN32),)
71 LOCAL_STATIC_LIBRARIES += libcutils
72endif
73
74include $(BUILD_HOST_EXECUTABLE)
75
76$(call dist-for-goals,droid,$(LOCAL_BUILT_MODULE))
77
78ifeq ($(HOST_OS),windows)
79$(LOCAL_INSTALLED_MODULE): $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll
80endif
81
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080082
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
Mike Lockwood853a6d82009-08-06 10:58:00 -040094#ifeq ($(HOST_OS),linux)
95# BUILD_ADBD := true
96#endif
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080097
98
99ifeq ($(BUILD_ADBD),true)
100include $(CLEAR_VARS)
101
102LOCAL_SRC_FILES := \
103 adb.c \
David 'Digit' Turnerb1c2c952009-05-18 17:07:46 +0200104 fdevent.c \
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -0800105 transport.c \
106 transport_local.c \
107 transport_usb.c \
108 sockets.c \
109 services.c \
110 file_sync_service.c \
111 jdwp_service.c \
112 framebuffer_service.c \
113 remount_service.c \
114 usb_linux_client.c \
115 log_service.c \
116 utils.c \
117
118LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter
119LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
120
121# TODO: This should probably be board specific, whether or not the kernel has
122# the gadget driver; rather than relying on the architecture type.
123ifeq ($(TARGET_ARCH),arm)
124LOCAL_CFLAGS += -DANDROID_GADGET=1
125endif
126
127LOCAL_MODULE := adbd
128
129LOCAL_FORCE_STATIC_EXECUTABLE := true
130LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
131LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
132
133ifeq ($(TARGET_SIMULATOR),true)
134 LOCAL_STATIC_LIBRARIES := libcutils
135 LOCAL_LDLIBS += -lpthread
136 include $(BUILD_HOST_EXECUTABLE)
137else
138 LOCAL_STATIC_LIBRARIES := libcutils libc
139 include $(BUILD_EXECUTABLE)
140endif
141
142endif