blob: 7112d1dc0d303cb5a210f5dbae3a54d428a682cf [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 Hughes379646b2015-06-02 13:50:00 -070017fastboot_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
18
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080019include $(CLEAR_VARS)
20
Elliott Hughes1b708d32015-12-11 19:07:01 -080021LOCAL_C_INCLUDES := \
22 $(LOCAL_PATH)/../adb \
23 $(LOCAL_PATH)/../mkbootimg \
JP Abgrall12351582014-06-17 17:01:14 -070024 $(LOCAL_PATH)/../../extras/ext4_utils \
Elliott Hughes1b708d32015-12-11 19:07:01 -080025 $(LOCAL_PATH)/../../extras/f2fs_utils \
26
David Pursell572bce22016-01-15 14:19:56 -080027LOCAL_SRC_FILES := \
28 bootimg_utils.cpp \
29 engine.cpp \
30 fastboot.cpp \
31 fs.cpp\
32 protocol.cpp \
33 socket.cpp \
David Pursell2ec418a2016-01-20 08:32:08 -080034 tcp.cpp \
David Pursell4601c972016-02-05 15:35:09 -080035 udp.cpp \
David Pursell572bce22016-01-15 14:19:56 -080036 util.cpp \
37
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080038LOCAL_MODULE := fastboot
Kenny Rootd5d6d972012-09-26 09:58:07 -070039LOCAL_MODULE_TAGS := debug
Dan Willemsen87a419c2015-08-13 14:43:34 -070040LOCAL_MODULE_HOST_OS := darwin linux windows
Elliott Hughes253c18d2015-03-18 22:47:09 -070041LOCAL_CONLYFLAGS += -std=gnu99
Narayan Kamathf6e9ffb2015-05-11 16:59:46 +010042LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080043
Elliott Hughes379646b2015-06-02 13:50:00 -070044LOCAL_CFLAGS += -DFASTBOOT_REVISION='"$(fastboot_version)"'
45
Elliott Hughes82ff3152016-08-31 15:07:18 -070046LOCAL_SRC_FILES_linux := usb_linux.cpp
David Pursell0eb8e1b2016-01-14 17:18:27 -080047LOCAL_STATIC_LIBRARIES_linux := libselinux
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080048
Elliott Hughes82ff3152016-08-31 15:07:18 -070049LOCAL_SRC_FILES_darwin := usb_osx.cpp
David Pursell0eb8e1b2016-01-14 17:18:27 -080050LOCAL_STATIC_LIBRARIES_darwin := libselinux
Dan Willemsen87a419c2015-08-13 14:43:34 -070051LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
52LOCAL_CFLAGS_darwin := -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080053
Elliott Hughes82ff3152016-08-31 15:07:18 -070054LOCAL_SRC_FILES_windows := usb_windows.cpp
Dan Willemsen87a419c2015-08-13 14:43:34 -070055LOCAL_STATIC_LIBRARIES_windows := AdbWinApi
56LOCAL_REQUIRED_MODULES_windows := AdbWinApi
57LOCAL_LDLIBS_windows := -lws2_32
58LOCAL_C_INCLUDES_windows := development/host/windows/usb/api
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080059
Joe Onorato2ffe3c82012-07-18 12:03:33 -070060LOCAL_STATIC_LIBRARIES := \
Colin Cross99f6b862016-08-26 11:12:38 -070061 libziparchive \
Joe Onorato2ffe3c82012-07-18 12:03:33 -070062 libext4_utils_host \
Joe Onorato5069b012012-07-23 19:15:14 -070063 libsparse_host \
Elliott Hughesd30ad8a2015-03-18 23:12:44 -070064 libutils \
65 liblog \
Narayan Kamathe97e66e2015-04-27 16:25:53 +010066 libz \
Elliott Hughes1b708d32015-12-11 19:07:01 -080067 libdiagnose_usb \
Elliott Hughesc1fd4922015-11-11 18:02:29 +000068 libbase \
David Pursell0eb8e1b2016-01-14 17:18:27 -080069 libcutils \
David Pursellb34e4a02016-02-01 09:42:09 -080070 libgtest_host \
JP Abgrall6bd72be2014-06-17 23:43:18 -070071
JP Abgrall6bd72be2014-06-17 23:43:18 -070072# libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn")
Dan Willemsen87a419c2015-08-13 14:43:34 -070073LOCAL_CFLAGS_linux := -DUSE_F2FS
74LOCAL_LDFLAGS_linux := -ldl -rdynamic -Wl,-rpath,.
75LOCAL_REQUIRED_MODULES_linux := libf2fs_fmt_host_dyn
JP Abgrall6bd72be2014-06-17 23:43:18 -070076# The following libf2fs_* are from system/extras/f2fs_utils,
77# and do not use code in external/f2fs-tools.
Dan Willemsen87a419c2015-08-13 14:43:34 -070078LOCAL_STATIC_LIBRARIES_linux += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
JP Abgrall6bd72be2014-06-17 23:43:18 -070079
Dan Willemsen87a419c2015-08-13 14:43:34 -070080LOCAL_CXX_STL := libc++_static
Colin Cross55bf5f02015-04-16 16:21:44 -070081
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
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080087include $(BUILD_HOST_EXECUTABLE)
Joe Onorato5069b012012-07-23 19:15:14 -070088
Ying Wang6b048ce2014-06-19 14:15:03 -070089my_dist_files := $(LOCAL_BUILT_MODULE)
90ifeq ($(HOST_OS),linux)
91my_dist_files += $(HOST_LIBRARY_PATH)/libf2fs_fmt_host_dyn$(HOST_SHLIB_SUFFIX)
92endif
Ying Wang71edfc82016-02-29 19:27:06 -080093$(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
Ying Wang6b048ce2014-06-19 14:15:03 -070098my_dist_files :=
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080099
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800100ifeq ($(HOST_OS),linux)
101include $(CLEAR_VARS)
Elliott Hughesb3748de2015-06-23 20:27:58 -0700102LOCAL_SRC_FILES := usbtest.cpp usb_linux.cpp util.cpp
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800103LOCAL_MODULE := usbtest
Mark Salyzyn5957c1f2014-04-30 14:05:28 -0700104LOCAL_CFLAGS := -Werror
David Pursell0b156632015-10-30 11:22:01 -0700105LOCAL_STATIC_LIBRARIES := libbase
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800106include $(BUILD_HOST_EXECUTABLE)
107endif
David Pursell815c7be2015-12-09 17:09:54 -0800108
109# fastboot_test
110# =========================================================
111include $(CLEAR_VARS)
112
113LOCAL_MODULE := fastboot_test
114LOCAL_MODULE_HOST_OS := darwin linux windows
115
David Pursellc3a46692016-01-29 08:10:50 -0800116LOCAL_SRC_FILES := \
117 socket.cpp \
118 socket_mock.cpp \
119 socket_test.cpp \
David Pursell2ec418a2016-01-20 08:32:08 -0800120 tcp.cpp \
121 tcp_test.cpp \
David Pursell4601c972016-02-05 15:35:09 -0800122 udp.cpp \
123 udp_test.cpp \
David Pursellc3a46692016-01-29 08:10:50 -0800124
David Pursell0eb8e1b2016-01-14 17:18:27 -0800125LOCAL_STATIC_LIBRARIES := libbase libcutils
David Pursell815c7be2015-12-09 17:09:54 -0800126
127LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
128
David Pursell815c7be2015-12-09 17:09:54 -0800129LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
130LOCAL_CFLAGS_darwin := -Wno-unused-parameter
David Pursell815c7be2015-12-09 17:09:54 -0800131
David Pursell815c7be2015-12-09 17:09:54 -0800132LOCAL_LDLIBS_windows := -lws2_32
133
134include $(BUILD_HOST_NATIVE_TEST)