The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | # Copyright 2005 The Android Open Source Project |
| 2 | # |
| 3 | # Android.mk for adb |
| 4 | # |
| 5 | |
| 6 | LOCAL_PATH:= $(call my-dir) |
| 7 | |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 8 | ADB_CLANG := |
| 9 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 10 | # 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 Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 19 | LIBADB_SRC_FILES := \ |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 20 | adb.c \ |
Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 21 | adb_auth.c \ |
Dan Albert | e9fca14 | 2015-02-18 18:03:26 -0800 | [diff] [blame] | 22 | adb_listeners.c \ |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 23 | sockets.c \ |
Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 24 | transport.c \ |
Dan Albert | 3c43858 | 2015-02-20 17:24:30 -0800 | [diff] [blame] | 25 | transport_local.c \ |
Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 26 | transport_usb.c \ |
| 27 | |
Dan Albert | bf10647 | 2015-02-20 17:20:09 -0800 | [diff] [blame] | 28 | LIBADB_CFLAGS := \ |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 29 | -Wall -Werror \ |
| 30 | -Wno-unused-parameter \ |
| 31 | -Wno-missing-field-initializers \ |
Dan Albert | ba3a251 | 2015-02-18 17:47:33 -0800 | [diff] [blame] | 32 | -fvisibility=hidden \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 33 | |
Dan Albert | fdf8722 | 2015-02-24 14:24:47 -0800 | [diff] [blame] | 34 | LIBADB_darwin_SRC_FILES := fdevent.cpp get_my_path_darwin.c usb_osx.c |
Dan Albert | 3c43858 | 2015-02-20 17:24:30 -0800 | [diff] [blame] | 35 | LIBADB_linux_SRC_FILES := fdevent.cpp get_my_path_linux.c usb_linux.c |
| 36 | LIBADB_windows_SRC_FILES := get_my_path_windows.c sysdeps_win32.c usb_windows.c |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 37 | |
| 38 | include $(CLEAR_VARS) |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 39 | LOCAL_CLANG := $(ADB_CLANG) |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 40 | LOCAL_MODULE := libadbd |
| 41 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0 |
Dan Albert | 21c3eaf | 2015-02-18 17:20:44 -0800 | [diff] [blame] | 42 | LOCAL_SRC_FILES := \ |
| 43 | $(LIBADB_SRC_FILES) \ |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 44 | adb_auth_client.c \ |
Dan Albert | 3c43858 | 2015-02-20 17:24:30 -0800 | [diff] [blame] | 45 | fdevent.cpp \ |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 46 | jdwp_service.c \ |
Dan Albert | 21c3eaf | 2015-02-18 17:20:44 -0800 | [diff] [blame] | 47 | qemu_tracing.c \ |
| 48 | usb_linux_client.c \ |
| 49 | |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 50 | include $(BUILD_STATIC_LIBRARY) |
| 51 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 52 | include $(CLEAR_VARS) |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 53 | LOCAL_CLANG := $(ADB_CLANG) |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 54 | LOCAL_MODULE := libadb |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 55 | LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1 |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 56 | LOCAL_SRC_FILES := \ |
| 57 | $(LIBADB_SRC_FILES) \ |
Dan Albert | 3c43858 | 2015-02-20 17:24:30 -0800 | [diff] [blame] | 58 | $(LIBADB_$(HOST_OS)_SRC_FILES) \ |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 59 | adb_auth_host.c \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 60 | |
Dan Albert | e1ca623 | 2015-02-19 13:19:42 -0800 | [diff] [blame] | 61 | # Even though we're building a static library (and thus there's no link step for |
| 62 | # this to take effect), this adds the SSL includes to our path. |
| 63 | LOCAL_STATIC_LIBRARIES := libcrypto_static |
| 64 | |
Dan Albert | 88cf1c8 | 2015-02-24 14:08:03 -0800 | [diff] [blame] | 65 | ifeq ($(HOST_OS),windows) |
| 66 | LOCAL_C_INCLUDES += development/host/windows/usb/api/ |
| 67 | endif |
| 68 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 69 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 70 | |
Dan Albert | 055f1aa | 2015-02-20 17:24:58 -0800 | [diff] [blame] | 71 | LIBADB_TEST_SRCS := \ |
| 72 | transport_test.cpp \ |
| 73 | |
| 74 | include $(CLEAR_VARS) |
| 75 | LOCAL_CLANG := $(ADB_CLANG) |
| 76 | LOCAL_MODULE := adbd_test |
| 77 | LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS) |
| 78 | LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) |
| 79 | LOCAL_STATIC_LIBRARIES := libadbd |
| 80 | LOCAL_SHARED_LIBRARIES := liblog |
| 81 | include $(BUILD_NATIVE_TEST) |
| 82 | |
| 83 | include $(CLEAR_VARS) |
| 84 | LOCAL_CLANG := $(ADB_CLANG) |
| 85 | LOCAL_MODULE := adb_test |
| 86 | LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS) |
| 87 | LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.c |
| 88 | LOCAL_STATIC_LIBRARIES := \ |
| 89 | libadb \ |
| 90 | libcrypto_static \ |
| 91 | libcutils \ |
| 92 | |
| 93 | ifeq ($(HOST_OS),linux) |
| 94 | LOCAL_LDLIBS += -lrt -ldl -lpthread |
| 95 | endif |
| 96 | |
| 97 | include $(BUILD_HOST_NATIVE_TEST) |
| 98 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 99 | # adb host tool |
| 100 | # ========================================================= |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 101 | include $(CLEAR_VARS) |
| 102 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 103 | ifeq ($(HOST_OS),linux) |
Chih-Wei Huang | 9c60755 | 2013-01-01 15:24:33 +0800 | [diff] [blame] | 104 | LOCAL_LDLIBS += -lrt -ldl -lpthread |
JP Abgrall | 571c136 | 2012-12-06 18:18:12 -0800 | [diff] [blame] | 105 | LOCAL_CFLAGS += -DWORKAROUND_BUG6558362 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 106 | endif |
| 107 | |
| 108 | ifeq ($(HOST_OS),darwin) |
Benoit Goby | 345ca13 | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 109 | LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon |
Tim Murray | 1efcdef | 2014-07-24 18:33:12 -0700 | [diff] [blame] | 110 | LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 111 | endif |
| 112 | |
| 113 | ifeq ($(HOST_OS),windows) |
Benoit Goby | 345ca13 | 2012-08-31 17:44:27 -0700 | [diff] [blame] | 114 | EXTRA_STATIC_LIBS := AdbWinApi |
Raphael | fab1678 | 2010-04-13 15:25:50 -0700 | [diff] [blame] | 115 | ifneq ($(strip $(USE_MINGW)),) |
| 116 | # MinGW under Linux case |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 117 | LOCAL_LDLIBS += -lws2_32 -lgdi32 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 118 | USE_SYSDEPS_WIN32 := 1 |
| 119 | endif |
| 120 | endif |
| 121 | |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 122 | LOCAL_CLANG := $(ADB_CLANG) |
| 123 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 124 | LOCAL_SRC_FILES := \ |
Dan Albert | bd0b750 | 2015-02-18 18:22:45 -0800 | [diff] [blame] | 125 | adb_main.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 126 | console.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 127 | commandline.c \ |
| 128 | adb_client.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 129 | services.c \ |
| 130 | file_sync_client.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 131 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 132 | ifneq ($(USE_SYSDEPS_WIN32),) |
| 133 | LOCAL_SRC_FILES += sysdeps_win32.c |
| 134 | endif |
| 135 | |
Dan Albert | 7fd821e | 2015-02-24 22:38:21 -0800 | [diff] [blame] | 136 | LOCAL_CFLAGS += \ |
| 137 | -Wall -Werror \ |
| 138 | -Wno-unused-parameter \ |
| 139 | -D_GNU_SOURCE \ |
| 140 | -DADB_HOST=1 \ |
| 141 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 142 | LOCAL_MODULE := adb |
Kenny Root | d5d6d97 | 2012-09-26 09:58:07 -0700 | [diff] [blame] | 143 | LOCAL_MODULE_TAGS := debug |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 144 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 145 | LOCAL_STATIC_LIBRARIES := \ |
| 146 | libadb \ |
| 147 | libzipfile \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 148 | libcrypto_static \ |
| 149 | $(EXTRA_STATIC_LIBS) \ |
| 150 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 151 | ifeq ($(USE_SYSDEPS_WIN32),) |
| 152 | LOCAL_STATIC_LIBRARIES += libcutils |
| 153 | endif |
| 154 | |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 155 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 156 | include $(BUILD_HOST_EXECUTABLE) |
| 157 | |
Ying Wang | 96535ba | 2012-09-05 10:26:43 -0700 | [diff] [blame] | 158 | $(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE)) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 159 | |
| 160 | ifeq ($(HOST_OS),windows) |
Raphael | 26f3de6 | 2009-08-11 11:08:45 -0700 | [diff] [blame] | 161 | $(LOCAL_INSTALLED_MODULE): \ |
| 162 | $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \ |
| 163 | $(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 164 | endif |
| 165 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 166 | |
| 167 | # adbd device daemon |
| 168 | # ========================================================= |
| 169 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 170 | include $(CLEAR_VARS) |
| 171 | |
Dan Albert | 9697ce5 | 2015-02-20 17:28:44 -0800 | [diff] [blame] | 172 | LOCAL_CLANG := $(ADB_CLANG) |
| 173 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 174 | LOCAL_SRC_FILES := \ |
Dan Albert | bd0b750 | 2015-02-18 18:22:45 -0800 | [diff] [blame] | 175 | adb_main.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 176 | services.c \ |
| 177 | file_sync_service.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 178 | framebuffer_service.c \ |
| 179 | remount_service.c \ |
Paul Lawrence | 982089d | 2014-12-03 15:31:57 -0800 | [diff] [blame] | 180 | set_verity_enable_state_service.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 181 | |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 182 | LOCAL_CFLAGS := \ |
| 183 | -O2 \ |
| 184 | -g \ |
| 185 | -DADB_HOST=0 \ |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 186 | -D_GNU_SOURCE \ |
| 187 | -Wall -Wno-unused-parameter -Werror -Wno-deprecated-declarations \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 188 | |
Nick Kralevich | 5890fe3 | 2012-01-19 13:11:35 -0800 | [diff] [blame] | 189 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
| 190 | LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 |
| 191 | endif |
| 192 | |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 193 | ifneq (,$(filter userdebug,$(TARGET_BUILD_VARIANT))) |
| 194 | LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 |
| 195 | endif |
| 196 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 197 | LOCAL_MODULE := adbd |
| 198 | |
| 199 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
| 200 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) |
| 201 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 202 | LOCAL_C_INCLUDES += system/extras/ext4_utils system/core/fs_mgr/include |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 203 | |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 204 | LOCAL_STATIC_LIBRARIES := \ |
Dan Albert | 9449376 | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 205 | libadbd \ |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 206 | libfs_mgr \ |
Dan Albert | 630b9af | 2014-11-24 23:34:35 -0800 | [diff] [blame] | 207 | liblog \ |
| 208 | libcutils \ |
| 209 | libc \ |
| 210 | libmincrypt \ |
| 211 | libselinux \ |
Dan Albert | 030b76f | 2015-01-26 17:13:54 -0800 | [diff] [blame] | 212 | libext4_utils_static \ |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 213 | |
Christopher Ferris | 51448eb | 2014-09-03 19:48:48 -0700 | [diff] [blame] | 214 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Paul Lawrence | ec900bb | 2014-10-09 14:22:49 +0000 | [diff] [blame] | 215 | |
Jeff Brown | 29e1e73 | 2011-07-11 22:12:32 -0700 | [diff] [blame] | 216 | include $(BUILD_EXECUTABLE) |