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