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 15LOCAL_PATH:= $(call my-dir) 16 17fastboot_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android 18 19include $(CLEAR_VARS) 20 21LOCAL_C_INCLUDES := \ 22 $(LOCAL_PATH)/../adb \ 23 $(LOCAL_PATH)/../mkbootimg \ 24 $(LOCAL_PATH)/../../extras/f2fs_utils \ 25 26LOCAL_SRC_FILES := \ 27 bootimg_utils.cpp \ 28 engine.cpp \ 29 fastboot.cpp \ 30 fs.cpp\ 31 protocol.cpp \ 32 socket.cpp \ 33 tcp.cpp \ 34 udp.cpp \ 35 util.cpp \ 36 37LOCAL_MODULE := fastboot 38LOCAL_MODULE_TAGS := debug 39LOCAL_MODULE_HOST_OS := darwin linux windows 40LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code 41 42LOCAL_CFLAGS += -DFASTBOOT_REVISION='"$(fastboot_version)"' 43 44LOCAL_SRC_FILES_linux := usb_linux.cpp 45LOCAL_STATIC_LIBRARIES_linux := libselinux 46 47LOCAL_SRC_FILES_darwin := usb_osx.cpp 48LOCAL_STATIC_LIBRARIES_darwin := libselinux 49LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon 50LOCAL_CFLAGS_darwin := -Wno-unused-parameter 51 52LOCAL_SRC_FILES_windows := usb_windows.cpp 53LOCAL_STATIC_LIBRARIES_windows := AdbWinApi 54LOCAL_REQUIRED_MODULES_windows := AdbWinApi 55LOCAL_LDLIBS_windows := -lws2_32 56LOCAL_C_INCLUDES_windows := development/host/windows/usb/api 57 58LOCAL_STATIC_LIBRARIES := \ 59 libziparchive \ 60 libext4_utils \ 61 libsparse \ 62 libutils \ 63 liblog \ 64 libz \ 65 libdiagnose_usb \ 66 libbase \ 67 libcutils \ 68 libgtest_host \ 69 70# libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn") 71LOCAL_CFLAGS_linux := -DUSE_F2FS 72LOCAL_LDFLAGS_linux := -ldl -rdynamic -Wl,-rpath,. 73LOCAL_REQUIRED_MODULES_linux := libf2fs_fmt_host_dyn 74# The following libf2fs_* are from system/extras/f2fs_utils, 75# and do not use code in external/f2fs-tools. 76LOCAL_STATIC_LIBRARIES_linux += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host 77 78LOCAL_CXX_STL := libc++_static 79 80# Don't add anything here, we don't want additional shared dependencies 81# on the host fastboot tool, and shared libraries that link against libc++ 82# will violate ODR 83LOCAL_SHARED_LIBRARIES := 84 85include $(BUILD_HOST_EXECUTABLE) 86 87my_dist_files := $(LOCAL_BUILT_MODULE) 88ifeq ($(HOST_OS),linux) 89my_dist_files += $(HOST_LIBRARY_PATH)/libf2fs_fmt_host_dyn$(HOST_SHLIB_SUFFIX) 90endif 91$(call dist-for-goals,dist_files sdk win_sdk,$(my_dist_files)) 92ifdef HOST_CROSS_OS 93# Archive fastboot.exe for win_sdk build. 94$(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_fastboot.BUILT)) 95endif 96my_dist_files := 97 98ifeq ($(HOST_OS),linux) 99include $(CLEAR_VARS) 100LOCAL_SRC_FILES := usbtest.cpp usb_linux.cpp util.cpp 101LOCAL_MODULE := usbtest 102LOCAL_CFLAGS := -Werror 103LOCAL_STATIC_LIBRARIES := libbase 104include $(BUILD_HOST_EXECUTABLE) 105endif 106 107# fastboot_test 108# ========================================================= 109include $(CLEAR_VARS) 110 111LOCAL_MODULE := fastboot_test 112LOCAL_MODULE_HOST_OS := darwin linux windows 113 114LOCAL_SRC_FILES := \ 115 socket.cpp \ 116 socket_mock.cpp \ 117 socket_test.cpp \ 118 tcp.cpp \ 119 tcp_test.cpp \ 120 udp.cpp \ 121 udp_test.cpp \ 122 123LOCAL_STATIC_LIBRARIES := libbase libcutils 124 125LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code 126 127LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon 128LOCAL_CFLAGS_darwin := -Wno-unused-parameter 129 130LOCAL_LDLIBS_windows := -lws2_32 131 132include $(BUILD_HOST_NATIVE_TEST) 133