blob: 11d769badc2ff978627da7d4310b27aaa0def516 [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 \
34 util.cpp \
35
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080036LOCAL_MODULE := fastboot
Kenny Rootd5d6d972012-09-26 09:58:07 -070037LOCAL_MODULE_TAGS := debug
Dan Willemsen87a419c2015-08-13 14:43:34 -070038LOCAL_MODULE_HOST_OS := darwin linux windows
Elliott Hughes253c18d2015-03-18 22:47:09 -070039LOCAL_CONLYFLAGS += -std=gnu99
Narayan Kamathf6e9ffb2015-05-11 16:59:46 +010040LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080041
Elliott Hughes379646b2015-06-02 13:50:00 -070042LOCAL_CFLAGS += -DFASTBOOT_REVISION='"$(fastboot_version)"'
43
David Pursell572bce22016-01-15 14:19:56 -080044LOCAL_SRC_FILES_linux := usb_linux.cpp util_linux.cpp
David Pursell0eb8e1b2016-01-14 17:18:27 -080045LOCAL_STATIC_LIBRARIES_linux := libselinux
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080046
David Pursell572bce22016-01-15 14:19:56 -080047LOCAL_SRC_FILES_darwin := usb_osx.cpp util_osx.cpp
David Pursell0eb8e1b2016-01-14 17:18:27 -080048LOCAL_STATIC_LIBRARIES_darwin := libselinux
Dan Willemsen87a419c2015-08-13 14:43:34 -070049LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
50LOCAL_CFLAGS_darwin := -Wno-unused-parameter
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080051
David Pursell572bce22016-01-15 14:19:56 -080052LOCAL_SRC_FILES_windows := usb_windows.cpp util_windows.cpp
Dan Willemsen87a419c2015-08-13 14:43:34 -070053LOCAL_STATIC_LIBRARIES_windows := AdbWinApi
54LOCAL_REQUIRED_MODULES_windows := AdbWinApi
55LOCAL_LDLIBS_windows := -lws2_32
56LOCAL_C_INCLUDES_windows := development/host/windows/usb/api
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080057
Joe Onorato2ffe3c82012-07-18 12:03:33 -070058LOCAL_STATIC_LIBRARIES := \
Elliott Hughesd30ad8a2015-03-18 23:12:44 -070059 libziparchive-host \
Joe Onorato2ffe3c82012-07-18 12:03:33 -070060 libext4_utils_host \
Joe Onorato5069b012012-07-23 19:15:14 -070061 libsparse_host \
Elliott Hughesd30ad8a2015-03-18 23:12:44 -070062 libutils \
63 liblog \
Narayan Kamathe97e66e2015-04-27 16:25:53 +010064 libz \
Elliott Hughes1b708d32015-12-11 19:07:01 -080065 libdiagnose_usb \
Elliott Hughesc1fd4922015-11-11 18:02:29 +000066 libbase \
David Pursell0eb8e1b2016-01-14 17:18:27 -080067 libcutils \
David Pursellb34e4a02016-02-01 09:42:09 -080068 libgtest_host \
JP Abgrall6bd72be2014-06-17 23:43:18 -070069
JP Abgrall6bd72be2014-06-17 23:43:18 -070070# libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn")
Dan Willemsen87a419c2015-08-13 14:43:34 -070071LOCAL_CFLAGS_linux := -DUSE_F2FS
72LOCAL_LDFLAGS_linux := -ldl -rdynamic -Wl,-rpath,.
73LOCAL_REQUIRED_MODULES_linux := libf2fs_fmt_host_dyn
JP Abgrall6bd72be2014-06-17 23:43:18 -070074# The following libf2fs_* are from system/extras/f2fs_utils,
75# and do not use code in external/f2fs-tools.
Dan Willemsen87a419c2015-08-13 14:43:34 -070076LOCAL_STATIC_LIBRARIES_linux += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
JP Abgrall6bd72be2014-06-17 23:43:18 -070077
Dan Willemsen87a419c2015-08-13 14:43:34 -070078LOCAL_CXX_STL := libc++_static
Colin Cross55bf5f02015-04-16 16:21:44 -070079
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
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080085include $(BUILD_HOST_EXECUTABLE)
Joe Onorato5069b012012-07-23 19:15:14 -070086
Ying Wang6b048ce2014-06-19 14:15:03 -070087my_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,$(my_dist_files))
92my_dist_files :=
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080093
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080094ifeq ($(HOST_OS),linux)
95include $(CLEAR_VARS)
Elliott Hughesb3748de2015-06-23 20:27:58 -070096LOCAL_SRC_FILES := usbtest.cpp usb_linux.cpp util.cpp
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080097LOCAL_MODULE := usbtest
Mark Salyzyn5957c1f2014-04-30 14:05:28 -070098LOCAL_CFLAGS := -Werror
David Pursell0b156632015-10-30 11:22:01 -070099LOCAL_STATIC_LIBRARIES := libbase
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800100include $(BUILD_HOST_EXECUTABLE)
101endif
David Pursell815c7be2015-12-09 17:09:54 -0800102
103# fastboot_test
104# =========================================================
105include $(CLEAR_VARS)
106
107LOCAL_MODULE := fastboot_test
108LOCAL_MODULE_HOST_OS := darwin linux windows
109
David Pursellc3a46692016-01-29 08:10:50 -0800110LOCAL_SRC_FILES := \
111 socket.cpp \
112 socket_mock.cpp \
113 socket_test.cpp \
114
David Pursell0eb8e1b2016-01-14 17:18:27 -0800115LOCAL_STATIC_LIBRARIES := libbase libcutils
David Pursell815c7be2015-12-09 17:09:54 -0800116
117LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
118
David Pursell815c7be2015-12-09 17:09:54 -0800119LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
120LOCAL_CFLAGS_darwin := -Wno-unused-parameter
David Pursell815c7be2015-12-09 17:09:54 -0800121
David Pursell815c7be2015-12-09 17:09:54 -0800122LOCAL_LDLIBS_windows := -lws2_32
123
124include $(BUILD_HOST_NATIVE_TEST)