| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | # Copyright (C) 2007 Google Inc. | 
|  | 2 | # | 
|  | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 4 | # you may not use this file except in compliance with the License. | 
|  | 5 | # You may obtain a copy of the License at | 
|  | 6 | # | 
|  | 7 | #      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 8 | # | 
|  | 9 | # Unless required by applicable law or agreed to in writing, software | 
|  | 10 | # distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 12 | # See the License for the specific language governing permissions and | 
|  | 13 | # limitations under the License. | 
|  | 14 |  | 
|  | 15 | LOCAL_PATH:= $(call my-dir) | 
|  | 16 |  | 
| Elliott Hughes | 4d4f64f | 2017-05-08 11:30:34 -0700 | [diff] [blame] | 17 | include $(LOCAL_PATH)/../platform_tools_tool_version.mk | 
|  | 18 |  | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 19 | fastboot_cflags := -Wall -Wextra -Werror -Wunreachable-code | 
|  | 20 | fastboot_cflags += -DFASTBOOT_VERSION="\"$(tool_version)\"" | 
|  | 21 | fastboot_cflags_darwin := -Wno-unused-parameter | 
|  | 22 | fastboot_ldlibs_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon | 
|  | 23 | fastboot_ldlibs_windows := -lws2_32 | 
|  | 24 | # Don't add anything here, we don't want additional shared dependencies | 
|  | 25 | # on the host fastboot tool, and shared libraries that link against libc++ | 
|  | 26 | # will violate ODR. | 
|  | 27 | fastboot_shared_libs := | 
|  | 28 | fastboot_static_libs := \ | 
|  | 29 | libziparchive \ | 
|  | 30 | libsparse \ | 
|  | 31 | libutils \ | 
|  | 32 | liblog \ | 
|  | 33 | libz \ | 
|  | 34 | libdiagnose_usb \ | 
|  | 35 | libbase \ | 
|  | 36 | libcutils \ | 
|  | 37 | libgtest_host \ | 
|  | 38 |  | 
|  | 39 | fastboot_stl := libc++_static | 
|  | 40 |  | 
|  | 41 | # | 
|  | 42 | # Build host libfastboot. | 
|  | 43 | # | 
|  | 44 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 45 | include $(CLEAR_VARS) | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 46 | LOCAL_MODULE := libfastboot | 
|  | 47 | LOCAL_MODULE_HOST_OS := darwin linux windows | 
| Elliott Hughes | 1b708d3 | 2015-12-11 19:07:01 -0800 | [diff] [blame] | 48 |  | 
| David Pursell | 572bce2 | 2016-01-15 14:19:56 -0800 | [diff] [blame] | 49 | LOCAL_SRC_FILES := \ | 
|  | 50 | bootimg_utils.cpp \ | 
|  | 51 | engine.cpp \ | 
|  | 52 | fastboot.cpp \ | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 53 | fs.cpp \ | 
| David Pursell | 572bce2 | 2016-01-15 14:19:56 -0800 | [diff] [blame] | 54 | socket.cpp \ | 
| David Pursell | 2ec418a | 2016-01-20 08:32:08 -0800 | [diff] [blame] | 55 | tcp.cpp \ | 
| David Pursell | 4601c97 | 2016-02-05 15:35:09 -0800 | [diff] [blame] | 56 | udp.cpp \ | 
| David Pursell | 572bce2 | 2016-01-15 14:19:56 -0800 | [diff] [blame] | 57 | util.cpp \ | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 58 | fastboot_driver.cpp \ | 
| David Pursell | 572bce2 | 2016-01-15 14:19:56 -0800 | [diff] [blame] | 59 |  | 
| Elliott Hughes | 82ff315 | 2016-08-31 15:07:18 -0700 | [diff] [blame] | 60 | LOCAL_SRC_FILES_darwin := usb_osx.cpp | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 61 | LOCAL_SRC_FILES_linux := usb_linux.cpp | 
| Elliott Hughes | 82ff315 | 2016-08-31 15:07:18 -0700 | [diff] [blame] | 62 | LOCAL_SRC_FILES_windows := usb_windows.cpp | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 63 |  | 
| Dan Willemsen | 87a419c | 2015-08-13 14:43:34 -0700 | [diff] [blame] | 64 | LOCAL_C_INCLUDES_windows := development/host/windows/usb/api | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 65 | LOCAL_CFLAGS := $(fastboot_cflags) | 
|  | 66 | LOCAL_CFLAGS_darwin := $(fastboot_cflags_darwin) | 
|  | 67 | LOCAL_CXX_STL := $(fastboot_stl) | 
|  | 68 | LOCAL_HEADER_LIBRARIES := bootimg_headers | 
| Dan Willemsen | d81279f | 2018-04-10 22:55:55 -0700 | [diff] [blame] | 69 | LOCAL_LDLIBS_darwin := $(fastboot_ldlibs_darwin) | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 70 | LOCAL_LDLIBS_windows := $(fastboot_ldlibs_windows) | 
|  | 71 | LOCAL_SHARED_LIBRARIES := $(fastboot_shared_libs) | 
|  | 72 | LOCAL_STATIC_LIBRARIES := $(fastboot_static_libs) | 
|  | 73 | include $(BUILD_HOST_STATIC_LIBRARY) | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 74 |  | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 75 | # | 
|  | 76 | # Build host fastboot / fastboot.exe | 
|  | 77 | # | 
| JP Abgrall | 6bd72be | 2014-06-17 23:43:18 -0700 | [diff] [blame] | 78 |  | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 79 | include $(CLEAR_VARS) | 
|  | 80 | LOCAL_MODULE := fastboot | 
|  | 81 | LOCAL_MODULE_HOST_OS := darwin linux windows | 
| Colin Cross | 55bf5f0 | 2015-04-16 16:21:44 -0700 | [diff] [blame] | 82 |  | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 83 | LOCAL_CFLAGS := $(fastboot_cflags) | 
|  | 84 | LOCAL_CFLAGS_darwin := $(fastboot_cflags_darwin) | 
|  | 85 | LOCAL_CXX_STL := $(fastboot_stl) | 
| Elliott Hughes | 6ebec93 | 2018-04-10 14:22:13 -0700 | [diff] [blame] | 86 | LOCAL_HEADER_LIBRARIES := bootimg_headers | 
| Dan Willemsen | d81279f | 2018-04-10 22:55:55 -0700 | [diff] [blame] | 87 | LOCAL_LDLIBS_darwin := $(fastboot_ldlibs_darwin) | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 88 | LOCAL_LDLIBS_windows := $(fastboot_ldlibs_windows) | 
|  | 89 | LOCAL_REQUIRED_MODULES := mke2fs make_f2fs | 
|  | 90 | LOCAL_REQUIRED_MODULES_darwin := e2fsdroid mke2fs.conf sload_f2fs | 
|  | 91 | LOCAL_REQUIRED_MODULES_linux := e2fsdroid mke2fs.conf sload_f2fs | 
|  | 92 | LOCAL_REQUIRED_MODULES_windows := AdbWinUsbApi | 
|  | 93 | LOCAL_SRC_FILES := main.cpp | 
|  | 94 | LOCAL_SHARED_LIBRARIES := $(fastboot_shared_libs) | 
|  | 95 | LOCAL_SHARED_LIBRARIES_windows := AdbWinApi | 
|  | 96 | LOCAL_STATIC_LIBRARIES := libfastboot $(fastboot_static_libs) | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 97 | include $(BUILD_HOST_EXECUTABLE) | 
| Joe Onorato | 5069b01 | 2012-07-23 19:15:14 -0700 | [diff] [blame] | 98 |  | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 99 | # | 
|  | 100 | # Package fastboot-related executables. | 
|  | 101 | # | 
|  | 102 |  | 
| Dan Willemsen | 94e4dc2 | 2018-04-09 14:26:23 -0700 | [diff] [blame] | 103 | my_dist_files := $(HOST_OUT_EXECUTABLES)/fastboot | 
| Elliott Hughes | 645b50e | 2018-05-08 11:30:07 -0700 | [diff] [blame] | 104 | my_dist_files += $(HOST_OUT_EXECUTABLES)/mke2fs | 
|  | 105 | my_dist_files += $(HOST_OUT_EXECUTABLES)/e2fsdroid | 
|  | 106 | my_dist_files += $(HOST_OUT_EXECUTABLES)/make_f2fs | 
|  | 107 | my_dist_files += $(HOST_OUT_EXECUTABLES)/sload_f2fs | 
| Ying Wang | 71edfc8 | 2016-02-29 19:27:06 -0800 | [diff] [blame] | 108 | $(call dist-for-goals,dist_files sdk win_sdk,$(my_dist_files)) | 
|  | 109 | ifdef HOST_CROSS_OS | 
| Elliott Hughes | 645b50e | 2018-05-08 11:30:07 -0700 | [diff] [blame] | 110 | $(call dist-for-goals,dist_files sdk win_sdk,$(ALL_MODULES.host_cross_fastboot.BUILT)) | 
| Ying Wang | 71edfc8 | 2016-02-29 19:27:06 -0800 | [diff] [blame] | 111 | endif | 
| Ying Wang | 6b048ce | 2014-06-19 14:15:03 -0700 | [diff] [blame] | 112 | my_dist_files := | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 113 |  | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 114 | # | 
|  | 115 | # Build host fastboot_test. | 
|  | 116 | # | 
| David Pursell | 815c7be | 2015-12-09 17:09:54 -0800 | [diff] [blame] | 117 |  | 
| David Pursell | 815c7be | 2015-12-09 17:09:54 -0800 | [diff] [blame] | 118 | include $(CLEAR_VARS) | 
| David Pursell | 815c7be | 2015-12-09 17:09:54 -0800 | [diff] [blame] | 119 | LOCAL_MODULE := fastboot_test | 
|  | 120 | LOCAL_MODULE_HOST_OS := darwin linux windows | 
| Elliott Hughes | 6ebec93 | 2018-04-10 14:22:13 -0700 | [diff] [blame] | 121 | LOCAL_MODULE_HOST_CROSS_ARCH := x86 # Avoid trying to build for win64. | 
| David Pursell | 815c7be | 2015-12-09 17:09:54 -0800 | [diff] [blame] | 122 |  | 
| David Pursell | c3a4669 | 2016-01-29 08:10:50 -0800 | [diff] [blame] | 123 | LOCAL_SRC_FILES := \ | 
| Elliott Hughes | 6ebec93 | 2018-04-10 14:22:13 -0700 | [diff] [blame] | 124 | fastboot_test.cpp \ | 
| David Pursell | c3a4669 | 2016-01-29 08:10:50 -0800 | [diff] [blame] | 125 | socket_mock.cpp \ | 
|  | 126 | socket_test.cpp \ | 
| David Pursell | 2ec418a | 2016-01-20 08:32:08 -0800 | [diff] [blame] | 127 | tcp_test.cpp \ | 
| David Pursell | 4601c97 | 2016-02-05 15:35:09 -0800 | [diff] [blame] | 128 | udp_test.cpp \ | 
| David Pursell | c3a4669 | 2016-01-29 08:10:50 -0800 | [diff] [blame] | 129 |  | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 130 | LOCAL_CFLAGS := $(fastboot_cflags) | 
|  | 131 | LOCAL_CFLAGS_darwin := $(fastboot_cflags_darwin) | 
|  | 132 | LOCAL_CXX_STL := $(fastboot_stl) | 
| Elliott Hughes | 6ebec93 | 2018-04-10 14:22:13 -0700 | [diff] [blame] | 133 | LOCAL_HEADER_LIBRARIES := bootimg_headers | 
| Dan Willemsen | d81279f | 2018-04-10 22:55:55 -0700 | [diff] [blame] | 134 | LOCAL_LDLIBS_darwin := $(fastboot_ldlibs_darwin) | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 135 | LOCAL_LDLIBS_windows := $(fastboot_ldlibs_windows) | 
| Elliott Hughes | 6ebec93 | 2018-04-10 14:22:13 -0700 | [diff] [blame] | 136 | LOCAL_SHARED_LIBRARIES := $(fastboot_shared_libs) | 
|  | 137 | LOCAL_SHARED_LIBRARIES_windows := AdbWinApi | 
| Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 138 | LOCAL_STATIC_LIBRARIES := libfastboot $(fastboot_static_libs) | 
| David Pursell | 815c7be | 2015-12-09 17:09:54 -0800 | [diff] [blame] | 139 | include $(BUILD_HOST_NATIVE_TEST) |