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