blob: 1749c62770a32db9787f80993f0d021d4748fe00 [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 \
37 get_my_path_darwin.c \
38 usb_osx.c \
39
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)
Dan Albert9697ce52015-02-20 17:28:44 -080051LOCAL_CLANG := $(ADB_CLANG)
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 \
Dan Albert21c3eaf2015-02-18 17:20:44 -080060 usb_linux_client.c \
61
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 Albertcc731cc2015-02-24 21:26:58 -080093LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
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 Albertcc731cc2015-02-24 21:26:58 -0800101LOCAL_SHARED_LIBRARIES := liblog
Dan Albert055f1aa2015-02-20 17:24:58 -0800102LOCAL_STATIC_LIBRARIES := \
103 libadb \
104 libcrypto_static \
105 libcutils \
Dan Albertcc731cc2015-02-24 21:26:58 -0800106 libutils \
Dan Albert055f1aa2015-02-20 17:24:58 -0800107
108ifeq ($(HOST_OS),linux)
109 LOCAL_LDLIBS += -lrt -ldl -lpthread
110endif
111
112include $(BUILD_HOST_NATIVE_TEST)
113
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800114# adb host tool
115# =========================================================
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800116include $(CLEAR_VARS)
117
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800118ifeq ($(HOST_OS),linux)
Chih-Wei Huang9c607552013-01-01 15:24:33 +0800119 LOCAL_LDLIBS += -lrt -ldl -lpthread
JP Abgrall571c1362012-12-06 18:18:12 -0800120 LOCAL_CFLAGS += -DWORKAROUND_BUG6558362
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800121endif
122
123ifeq ($(HOST_OS),darwin)
Benoit Goby345ca132012-08-31 17:44:27 -0700124 LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
Tim Murray1efcdef2014-07-24 18:33:12 -0700125 LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800126endif
127
128ifeq ($(HOST_OS),windows)
Benoit Goby345ca132012-08-31 17:44:27 -0700129 EXTRA_STATIC_LIBS := AdbWinApi
Raphaelfab16782010-04-13 15:25:50 -0700130 ifneq ($(strip $(USE_MINGW)),)
131 # MinGW under Linux case
Benoit Gobyd5fcafa2012-04-12 12:23:49 -0700132 LOCAL_LDLIBS += -lws2_32 -lgdi32
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800133 USE_SYSDEPS_WIN32 := 1
134 endif
135endif
136
Dan Albert9697ce52015-02-20 17:28:44 -0800137LOCAL_CLANG := $(ADB_CLANG)
138
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800139LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800140 adb_main.cpp \
141 console.cpp \
142 commandline.cpp \
143 adb_client.cpp \
144 services.cpp \
145 file_sync_client.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800146
Dan Albert7fd821e2015-02-24 22:38:21 -0800147LOCAL_CFLAGS += \
148 -Wall -Werror \
149 -Wno-unused-parameter \
150 -D_GNU_SOURCE \
151 -DADB_HOST=1 \
152
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800153LOCAL_MODULE := adb
Kenny Rootd5d6d972012-09-26 09:58:07 -0700154LOCAL_MODULE_TAGS := debug
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800155
Dan Albert630b9af2014-11-24 23:34:35 -0800156LOCAL_STATIC_LIBRARIES := \
157 libadb \
158 libzipfile \
Dan Albert630b9af2014-11-24 23:34:35 -0800159 libcrypto_static \
160 $(EXTRA_STATIC_LIBS) \
161
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800162ifeq ($(USE_SYSDEPS_WIN32),)
Dan Albertbac34742015-02-25 17:51:28 -0800163 LOCAL_STATIC_LIBRARIES += libcutils
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800164endif
165
Christopher Ferris51448eb2014-09-03 19:48:48 -0700166LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800167include $(BUILD_HOST_EXECUTABLE)
168
Ying Wang96535ba2012-09-05 10:26:43 -0700169$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800170
171ifeq ($(HOST_OS),windows)
Raphael26f3de62009-08-11 11:08:45 -0700172$(LOCAL_INSTALLED_MODULE): \
173 $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
174 $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800175endif
176
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800177
178# adbd device daemon
179# =========================================================
180
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800181include $(CLEAR_VARS)
182
Dan Albert9697ce52015-02-20 17:28:44 -0800183LOCAL_CLANG := $(ADB_CLANG)
184
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800185LOCAL_SRC_FILES := \
Dan Albertbac34742015-02-25 17:51:28 -0800186 adb_main.cpp \
187 services.cpp \
188 file_sync_service.cpp \
189 framebuffer_service.cpp \
190 remount_service.cpp \
191 set_verity_enable_state_service.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800192
Christopher Ferris51448eb2014-09-03 19:48:48 -0700193LOCAL_CFLAGS := \
Dan Albertbac34742015-02-25 17:51:28 -0800194 -DADB_HOST=0 \
195 -D_GNU_SOURCE \
196 -Wall -Werror \
197 -Wno-unused-parameter \
198 -Wno-deprecated-declarations \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800199
Nick Kralevich5890fe32012-01-19 13:11:35 -0800200ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
201LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
202endif
203
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000204ifneq (,$(filter userdebug,$(TARGET_BUILD_VARIANT)))
205LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
206endif
207
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800208LOCAL_MODULE := adbd
209
210LOCAL_FORCE_STATIC_EXECUTABLE := true
211LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
212LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
Dan Albert030b76f2015-01-26 17:13:54 -0800213LOCAL_C_INCLUDES += system/extras/ext4_utils system/core/fs_mgr/include
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800214
Dan Albert630b9af2014-11-24 23:34:35 -0800215LOCAL_STATIC_LIBRARIES := \
Dan Albert94493762014-11-25 11:00:56 -0800216 libadbd \
Dan Albert030b76f2015-01-26 17:13:54 -0800217 libfs_mgr \
Dan Albert630b9af2014-11-24 23:34:35 -0800218 liblog \
219 libcutils \
220 libc \
221 libmincrypt \
222 libselinux \
Dan Albert030b76f2015-01-26 17:13:54 -0800223 libext4_utils_static \
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000224
Christopher Ferris51448eb2014-09-03 19:48:48 -0700225LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Paul Lawrenceec900bb2014-10-09 14:22:49 +0000226
Jeff Brown29e1e732011-07-11 22:12:32 -0700227include $(BUILD_EXECUTABLE)