blob: 133a7c45dea66814655b06cfb8138a9e9e8a0cf5 [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
Dan Albert9697ce52015-02-20 17:28:44 -08008ADB_CLANG :=
9
Dan Albert630b9af2014-11-24 23:34:35 -080010# libadb
11# =========================================================
12
13# Much of adb is duplicated in bootable/recovery/minadb and fastboot. Changes
14# made to adb rarely get ported to the other two, so the trees have diverged a
15# bit. We'd like to stop this because it is a maintenance nightmare, but the
16# divergence makes this difficult to do all at once. For now, we will start
17# small by moving common files into a static library. Hopefully some day we can
18# get enough of adb in here that we no longer need minadb. https://b/17626262
Dan Albertba3a2512015-02-18 17:47:33 -080019LIBADB_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -080020 adb.cpp \
21 adb_auth.cpp \
Dan Albertcc731cc2015-02-24 21:26:58 -080022 adb_io.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080023 adb_listeners.cpp \
24 sockets.cpp \
25 transport.cpp \
26 transport_local.cpp \
27 transport_usb.cpp \
Dan Albertba3a2512015-02-18 17:47:33 -080028
Dan Albertbf106472015-02-20 17:20:09 -080029LIBADB_CFLAGS := \
Dan Albert055f1aa2015-02-20 17:24:58 -080030 -Wall -Werror \
31 -Wno-unused-parameter \
32 -Wno-missing-field-initializers \
Dan Albertba3a2512015-02-18 17:47:33 -080033 -fvisibility=hidden \
Dan Albert630b9af2014-11-24 23:34:35 -080034
Dan Albertbac34742015-02-25 17:51:28 -080035LIBADB_darwin_SRC_FILES := \
36 fdevent.cpp \
Elliott Hughes1a4d85a2015-04-16 13:24:58 -070037 get_my_path_darwin.cpp \
Dan Albert7447dd02015-04-16 19:20:40 -070038 usb_osx.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080039
40LIBADB_linux_SRC_FILES := \
41 fdevent.cpp \
42 get_my_path_linux.cpp \
43 usb_linux.cpp \
44
45LIBADB_windows_SRC_FILES := \
46 get_my_path_windows.cpp \
47 sysdeps_win32.c \
48 usb_windows.cpp \
Dan Albert94493762014-11-25 11:00:56 -080049
50include $(CLEAR_VARS)
Elliott Hughes2acec912015-04-16 14:12:50 -070051LOCAL_CLANG := true
Dan Albert94493762014-11-25 11:00:56 -080052LOCAL_MODULE := libadbd
53LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
Dan Albert21c3eaf2015-02-18 17:20:44 -080054LOCAL_SRC_FILES := \
55 $(LIBADB_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080056 adb_auth_client.cpp \
Dan Albert3c438582015-02-20 17:24:30 -080057 fdevent.cpp \
Dan Albertbac34742015-02-25 17:51:28 -080058 jdwp_service.cpp \
59 qemu_tracing.cpp \
Elliott Hughes2acec912015-04-16 14:12:50 -070060 usb_linux_client.cpp \
Dan Albert21c3eaf2015-02-18 17:20:44 -080061
Dan Albert94493762014-11-25 11:00:56 -080062include $(BUILD_STATIC_LIBRARY)
63
Dan Albert630b9af2014-11-24 23:34:35 -080064include $(CLEAR_VARS)
Dan Albert9697ce52015-02-20 17:28:44 -080065LOCAL_CLANG := $(ADB_CLANG)
Dan Albert630b9af2014-11-24 23:34:35 -080066LOCAL_MODULE := libadb
Dan Albert94493762014-11-25 11:00:56 -080067LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
Dan Alberte1ca6232015-02-19 13:19:42 -080068LOCAL_SRC_FILES := \
69 $(LIBADB_SRC_FILES) \
Dan Albert3c438582015-02-20 17:24:30 -080070 $(LIBADB_$(HOST_OS)_SRC_FILES) \
Dan Albertbac34742015-02-25 17:51:28 -080071 adb_auth_host.cpp \
Dan Albert630b9af2014-11-24 23:34:35 -080072
Dan Alberte1ca6232015-02-19 13:19:42 -080073# Even though we're building a static library (and thus there's no link step for
74# this to take effect), this adds the SSL includes to our path.
75LOCAL_STATIC_LIBRARIES := libcrypto_static
76
Dan Albert88cf1c82015-02-24 14:08:03 -080077ifeq ($(HOST_OS),windows)
78 LOCAL_C_INCLUDES += development/host/windows/usb/api/
79endif
80
Dan Albert630b9af2014-11-24 23:34:35 -080081include $(BUILD_HOST_STATIC_LIBRARY)
82
Dan Albert055f1aa2015-02-20 17:24:58 -080083LIBADB_TEST_SRCS := \
Dan Albertcc731cc2015-02-24 21:26:58 -080084 adb_io_test.cpp \
Dan Albert055f1aa2015-02-20 17:24:58 -080085 transport_test.cpp \
86
87include $(CLEAR_VARS)
88LOCAL_CLANG := $(ADB_CLANG)
89LOCAL_MODULE := adbd_test
90LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
91LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
92LOCAL_STATIC_LIBRARIES := libadbd
Dan Albertc007bc32015-03-16 10:08:46 -070093LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
Dan Albert055f1aa2015-02-20 17:24:58 -080094include $(BUILD_NATIVE_TEST)
95
96include $(CLEAR_VARS)
97LOCAL_CLANG := $(ADB_CLANG)
98LOCAL_MODULE := adb_test
99LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
Dan Albertbac34742015-02-25 17:51:28 -0800100LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
Dan Albertc007bc32015-03-16 10:08:46 -0700101LOCAL_SHARED_LIBRARIES := liblog libbase
Dan Albert055f1aa2015-02-20 17:24:58 -0800102LOCAL_STATIC_LIBRARIES := \
103 libadb \
104 libcrypto_static \
105 libcutils \
106
107ifeq ($(HOST_OS),linux)
108 LOCAL_LDLIBS += -lrt -ldl -lpthread
109endif
110
Dan Albertf8d6b9b2015-04-16 19:13:58 -0700111ifeq ($(HOST_OS),darwin)
112 LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
113endif
114
Dan Albert055f1aa2015-02-20 17:24:58 -0800115include $(BUILD_HOST_NATIVE_TEST)
116
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800117# adb host tool
118# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800119include $(CLEAR_VARS)
120
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800121ifeq ($(HOST_OS),linux)
Chih-Wei Huang9c607552013-01-01 15:24:33 +0800122 LOCAL_LDLIBS += -lrt -ldl -lpthread
JP Abgrall571c1362012-12-06 18:18:12 -0800123 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800124endif
125
126ifeq ($(HOST_OS),darwin)
Benoit Goby345ca132012-08-31 17:44:27 -0700127 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
Tim Murray1efcdef2014-07-24 18:33:12 -0700128 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800129endif
130
131ifeq ($(HOST_OS),windows)
Benoit Goby345ca132012-08-31 17:44:27 -0700132 EXTRA_STATIC_LIBS := AdbWinApi
Raphaelfab16782010-04-13 15:25:50 -0700133 ifneq ($(strip $(USE_MINGW)),)
134 # MinGW under Linux case
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700135 LOCAL_LDLIBS += -lws2_32 -lgdi32
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800136 USE_SYSDEPS_WIN32 := 1
137 endif
138endif
139
Dan Albert9697ce52015-02-20 17:28:44 -0800140LOCAL_CLANG := $(ADB_CLANG)
141
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800142LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800143 adb_main.cpp \
144 console.cpp \
145 commandline.cpp \
146 adb_client.cpp \
147 services.cpp \
148 file_sync_client.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800149
Dan Albert7fd821e2015-02-24 22:38:21 -0800150LOCAL_CFLAGS += \
151 -Wall -Werror \
152 -Wno-unused-parameter \
153 -D_GNU_SOURCE \
154 -DADB_HOST=1 \
155
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800156LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700157LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800158
Dan Albert630b9af2014-11-24 23:34:35 -0800159LOCAL_STATIC_LIBRARIES := \
160 libadb \
Dan Albert630b9af2014-11-24 23:34:35 -0800161 libcrypto_static \
162 $(EXTRA_STATIC_LIBS) \
163
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800164ifeq ($(USE_SYSDEPS_WIN32),)
Dan Albertbac34742015-02-25 17:51:28 -0800165 LOCAL_STATIC_LIBRARIES += libcutils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800166endif
167
168include $(BUILD_HOST_EXECUTABLE)
169
Ying Wang96535ba2012-09-05 10:26:43 -0700170$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800171
172ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700173$(LOCAL_INSTALLED_MODULE): \
174 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
175 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800176endif
177
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800178
179# adbd device daemon
180# =========================================================
181
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800182include $(CLEAR_VARS)
183
Dan Albert9697ce52015-02-20 17:28:44 -0800184LOCAL_CLANG := $(ADB_CLANG)
185
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800186LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800187 adb_main.cpp \
188 services.cpp \
189 file_sync_service.cpp \
190 framebuffer_service.cpp \
191 remount_service.cpp \
192 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800193
Christopher Ferris51448eb2014-09-03 19:48:48 -0700194LOCAL_CFLAGS := \
Dan Albertbac34742015-02-25 17:51:28 -0800195 -DADB_HOST=0 \
196 -D_GNU_SOURCE \
197 -Wall -Werror \
198 -Wno-unused-parameter \
199 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800200
Nick Kralevich5890fe32012-01-19 13:11:35 -0800201ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
202LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
203endif
204
Elliott Hughesec7a6672015-03-16 21:58:32 +0000205ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000206LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
207endif
208
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800209LOCAL_MODULE := adbd
210
211LOCAL_FORCE_STATIC_EXECUTABLE := true
212LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
213LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Tao Bao175b7bb2015-03-29 11:22:34 -0700214LOCAL_C_INCLUDES += system/extras/ext4_utils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800215
Dan Albert630b9af2014-11-24 23:34:35 -0800216LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800217 libadbd \
Tao Bao175b7bb2015-03-29 11:22:34 -0700218 libbase \
Dan Albert030b76f2015-01-26 17:13:54 -0800219 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800220 liblog \
221 libcutils \
222 libc \
223 libmincrypt \
224 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800225 libext4_utils_static \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000226
Jeff Brown29e1e732011-07-11 22:12:32 -0700227include $(BUILD_EXECUTABLE)