blob: 8ebcbf0d207c881412c1e030a509b33daacdcd30 [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
Tim Murray1efcdef2014-07-24 18:33:12 -070027 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080028endif
29
Alexey Tarasov3b226f92009-10-25 01:37:37 +110030ifeq ($(HOST_OS),freebsd)
31 USB_SRCS := usb_libusb.c
32 EXTRA_SRCS := get_my_path_freebsd.c
33 LOCAL_LDLIBS += -lpthread -lusb
34endif
35
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080036ifeq ($(HOST_OS),windows)
37 USB_SRCS := usb_windows.c
Mark Salyzync7882782013-12-06 15:50:48 -080038 EXTRA_SRCS := get_my_path_windows.c
Benoit Goby345ca132012-08-31 17:44:27 -070039 EXTRA_STATIC_LIBS := AdbWinApi
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080040 ifneq ($(strip $(USE_CYGWIN)),)
Raphaelfab16782010-04-13 15:25:50 -070041 # Pure cygwin case
Benoit Gobyd5fcafa2012-04-12 12:23:49 -070042 LOCAL_LDLIBS += -lpthread -lgdi32
Raphaelfab16782010-04-13 15:25:50 -070043 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
48 endif
Raphaelfab16782010-04-13 15:25:50 -070049 LOCAL_C_INCLUDES += development/host/windows/usb/api/
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080050endif
51
52LOCAL_SRC_FILES := \
53 adb.c \
54 console.c \
55 transport.c \
56 transport_local.c \
57 transport_usb.c \
58 commandline.c \
59 adb_client.c \
Benoit Gobyd5fcafa2012-04-12 12:23:49 -070060 adb_auth_host.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080061 sockets.c \
62 services.c \
63 file_sync_client.c \
64 $(EXTRA_SRCS) \
65 $(USB_SRCS) \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080066
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080067ifneq ($(USE_SYSDEPS_WIN32),)
68 LOCAL_SRC_FILES += sysdeps_win32.c
David 'Digit' Turner414ff7d2009-05-18 17:07:46 +020069else
70 LOCAL_SRC_FILES += fdevent.c
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080071endif
72
Stephen Hines3ea87c32014-10-01 17:16:37 -070073LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter -Werror
Jack Palevich7fe202f2010-05-25 14:49:57 +080074LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080075LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -070076LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080077
Trevor Drakeb79a2d52014-12-07 15:13:29 +000078LOCAL_STATIC_LIBRARIES := libzipfile libz libcrypto_static $(EXTRA_STATIC_LIBS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080079ifeq ($(USE_SYSDEPS_WIN32),)
80 LOCAL_STATIC_LIBRARIES += libcutils
81endif
82
Christopher Ferris51448eb2014-09-03 19:48:48 -070083LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080084include $(BUILD_HOST_EXECUTABLE)
85
Ying Wang96535ba2012-09-05 10:26:43 -070086$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080087
88ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -070089$(LOCAL_INSTALLED_MODULE): \
90 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
91 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080092endif
93
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080094
95# adbd device daemon
96# =========================================================
97
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080098include $(CLEAR_VARS)
99
100LOCAL_SRC_FILES := \
101 adb.c \
David 'Digit' Turner414ff7d2009-05-18 17:07:46 +0200102 fdevent.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800103 transport.c \
104 transport_local.c \
105 transport_usb.c \
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700106 adb_auth_client.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800107 sockets.c \
108 services.c \
109 file_sync_service.c \
110 jdwp_service.c \
111 framebuffer_service.c \
112 remount_service.c \
Paul Lawrence982089d2014-12-03 15:31:57 -0800113 set_verity_enable_state_service.c \
Mark Salyzyn7aa39a72013-12-10 12:37:57 -0800114 usb_linux_client.c
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800115
Christopher Ferris51448eb2014-09-03 19:48:48 -0700116LOCAL_CFLAGS := \
117 -O2 \
118 -g \
119 -DADB_HOST=0 \
120 -D_XOPEN_SOURCE \
121 -D_GNU_SOURCE \
122 -Wall -Wno-unused-parameter -Werror -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800123
Nick Kralevich5890fe32012-01-19 13:11:35 -0800124ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
125LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
126endif
127
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000128ifneq (,$(filter userdebug,$(TARGET_BUILD_VARIANT)))
129LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
130endif
131
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800132LOCAL_MODULE := adbd
133
134LOCAL_FORCE_STATIC_EXECUTABLE := true
135LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
136LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000137LOCAL_C_INCLUDES += system/extras/ext4_utils system/core/fs_mgr/include
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800138
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000139LOCAL_STATIC_LIBRARIES := liblog \
140 libfs_mgr \
141 libcutils \
142 libc \
143 libmincrypt \
144 libselinux \
145 libext4_utils_static
146
Christopher Ferris51448eb2014-09-03 19:48:48 -0700147LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000148
Jeff Brown29e1e732011-07-11 22:12:32 -0700149include $(BUILD_EXECUTABLE)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800150
John Michelauc3188332010-09-23 17:08:34 -0500151
152# adb host tool for device-as-host
153# =========================================================
Benoit Gobydff02372010-10-06 18:30:55 -0700154ifneq ($(SDK_ONLY),true)
John Michelauc3188332010-09-23 17:08:34 -0500155include $(CLEAR_VARS)
156
John Michelauc3188332010-09-23 17:08:34 -0500157LOCAL_SRC_FILES := \
158 adb.c \
159 console.c \
160 transport.c \
161 transport_local.c \
162 transport_usb.c \
163 commandline.c \
164 adb_client.c \
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700165 adb_auth_host.c \
John Michelauc3188332010-09-23 17:08:34 -0500166 sockets.c \
167 services.c \
168 file_sync_client.c \
169 get_my_path_linux.c \
170 usb_linux.c \
John Michelauc3188332010-09-23 17:08:34 -0500171 fdevent.c
172
173LOCAL_CFLAGS := \
174 -O2 \
175 -g \
176 -DADB_HOST=1 \
177 -DADB_HOST_ON_TARGET=1 \
Mark Salyzyn60299df2014-04-30 09:10:31 -0700178 -Wall -Wno-unused-parameter -Werror \
John Michelauc3188332010-09-23 17:08:34 -0500179 -D_XOPEN_SOURCE \
180 -D_GNU_SOURCE
181
182LOCAL_MODULE := adb
183
Trevor Drakeb79a2d52014-12-07 15:13:29 +0000184LOCAL_STATIC_LIBRARIES := libzipfile libz libcutils liblog
John Michelauc3188332010-09-23 17:08:34 -0500185
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700186LOCAL_SHARED_LIBRARIES := libcrypto
187
Christopher Ferris51448eb2014-09-03 19:48:48 -0700188LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
John Michelauc3188332010-09-23 17:08:34 -0500189include $(BUILD_EXECUTABLE)
Benoit Gobycb56b712010-10-06 17:11:59 -0700190endif