2009-03-04 04:32:55 +01:00
|
|
|
# Copyright 2005 The Android Open Source Project
|
|
|
|
#
|
|
|
|
# Android.mk for adb
|
|
|
|
#
|
|
|
|
|
|
|
|
LOCAL_PATH:= $(call my-dir)
|
|
|
|
|
2015-04-19 22:17:01 +02:00
|
|
|
ifeq ($(HOST_OS),windows)
|
2015-05-05 23:50:09 +02:00
|
|
|
adb_host_clang := false # libc++ for mingw not ready yet.
|
2015-04-19 22:17:01 +02:00
|
|
|
else
|
2015-05-05 23:50:09 +02:00
|
|
|
adb_host_clang := true
|
2015-04-19 22:17:01 +02:00
|
|
|
endif
|
2015-02-21 02:28:44 +01:00
|
|
|
|
2015-07-30 19:25:32 +02:00
|
|
|
adb_host_sanitize :=
|
|
|
|
adb_target_sanitize :=
|
|
|
|
|
2015-05-06 02:46:50 +02:00
|
|
|
adb_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
|
|
|
|
|
|
|
|
ADB_COMMON_CFLAGS := \
|
2015-05-21 03:56:10 +02:00
|
|
|
-Wall -Wextra -Werror \
|
2015-07-08 22:50:42 +02:00
|
|
|
-Wno-unused-parameter \
|
2015-07-09 22:35:09 +02:00
|
|
|
-Wno-missing-field-initializers \
|
2015-05-06 02:46:50 +02:00
|
|
|
-DADB_REVISION='"$(adb_version)"' \
|
|
|
|
|
2015-08-03 03:13:54 +02:00
|
|
|
# Define windows.h and tchar.h Unicode preprocessor symbols so that
|
|
|
|
# CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
|
|
|
|
# build if you accidentally pass char*. Fix by calling like:
|
|
|
|
# CreateFileW(widen(utf8).c_str()).
|
|
|
|
ADB_COMMON_windows_CFLAGS := \
|
|
|
|
-DUNICODE=1 -D_UNICODE=1 \
|
|
|
|
|
|
|
|
ADB_COMMON_CFLAGS += $(ADB_COMMON_$(HOST_OS)_CFLAGS)
|
|
|
|
|
2014-11-25 08:34:35 +01:00
|
|
|
# libadb
|
|
|
|
# =========================================================
|
|
|
|
|
|
|
|
# Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes
|
|
|
|
# made to adb rarely get ported to the other two, so the trees have diverged a
|
|
|
|
# bit. We'd like to stop this because it is a maintenance nightmare, but the
|
|
|
|
# divergence makes this difficult to do all at once. For now, we will start
|
|
|
|
# small by moving common files into a static library. Hopefully some day we can
|
|
|
|
# get enough of adb in here that we no longer need minadb. https://b/17626262
|
2015-02-19 02:47:33 +01:00
|
|
|
LIBADB_SRC_FILES := \
|
2015-02-26 02:51:28 +01:00
|
|
|
adb.cpp \
|
|
|
|
adb_auth.cpp \
|
2015-02-25 06:26:58 +01:00
|
|
|
adb_io.cpp \
|
2015-02-26 02:51:28 +01:00
|
|
|
adb_listeners.cpp \
|
2015-04-17 22:57:15 +02:00
|
|
|
adb_utils.cpp \
|
2015-02-26 02:51:28 +01:00
|
|
|
sockets.cpp \
|
|
|
|
transport.cpp \
|
|
|
|
transport_local.cpp \
|
|
|
|
transport_usb.cpp \
|
2015-02-19 02:47:33 +01:00
|
|
|
|
2015-04-19 22:17:01 +02:00
|
|
|
LIBADB_TEST_SRCS := \
|
|
|
|
adb_io_test.cpp \
|
|
|
|
adb_utils_test.cpp \
|
|
|
|
transport_test.cpp \
|
|
|
|
|
2015-02-21 02:20:09 +01:00
|
|
|
LIBADB_CFLAGS := \
|
2015-05-06 02:46:50 +02:00
|
|
|
$(ADB_COMMON_CFLAGS) \
|
2015-02-19 02:47:33 +01:00
|
|
|
-fvisibility=hidden \
|
2015-07-24 23:32:46 +02:00
|
|
|
|
|
|
|
LIBADB_linux_CFLAGS := \
|
2015-07-24 00:20:09 +02:00
|
|
|
-std=c++14 \
|
2014-11-25 08:34:35 +01:00
|
|
|
|
2015-07-24 23:32:46 +02:00
|
|
|
LIBADB_CFLAGS += $(LIBADB_$(HOST_OS)_CFLAGS)
|
|
|
|
|
2015-02-26 02:51:28 +01:00
|
|
|
LIBADB_darwin_SRC_FILES := \
|
|
|
|
fdevent.cpp \
|
2015-04-16 22:24:58 +02:00
|
|
|
get_my_path_darwin.cpp \
|
2015-04-17 04:20:40 +02:00
|
|
|
usb_osx.cpp \
|
2015-02-26 02:51:28 +01:00
|
|
|
|
|
|
|
LIBADB_linux_SRC_FILES := \
|
|
|
|
fdevent.cpp \
|
|
|
|
get_my_path_linux.cpp \
|
|
|
|
usb_linux.cpp \
|
|
|
|
|
|
|
|
LIBADB_windows_SRC_FILES := \
|
2015-04-17 01:47:02 +02:00
|
|
|
sysdeps_win32.cpp \
|
2015-02-26 02:51:28 +01:00
|
|
|
usb_windows.cpp \
|
2014-11-25 20:00:56 +01:00
|
|
|
|
2014-11-25 08:34:35 +01:00
|
|
|
include $(CLEAR_VARS)
|
2015-04-16 23:12:50 +02:00
|
|
|
LOCAL_CLANG := true
|
2014-11-25 20:00:56 +01:00
|
|
|
LOCAL_MODULE := libadbd
|
2014-11-25 08:34:35 +01:00
|
|
|
LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
|
2015-02-19 02:20:44 +01:00
|
|
|
LOCAL_SRC_FILES := \
|
|
|
|
$(LIBADB_SRC_FILES) \
|
2015-02-26 02:51:28 +01:00
|
|
|
adb_auth_client.cpp \
|
2015-02-21 02:24:30 +01:00
|
|
|
fdevent.cpp \
|
2015-02-26 02:51:28 +01:00
|
|
|
jdwp_service.cpp \
|
|
|
|
qemu_tracing.cpp \
|
2015-04-16 23:12:50 +02:00
|
|
|
usb_linux_client.cpp \
|
2015-02-19 02:20:44 +01:00
|
|
|
|
2015-07-30 19:25:32 +02:00
|
|
|
LOCAL_SANITIZE := $(adb_target_sanitize)
|
2015-04-20 17:09:20 +02:00
|
|
|
LOCAL_SHARED_LIBRARIES := libbase
|
|
|
|
|
2015-03-19 21:25:27 +01:00
|
|
|
# Even though we're building a static library (and thus there's no link step for
|
|
|
|
# this to take effect), this adds the includes to our path.
|
|
|
|
LOCAL_STATIC_LIBRARIES := libbase
|
|
|
|
|
2014-11-25 20:00:56 +01:00
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
2015-04-19 22:17:01 +02:00
|
|
|
LOCAL_CLANG := $(adb_host_clang)
|
2014-11-25 20:00:56 +01:00
|
|
|
LOCAL_MODULE := libadb
|
|
|
|
LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
|
2015-02-19 22:19:42 +01:00
|
|
|
LOCAL_SRC_FILES := \
|
|
|
|
$(LIBADB_SRC_FILES) \
|
2015-02-21 02:24:30 +01:00
|
|
|
$(LIBADB_$(HOST_OS)_SRC_FILES) \
|
2015-02-26 02:51:28 +01:00
|
|
|
adb_auth_host.cpp \
|
2015-02-19 22:19:42 +01:00
|
|
|
|
2015-07-30 19:25:32 +02:00
|
|
|
LOCAL_SANITIZE := $(adb_host_sanitize)
|
2015-04-20 17:09:20 +02:00
|
|
|
LOCAL_SHARED_LIBRARIES := libbase
|
|
|
|
|
2015-02-19 22:19:42 +01:00
|
|
|
# Even though we're building a static library (and thus there's no link step for
|
2015-03-19 21:25:27 +01:00
|
|
|
# this to take effect), this adds the includes to our path.
|
|
|
|
LOCAL_STATIC_LIBRARIES := libcrypto_static libbase
|
2014-11-25 08:34:35 +01:00
|
|
|
|
2015-02-24 23:08:03 +01:00
|
|
|
ifeq ($(HOST_OS),windows)
|
|
|
|
LOCAL_C_INCLUDES += development/host/windows/usb/api/
|
2015-08-26 04:38:14 +02:00
|
|
|
else
|
|
|
|
LOCAL_MULTILIB := 64
|
2015-02-24 23:08:03 +01:00
|
|
|
endif
|
|
|
|
|
2014-11-25 08:34:35 +01:00
|
|
|
include $(BUILD_HOST_STATIC_LIBRARY)
|
|
|
|
|
2015-02-21 02:24:58 +01:00
|
|
|
include $(CLEAR_VARS)
|
2015-04-19 22:17:01 +02:00
|
|
|
LOCAL_CLANG := true
|
2015-02-21 02:24:58 +01:00
|
|
|
LOCAL_MODULE := adbd_test
|
|
|
|
LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
|
|
|
|
LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
|
2015-07-30 19:25:32 +02:00
|
|
|
LOCAL_SANITIZE := $(adb_target_sanitize)
|
2015-02-21 02:24:58 +01:00
|
|
|
LOCAL_STATIC_LIBRARIES := libadbd
|
2015-03-16 18:08:46 +01:00
|
|
|
LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
|
2015-02-21 02:24:58 +01:00
|
|
|
include $(BUILD_NATIVE_TEST)
|
|
|
|
|
2015-05-25 00:36:28 +02:00
|
|
|
# adb_test
|
|
|
|
# =========================================================
|
|
|
|
|
2015-02-21 02:24:58 +01:00
|
|
|
include $(CLEAR_VARS)
|
2015-04-19 22:17:01 +02:00
|
|
|
LOCAL_CLANG := $(adb_host_clang)
|
2015-02-21 02:24:58 +01:00
|
|
|
LOCAL_MODULE := adb_test
|
|
|
|
LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
|
2015-02-26 02:51:28 +01:00
|
|
|
LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
|
2015-07-30 19:25:32 +02:00
|
|
|
LOCAL_SANITIZE := $(adb_host_sanitize)
|
2015-03-16 18:08:46 +01:00
|
|
|
LOCAL_SHARED_LIBRARIES := liblog libbase
|
2015-02-21 02:24:58 +01:00
|
|
|
LOCAL_STATIC_LIBRARIES := \
|
|
|
|
libadb \
|
|
|
|
libcrypto_static \
|
|
|
|
libcutils \
|
|
|
|
|
|
|
|
ifeq ($(HOST_OS),linux)
|
2015-05-05 23:50:09 +02:00
|
|
|
LOCAL_LDLIBS += -lrt -ldl -lpthread
|
2015-02-21 02:24:58 +01:00
|
|
|
endif
|
|
|
|
|
2015-04-17 04:13:58 +02:00
|
|
|
ifeq ($(HOST_OS),darwin)
|
2015-05-05 23:50:09 +02:00
|
|
|
LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
|
2015-04-17 04:13:58 +02:00
|
|
|
endif
|
|
|
|
|
2015-05-25 00:36:28 +02:00
|
|
|
ifeq ($(HOST_OS),windows)
|
|
|
|
LOCAL_LDLIBS += -lws2_32 -luserenv
|
|
|
|
LOCAL_STATIC_LIBRARIES += AdbWinApi
|
2015-05-05 23:50:09 +02:00
|
|
|
endif
|
2015-02-21 02:24:58 +01:00
|
|
|
|
2015-05-25 00:36:28 +02:00
|
|
|
include $(BUILD_HOST_NATIVE_TEST)
|
|
|
|
|
2015-05-01 02:32:03 +02:00
|
|
|
# adb device tracker (used by ddms) test tool
|
|
|
|
# =========================================================
|
|
|
|
|
|
|
|
ifeq ($(HOST_OS),linux)
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_CLANG := $(adb_host_clang)
|
|
|
|
LOCAL_MODULE := adb_device_tracker_test
|
|
|
|
LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
|
|
|
|
LOCAL_SRC_FILES := test_track_devices.cpp
|
2015-07-30 19:25:32 +02:00
|
|
|
LOCAL_SANITIZE := $(adb_host_sanitize)
|
2015-05-01 02:32:03 +02:00
|
|
|
LOCAL_SHARED_LIBRARIES := liblog libbase
|
|
|
|
LOCAL_STATIC_LIBRARIES := libadb libcrypto_static libcutils
|
|
|
|
LOCAL_LDLIBS += -lrt -ldl -lpthread
|
|
|
|
include $(BUILD_HOST_EXECUTABLE)
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
# adb host tool
|
|
|
|
# =========================================================
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
ifeq ($(HOST_OS),linux)
|
2015-05-07 01:13:42 +02:00
|
|
|
LOCAL_LDLIBS += -lrt -ldl -lpthread
|
|
|
|
LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
|
2009-03-04 04:32:55 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(HOST_OS),darwin)
|
2015-05-07 01:13:42 +02:00
|
|
|
LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
|
|
|
|
LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
|
2009-03-04 04:32:55 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(HOST_OS),windows)
|
2015-05-11 10:08:48 +02:00
|
|
|
# Use wmain instead of main
|
|
|
|
LOCAL_LDFLAGS += -municode
|
2015-05-07 01:13:42 +02:00
|
|
|
LOCAL_LDLIBS += -lws2_32 -lgdi32
|
|
|
|
EXTRA_STATIC_LIBS := AdbWinApi
|
2009-03-04 04:32:55 +01:00
|
|
|
endif
|
|
|
|
|
2015-04-19 22:17:01 +02:00
|
|
|
LOCAL_CLANG := $(adb_host_clang)
|
2015-02-21 02:28:44 +01:00
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
LOCAL_SRC_FILES := \
|
2015-05-09 01:13:53 +02:00
|
|
|
client/main.cpp \
|
2015-02-26 02:51:28 +01:00
|
|
|
console.cpp \
|
|
|
|
commandline.cpp \
|
|
|
|
adb_client.cpp \
|
|
|
|
services.cpp \
|
|
|
|
file_sync_client.cpp \
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2015-02-25 07:38:21 +01:00
|
|
|
LOCAL_CFLAGS += \
|
2015-05-06 02:46:50 +02:00
|
|
|
$(ADB_COMMON_CFLAGS) \
|
2015-02-25 07:38:21 +01:00
|
|
|
-D_GNU_SOURCE \
|
|
|
|
-DADB_HOST=1 \
|
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
LOCAL_MODULE := adb
|
2012-09-26 18:58:07 +02:00
|
|
|
LOCAL_MODULE_TAGS := debug
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2015-07-30 19:25:32 +02:00
|
|
|
LOCAL_SANITIZE := $(adb_host_sanitize)
|
2014-11-25 08:34:35 +01:00
|
|
|
LOCAL_STATIC_LIBRARIES := \
|
|
|
|
libadb \
|
2015-04-17 19:59:34 +02:00
|
|
|
libbase \
|
2014-11-25 08:34:35 +01:00
|
|
|
libcrypto_static \
|
2015-04-19 22:17:01 +02:00
|
|
|
libcutils \
|
2015-04-27 23:20:17 +02:00
|
|
|
liblog \
|
2014-11-25 08:34:35 +01:00
|
|
|
$(EXTRA_STATIC_LIBS) \
|
|
|
|
|
2015-04-20 21:36:50 +02:00
|
|
|
# libc++ not available on windows yet
|
|
|
|
ifneq ($(HOST_OS),windows)
|
|
|
|
LOCAL_CXX_STL := libc++_static
|
|
|
|
endif
|
2015-04-17 01:21:44 +02:00
|
|
|
|
|
|
|
# Don't add anything here, we don't want additional shared dependencies
|
|
|
|
# on the host adb tool, and shared libraries that link against libc++
|
|
|
|
# will violate ODR
|
|
|
|
LOCAL_SHARED_LIBRARIES :=
|
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
include $(BUILD_HOST_EXECUTABLE)
|
|
|
|
|
2012-09-05 19:26:43 +02:00
|
|
|
$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
|
2009-03-04 04:32:55 +01:00
|
|
|
|
|
|
|
ifeq ($(HOST_OS),windows)
|
2009-08-11 20:08:45 +02:00
|
|
|
$(LOCAL_INSTALLED_MODULE): \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
|
2009-03-04 04:32:55 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# adbd device daemon
|
|
|
|
# =========================================================
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2015-04-19 22:17:01 +02:00
|
|
|
LOCAL_CLANG := true
|
2015-02-21 02:28:44 +01:00
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
LOCAL_SRC_FILES := \
|
2015-05-09 01:13:53 +02:00
|
|
|
daemon/main.cpp \
|
2015-02-26 02:51:28 +01:00
|
|
|
services.cpp \
|
|
|
|
file_sync_service.cpp \
|
|
|
|
framebuffer_service.cpp \
|
|
|
|
remount_service.cpp \
|
|
|
|
set_verity_enable_state_service.cpp \
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2014-09-04 04:48:48 +02:00
|
|
|
LOCAL_CFLAGS := \
|
2015-05-06 02:46:50 +02:00
|
|
|
$(ADB_COMMON_CFLAGS) \
|
2015-02-26 02:51:28 +01:00
|
|
|
-DADB_HOST=0 \
|
|
|
|
-D_GNU_SOURCE \
|
|
|
|
-Wno-deprecated-declarations \
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2015-06-18 00:23:42 +02:00
|
|
|
LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0)
|
2012-01-19 22:11:35 +01:00
|
|
|
|
2015-03-16 22:58:32 +01:00
|
|
|
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
|
2014-10-09 16:22:49 +02:00
|
|
|
LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
|
2015-06-18 00:23:42 +02:00
|
|
|
LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
|
2014-10-09 16:22:49 +02:00
|
|
|
endif
|
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
LOCAL_MODULE := adbd
|
|
|
|
|
2015-08-14 22:02:51 +02:00
|
|
|
LOCAL_INIT_RC := adbd.rc
|
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
|
|
|
|
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
|
2015-03-29 20:22:34 +02:00
|
|
|
LOCAL_C_INCLUDES += system/extras/ext4_utils
|
2014-10-09 16:22:49 +02:00
|
|
|
|
2015-07-30 19:25:32 +02:00
|
|
|
LOCAL_SANITIZE := $(adb_target_sanitize)
|
2014-11-25 08:34:35 +01:00
|
|
|
LOCAL_STATIC_LIBRARIES := \
|
2014-11-25 20:00:56 +01:00
|
|
|
libadbd \
|
2015-03-29 20:22:34 +02:00
|
|
|
libbase \
|
2015-01-27 02:13:54 +01:00
|
|
|
libfs_mgr \
|
2014-11-25 08:34:35 +01:00
|
|
|
liblog \
|
|
|
|
libmincrypt \
|
|
|
|
libselinux \
|
2015-01-27 02:13:54 +01:00
|
|
|
libext4_utils_static \
|
2015-03-19 21:25:27 +01:00
|
|
|
libcutils \
|
|
|
|
libbase \
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2011-07-12 07:12:32 +02:00
|
|
|
include $(BUILD_EXECUTABLE)
|