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