blob: 983e195dc3369a1d6255b15e59648922dab38857 [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
Elliott Hughes11ff3452018-04-09 13:58:41 -070019fastboot_cflags := -Wall -Wextra -Werror -Wunreachable-code
20fastboot_cflags += -DFASTBOOT_VERSION="\"$(tool_version)\""
21fastboot_cflags_darwin := -Wno-unused-parameter
22fastboot_ldlibs_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
23fastboot_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.
27fastboot_shared_libs :=
28fastboot_static_libs := \
29 libziparchive \
30 libsparse \
31 libutils \
32 liblog \
33 libz \
34 libdiagnose_usb \
35 libbase \
36 libcutils \
37 libgtest_host \
38
39fastboot_stl := libc++_static
40
41#
42# Build host libfastboot.
43#
44
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080045include $(CLEAR_VARS)
Elliott Hughes11ff3452018-04-09 13:58:41 -070046LOCAL_MODULE := libfastboot
47LOCAL_MODULE_HOST_OS := darwin linux windows
Elliott Hughes1b708d32015-12-11 19:07:01 -080048
David Pursell572bce22016-01-15 14:19:56 -080049LOCAL_SRC_FILES := \
50 bootimg_utils.cpp \
51 engine.cpp \
52 fastboot.cpp \
53 fs.cpp\
54 protocol.cpp \
55 socket.cpp \
David Pursell2ec418a2016-01-20 08:32:08 -080056 tcp.cpp \
David Pursell4601c972016-02-05 15:35:09 -080057 udp.cpp \
David Pursell572bce22016-01-15 14:19:56 -080058 util.cpp \
59
Elliott Hughes82ff3152016-08-31 15:07:18 -070060LOCAL_SRC_FILES_darwin := usb_osx.cpp
Elliott Hughes11ff3452018-04-09 13:58:41 -070061LOCAL_SRC_FILES_linux := usb_linux.cpp
Elliott Hughes82ff3152016-08-31 15:07:18 -070062LOCAL_SRC_FILES_windows := usb_windows.cpp
Elliott Hughes11ff3452018-04-09 13:58:41 -070063
Dan Willemsen87a419c2015-08-13 14:43:34 -070064LOCAL_C_INCLUDES_windows := development/host/windows/usb/api
Elliott Hughes11ff3452018-04-09 13:58:41 -070065LOCAL_CFLAGS := $(fastboot_cflags)
66LOCAL_CFLAGS_darwin := $(fastboot_cflags_darwin)
67LOCAL_CXX_STL := $(fastboot_stl)
68LOCAL_HEADER_LIBRARIES := bootimg_headers
Dan Willemsend81279f2018-04-10 22:55:55 -070069LOCAL_LDLIBS_darwin := $(fastboot_ldlibs_darwin)
Elliott Hughes11ff3452018-04-09 13:58:41 -070070LOCAL_LDLIBS_windows := $(fastboot_ldlibs_windows)
71LOCAL_SHARED_LIBRARIES := $(fastboot_shared_libs)
72LOCAL_STATIC_LIBRARIES := $(fastboot_static_libs)
73include $(BUILD_HOST_STATIC_LIBRARY)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080074
Elliott Hughes11ff3452018-04-09 13:58:41 -070075#
76# Build host fastboot / fastboot.exe
77#
JP Abgrall6bd72be2014-06-17 23:43:18 -070078
Elliott Hughes11ff3452018-04-09 13:58:41 -070079include $(CLEAR_VARS)
80LOCAL_MODULE := fastboot
81LOCAL_MODULE_HOST_OS := darwin linux windows
Colin Cross55bf5f02015-04-16 16:21:44 -070082
Elliott Hughes11ff3452018-04-09 13:58:41 -070083LOCAL_CFLAGS := $(fastboot_cflags)
84LOCAL_CFLAGS_darwin := $(fastboot_cflags_darwin)
85LOCAL_CXX_STL := $(fastboot_stl)
Elliott Hughes6ebec932018-04-10 14:22:13 -070086LOCAL_HEADER_LIBRARIES := bootimg_headers
Dan Willemsend81279f2018-04-10 22:55:55 -070087LOCAL_LDLIBS_darwin := $(fastboot_ldlibs_darwin)
Elliott Hughes11ff3452018-04-09 13:58:41 -070088LOCAL_LDLIBS_windows := $(fastboot_ldlibs_windows)
89LOCAL_REQUIRED_MODULES := mke2fs make_f2fs
90LOCAL_REQUIRED_MODULES_darwin := e2fsdroid mke2fs.conf sload_f2fs
91LOCAL_REQUIRED_MODULES_linux := e2fsdroid mke2fs.conf sload_f2fs
92LOCAL_REQUIRED_MODULES_windows := AdbWinUsbApi
93LOCAL_SRC_FILES := main.cpp
94LOCAL_SHARED_LIBRARIES := $(fastboot_shared_libs)
95LOCAL_SHARED_LIBRARIES_windows := AdbWinApi
96LOCAL_STATIC_LIBRARIES := libfastboot $(fastboot_static_libs)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080097include $(BUILD_HOST_EXECUTABLE)
Joe Onorato5069b012012-07-23 19:15:14 -070098
Elliott Hughes11ff3452018-04-09 13:58:41 -070099#
100# Package fastboot-related executables.
101#
102
Dan Willemsen94e4dc22018-04-09 14:26:23 -0700103my_dist_files := $(HOST_OUT_EXECUTABLES)/fastboot
Elliott Hughes645b50e2018-05-08 11:30:07 -0700104my_dist_files += $(HOST_OUT_EXECUTABLES)/mke2fs
105my_dist_files += $(HOST_OUT_EXECUTABLES)/e2fsdroid
106my_dist_files += $(HOST_OUT_EXECUTABLES)/make_f2fs
107my_dist_files += $(HOST_OUT_EXECUTABLES)/sload_f2fs
Ying Wang71edfc82016-02-29 19:27:06 -0800108$(call dist-for-goals,dist_files sdk win_sdk,$(my_dist_files))
109ifdef HOST_CROSS_OS
Elliott Hughes645b50e2018-05-08 11:30:07 -0700110$(call dist-for-goals,dist_files sdk win_sdk,$(ALL_MODULES.host_cross_fastboot.BUILT))
Ying Wang71edfc82016-02-29 19:27:06 -0800111endif
Ying Wang6b048ce2014-06-19 14:15:03 -0700112my_dist_files :=
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800113
Elliott Hughes11ff3452018-04-09 13:58:41 -0700114#
115# Build host fastboot_test.
116#
David Pursell815c7be2015-12-09 17:09:54 -0800117
David Pursell815c7be2015-12-09 17:09:54 -0800118include $(CLEAR_VARS)
David Pursell815c7be2015-12-09 17:09:54 -0800119LOCAL_MODULE := fastboot_test
120LOCAL_MODULE_HOST_OS := darwin linux windows
Elliott Hughes6ebec932018-04-10 14:22:13 -0700121LOCAL_MODULE_HOST_CROSS_ARCH := x86 # Avoid trying to build for win64.
David Pursell815c7be2015-12-09 17:09:54 -0800122
David Pursellc3a46692016-01-29 08:10:50 -0800123LOCAL_SRC_FILES := \
Elliott Hughes6ebec932018-04-10 14:22:13 -0700124 fastboot_test.cpp \
David Pursellc3a46692016-01-29 08:10:50 -0800125 socket_mock.cpp \
126 socket_test.cpp \
David Pursell2ec418a2016-01-20 08:32:08 -0800127 tcp_test.cpp \
David Pursell4601c972016-02-05 15:35:09 -0800128 udp_test.cpp \
David Pursellc3a46692016-01-29 08:10:50 -0800129
Elliott Hughes11ff3452018-04-09 13:58:41 -0700130LOCAL_CFLAGS := $(fastboot_cflags)
131LOCAL_CFLAGS_darwin := $(fastboot_cflags_darwin)
132LOCAL_CXX_STL := $(fastboot_stl)
Elliott Hughes6ebec932018-04-10 14:22:13 -0700133LOCAL_HEADER_LIBRARIES := bootimg_headers
Dan Willemsend81279f2018-04-10 22:55:55 -0700134LOCAL_LDLIBS_darwin := $(fastboot_ldlibs_darwin)
Elliott Hughes11ff3452018-04-09 13:58:41 -0700135LOCAL_LDLIBS_windows := $(fastboot_ldlibs_windows)
Elliott Hughes6ebec932018-04-10 14:22:13 -0700136LOCAL_SHARED_LIBRARIES := $(fastboot_shared_libs)
137LOCAL_SHARED_LIBRARIES_windows := AdbWinApi
Elliott Hughes11ff3452018-04-09 13:58:41 -0700138LOCAL_STATIC_LIBRARIES := libfastboot $(fastboot_static_libs)
David Pursell815c7be2015-12-09 17:09:54 -0800139include $(BUILD_HOST_NATIVE_TEST)