blob: 721b48d5a5a323f0860a909344128db720f9e6a5 [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
Chih-Wei Huang9c607552013-01-01 15:24:33 +080019 LOCAL_LDLIBS += -lrt -ldl -lpthread
JP Abgrall571c1362012-12-06 18:18:12 -080020 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080021endif
22
23ifeq ($(HOST_OS),darwin)
24 USB_SRCS := usb_osx.c
25 EXTRA_SRCS := get_my_path_darwin.c
Benoit Goby345ca132012-08-31 17:44:27 -070026 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080027endif
28
Alexey Tarasov3b226f92009-10-25 01:37:37 +110029ifeq ($(HOST_OS),freebsd)
30 USB_SRCS := usb_libusb.c
31 EXTRA_SRCS := get_my_path_freebsd.c
32 LOCAL_LDLIBS += -lpthread -lusb
33endif
34
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080035ifeq ($(HOST_OS),windows)
36 USB_SRCS := usb_windows.c
Benoit Gobyd5fcafa2012-04-12 12:23:49 -070037 EXTRA_SRCS := get_my_path_windows.c ../libcutils/list.c
Benoit Goby345ca132012-08-31 17:44:27 -070038 EXTRA_STATIC_LIBS := AdbWinApi
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080039 ifneq ($(strip $(USE_CYGWIN)),)
Raphaelfab16782010-04-13 15:25:50 -070040 # Pure cygwin case
Benoit Gobyd5fcafa2012-04-12 12:23:49 -070041 LOCAL_LDLIBS += -lpthread -lgdi32
Raphaelfab16782010-04-13 15:25:50 -070042 LOCAL_C_INCLUDES += /usr/include/w32api/ddk
43 endif
44 ifneq ($(strip $(USE_MINGW)),)
45 # MinGW under Linux case
Benoit Gobyd5fcafa2012-04-12 12:23:49 -070046 LOCAL_LDLIBS += -lws2_32 -lgdi32
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080047 USE_SYSDEPS_WIN32 := 1
Raphaelfab16782010-04-13 15:25:50 -070048 LOCAL_C_INCLUDES += /usr/i586-mingw32msvc/include/ddk
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080049 endif
Raphaelfab16782010-04-13 15:25:50 -070050 LOCAL_C_INCLUDES += development/host/windows/usb/api/
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080051endif
52
53LOCAL_SRC_FILES := \
54 adb.c \
55 console.c \
56 transport.c \
57 transport_local.c \
58 transport_usb.c \
59 commandline.c \
60 adb_client.c \
Benoit Gobyd5fcafa2012-04-12 12:23:49 -070061 adb_auth_host.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080062 sockets.c \
63 services.c \
64 file_sync_client.c \
65 $(EXTRA_SRCS) \
66 $(USB_SRCS) \
Raphael26f3de62009-08-11 11:08:45 -070067 usb_vendors.c
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080068
Benoit Gobyd5fcafa2012-04-12 12:23:49 -070069LOCAL_C_INCLUDES += external/openssl/include
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080070
71ifneq ($(USE_SYSDEPS_WIN32),)
72 LOCAL_SRC_FILES += sysdeps_win32.c
David 'Digit' Turner414ff7d2009-05-18 17:07:46 +020073else
74 LOCAL_SRC_FILES += fdevent.c
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080075endif
76
77LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter
Jack Palevich7fe202f2010-05-25 14:49:57 +080078LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080079LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -070080LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080081
Benoit Goby345ca132012-08-31 17:44:27 -070082LOCAL_STATIC_LIBRARIES := libzipfile libunz libcrypto_static $(EXTRA_STATIC_LIBS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080083ifeq ($(USE_SYSDEPS_WIN32),)
84 LOCAL_STATIC_LIBRARIES += libcutils
85endif
86
87include $(BUILD_HOST_EXECUTABLE)
88
Ying Wang96535ba2012-09-05 10:26:43 -070089$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080090
91ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -070092$(LOCAL_INSTALLED_MODULE): \
93 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
94 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080095endif
96
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080097
98# adbd device daemon
99# =========================================================
100
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800101include $(CLEAR_VARS)
102
103LOCAL_SRC_FILES := \
104 adb.c \
Christopher Tated2f54152011-04-21 12:53:28 -0700105 backup_service.c \
David 'Digit' Turner414ff7d2009-05-18 17:07:46 +0200106 fdevent.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800107 transport.c \
108 transport_local.c \
109 transport_usb.c \
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700110 adb_auth_client.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800111 sockets.c \
112 services.c \
113 file_sync_service.c \
114 jdwp_service.c \
115 framebuffer_service.c \
116 remount_service.c \
117 usb_linux_client.c \
Benoit Goby9470c2f2013-02-20 15:04:53 -0800118 log_service.c
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800119
120LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter
121LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
122
Nick Kralevich5890fe32012-01-19 13:11:35 -0800123ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
124LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
125endif
126
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800127LOCAL_MODULE := adbd
128
129LOCAL_FORCE_STATIC_EXECUTABLE := true
130LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
131LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
132
Colin Cross9227bd32013-07-23 16:59:20 -0700133LOCAL_STATIC_LIBRARIES := liblog libcutils libc libmincrypt
Jeff Brown29e1e732011-07-11 22:12:32 -0700134include $(BUILD_EXECUTABLE)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800135
John Michelauc3188332010-09-23 17:08:34 -0500136
137# adb host tool for device-as-host
138# =========================================================
Benoit Gobydff02372010-10-06 18:30:55 -0700139ifneq ($(SDK_ONLY),true)
John Michelauc3188332010-09-23 17:08:34 -0500140include $(CLEAR_VARS)
141
Chih-Wei Huang9c607552013-01-01 15:24:33 +0800142LOCAL_LDLIBS := -lrt -ldl -lpthread
John Michelauc3188332010-09-23 17:08:34 -0500143
144LOCAL_SRC_FILES := \
145 adb.c \
146 console.c \
147 transport.c \
148 transport_local.c \
149 transport_usb.c \
150 commandline.c \
151 adb_client.c \
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700152 adb_auth_host.c \
John Michelauc3188332010-09-23 17:08:34 -0500153 sockets.c \
154 services.c \
155 file_sync_client.c \
156 get_my_path_linux.c \
157 usb_linux.c \
John Michelauc3188332010-09-23 17:08:34 -0500158 usb_vendors.c \
159 fdevent.c
160
161LOCAL_CFLAGS := \
162 -O2 \
163 -g \
164 -DADB_HOST=1 \
165 -DADB_HOST_ON_TARGET=1 \
166 -Wall \
167 -Wno-unused-parameter \
168 -D_XOPEN_SOURCE \
169 -D_GNU_SOURCE
170
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700171LOCAL_C_INCLUDES += external/openssl/include
172
John Michelauc3188332010-09-23 17:08:34 -0500173LOCAL_MODULE := adb
174
175LOCAL_STATIC_LIBRARIES := libzipfile libunz libcutils
176
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700177LOCAL_SHARED_LIBRARIES := libcrypto
178
John Michelauc3188332010-09-23 17:08:34 -0500179include $(BUILD_EXECUTABLE)
Benoit Gobycb56b712010-10-06 17:11:59 -0700180endif