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