blob: dd8bad9aa794dd25f0c228732d728d17b0ddca4d [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001# 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
Elliott Hughes4d4f64f2017-05-08 11:30:34 -070017include $(LOCAL_PATH)/../platform_tools_tool_version.mk
18
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080019include $(CLEAR_VARS)
20
SzuWei Linb3526e12017-05-10 18:15:03 +080021LOCAL_CFLAGS += -DFASTBOOT_VERSION="\"$(tool_version)\""
Elliott Hughes4d4f64f2017-05-08 11:30:34 -070022
Elliott Hughes1b708d32015-12-11 19:07:01 -080023LOCAL_C_INCLUDES := \
24 $(LOCAL_PATH)/../adb \
25 $(LOCAL_PATH)/../mkbootimg \
Elliott Hughes1b708d32015-12-11 19:07:01 -080026 $(LOCAL_PATH)/../../extras/f2fs_utils \
27
David Pursell572bce22016-01-15 14:19:56 -080028LOCAL_SRC_FILES := \
29 bootimg_utils.cpp \
30 engine.cpp \
31 fastboot.cpp \
32 fs.cpp\
33 protocol.cpp \
34 socket.cpp \
David Pursell2ec418a2016-01-20 08:32:08 -080035 tcp.cpp \
David Pursell4601c972016-02-05 15:35:09 -080036 udp.cpp \
David Pursell572bce22016-01-15 14:19:56 -080037 util.cpp \
38
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080039LOCAL_MODULE := fastboot
Kenny Rootd5d6d972012-09-26 09:58:07 -070040LOCAL_MODULE_TAGS := debug
Dan Willemsen87a419c2015-08-13 14:43:34 -070041LOCAL_MODULE_HOST_OS := darwin linux windows
Narayan Kamathf6e9ffb2015-05-11 16:59:46 +010042LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
Jin Qiand14d7c12017-04-18 18:19:12 -070043LOCAL_REQUIRED_MODULES := mke2fs e2fsdroid
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080044
Elliott Hughes82ff3152016-08-31 15:07:18 -070045LOCAL_SRC_FILES_linux := usb_linux.cpp
David Pursell0eb8e1b2016-01-14 17:18:27 -080046LOCAL_STATIC_LIBRARIES_linux := libselinux
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080047
Elliott Hughes82ff3152016-08-31 15:07:18 -070048LOCAL_SRC_FILES_darwin := usb_osx.cpp
David Pursell0eb8e1b2016-01-14 17:18:27 -080049LOCAL_STATIC_LIBRARIES_darwin := libselinux
Dan Willemsen87a419c2015-08-13 14:43:34 -070050LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
51LOCAL_CFLAGS_darwin := -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080052
Elliott Hughes82ff3152016-08-31 15:07:18 -070053LOCAL_SRC_FILES_windows := usb_windows.cpp
Dan Willemsen87a419c2015-08-13 14:43:34 -070054LOCAL_STATIC_LIBRARIES_windows := AdbWinApi
Chris Fries4bf1be72017-04-11 09:40:40 -050055LOCAL_REQUIRED_MODULES_windows := AdbWinApi AdbWinUsbApi
Dan Willemsen87a419c2015-08-13 14:43:34 -070056LOCAL_LDLIBS_windows := -lws2_32
57LOCAL_C_INCLUDES_windows := development/host/windows/usb/api
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080058
Joe Onorato2ffe3c82012-07-18 12:03:33 -070059LOCAL_STATIC_LIBRARIES := \
Colin Cross99f6b862016-08-26 11:12:38 -070060 libziparchive \
Alex Deymo705353a2017-01-11 14:03:11 -080061 libext4_utils \
Alex Deymob0c39592017-01-11 14:37:50 -080062 libsparse \
Elliott Hughesd30ad8a2015-03-18 23:12:44 -070063 libutils \
64 liblog \
Narayan Kamathe97e66e2015-04-27 16:25:53 +010065 libz \
Elliott Hughes1b708d32015-12-11 19:07:01 -080066 libdiagnose_usb \
Elliott Hughesc1fd4922015-11-11 18:02:29 +000067 libbase \
David Pursell0eb8e1b2016-01-14 17:18:27 -080068 libcutils \
David Pursellb34e4a02016-02-01 09:42:09 -080069 libgtest_host \
JP Abgrall6bd72be2014-06-17 23:43:18 -070070
JP Abgrall6bd72be2014-06-17 23:43:18 -070071# libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn")
Dan Willemsen87a419c2015-08-13 14:43:34 -070072LOCAL_CFLAGS_linux := -DUSE_F2FS
73LOCAL_LDFLAGS_linux := -ldl -rdynamic -Wl,-rpath,.
74LOCAL_REQUIRED_MODULES_linux := libf2fs_fmt_host_dyn
JP Abgrall6bd72be2014-06-17 23:43:18 -070075# The following libf2fs_* are from system/extras/f2fs_utils,
76# and do not use code in external/f2fs-tools.
Dan Willemsen87a419c2015-08-13 14:43:34 -070077LOCAL_STATIC_LIBRARIES_linux += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
JP Abgrall6bd72be2014-06-17 23:43:18 -070078
Dan Willemsen87a419c2015-08-13 14:43:34 -070079LOCAL_CXX_STL := libc++_static
Colin Cross55bf5f02015-04-16 16:21:44 -070080
81# Don't add anything here, we don't want additional shared dependencies
82# on the host fastboot tool, and shared libraries that link against libc++
83# will violate ODR
84LOCAL_SHARED_LIBRARIES :=
85
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080086include $(BUILD_HOST_EXECUTABLE)
Joe Onorato5069b012012-07-23 19:15:14 -070087
Ying Wang6b048ce2014-06-19 14:15:03 -070088my_dist_files := $(LOCAL_BUILT_MODULE)
Jin Qian6ce78322017-07-19 15:19:16 -070089my_dist_files += $(HOST_OUT_EXECUTABLES)/mke2fs$(HOST_EXECUTABLE_SUFFIX)
90my_dist_files += $(HOST_OUT_EXECUTABLES)/e2fsdroid$(HOST_EXECUTABLE_SUFFIX)
Ying Wang6b048ce2014-06-19 14:15:03 -070091ifeq ($(HOST_OS),linux)
92my_dist_files += $(HOST_LIBRARY_PATH)/libf2fs_fmt_host_dyn$(HOST_SHLIB_SUFFIX)
93endif
Ying Wang71edfc82016-02-29 19:27:06 -080094$(call dist-for-goals,dist_files sdk win_sdk,$(my_dist_files))
95ifdef HOST_CROSS_OS
96# Archive fastboot.exe for win_sdk build.
97$(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_fastboot.BUILT))
98endif
Ying Wang6b048ce2014-06-19 14:15:03 -070099my_dist_files :=
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800100
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800101ifeq ($(HOST_OS),linux)
102include $(CLEAR_VARS)
Elliott Hughesb3748de2015-06-23 20:27:58 -0700103LOCAL_SRC_FILES := usbtest.cpp usb_linux.cpp util.cpp
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800104LOCAL_MODULE := usbtest
Mark Salyzyn5957c1f2014-04-30 14:05:28 -0700105LOCAL_CFLAGS := -Werror
David Pursell0b156632015-10-30 11:22:01 -0700106LOCAL_STATIC_LIBRARIES := libbase
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800107include $(BUILD_HOST_EXECUTABLE)
108endif
David Pursell815c7be2015-12-09 17:09:54 -0800109
110# fastboot_test
111# =========================================================
112include $(CLEAR_VARS)
113
114LOCAL_MODULE := fastboot_test
115LOCAL_MODULE_HOST_OS := darwin linux windows
116
David Pursellc3a46692016-01-29 08:10:50 -0800117LOCAL_SRC_FILES := \
118 socket.cpp \
119 socket_mock.cpp \
120 socket_test.cpp \
David Pursell2ec418a2016-01-20 08:32:08 -0800121 tcp.cpp \
122 tcp_test.cpp \
David Pursell4601c972016-02-05 15:35:09 -0800123 udp.cpp \
124 udp_test.cpp \
David Pursellc3a46692016-01-29 08:10:50 -0800125
David Pursell0eb8e1b2016-01-14 17:18:27 -0800126LOCAL_STATIC_LIBRARIES := libbase libcutils
David Pursell815c7be2015-12-09 17:09:54 -0800127
128LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
129
David Pursell815c7be2015-12-09 17:09:54 -0800130LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
131LOCAL_CFLAGS_darwin := -Wno-unused-parameter
David Pursell815c7be2015-12-09 17:09:54 -0800132
David Pursell815c7be2015-12-09 17:09:54 -0800133LOCAL_LDLIBS_windows := -lws2_32
134
135include $(BUILD_HOST_NATIVE_TEST)