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
17include $(CLEAR_VARS)
18
19LOCAL_C_INCLUDES := $(LOCAL_PATH)/../mkbootimg \
20  $(LOCAL_PATH)/../../extras/ext4_utils \
21  $(LOCAL_PATH)/../../extras/f2fs_utils
22LOCAL_SRC_FILES := protocol.c engine.c bootimg.c fastboot.c util.c fs.c
23LOCAL_MODULE := fastboot
24LOCAL_MODULE_TAGS := debug
25LOCAL_CFLAGS += -std=gnu99 -Werror
26
27ifeq ($(HOST_OS),linux)
28  LOCAL_SRC_FILES += usb_linux.c util_linux.c
29endif
30
31ifeq ($(HOST_OS),darwin)
32  LOCAL_SRC_FILES += usb_osx.c util_osx.c
33  LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit \
34	-framework Carbon
35endif
36
37ifeq ($(HOST_OS),windows)
38  LOCAL_SRC_FILES += usb_windows.c util_windows.c
39  EXTRA_STATIC_LIBS := AdbWinApi
40  ifneq ($(strip $(USE_CYGWIN)),)
41    # Pure cygwin case
42    LOCAL_LDLIBS += -lpthread
43  endif
44  ifneq ($(strip $(USE_MINGW)),)
45    # MinGW under Linux case
46    LOCAL_LDLIBS += -lws2_32
47    USE_SYSDEPS_WIN32 := 1
48  endif
49  LOCAL_C_INCLUDES += development/host/windows/usb/api
50endif
51
52LOCAL_STATIC_LIBRARIES := \
53    $(EXTRA_STATIC_LIBS) \
54    libzipfile \
55    libunz \
56    libext4_utils_host \
57    libsparse_host \
58    libz
59
60ifneq ($(HOST_OS),windows)
61LOCAL_STATIC_LIBRARIES += libselinux
62endif # HOST_OS != windows
63
64ifeq ($(HOST_OS),linux)
65# libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn")
66LOCAL_CFLAGS += -DUSE_F2FS
67LOCAL_LDFLAGS += -ldl -rdynamic -Wl,-rpath,.
68LOCAL_REQUIRED_MODULES := libf2fs_fmt_host_dyn
69# The following libf2fs_* are from system/extras/f2fs_utils,
70# and do not use code in external/f2fs-tools.
71LOCAL_STATIC_LIBRARIES += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
72endif
73
74include $(BUILD_HOST_EXECUTABLE)
75
76my_dist_files := $(LOCAL_BUILT_MODULE)
77ifeq ($(HOST_OS),linux)
78my_dist_files += $(HOST_LIBRARY_PATH)/libf2fs_fmt_host_dyn$(HOST_SHLIB_SUFFIX)
79endif
80$(call dist-for-goals,dist_files sdk,$(my_dist_files))
81my_dist_files :=
82
83
84ifeq ($(HOST_OS),linux)
85include $(CLEAR_VARS)
86LOCAL_SRC_FILES := usbtest.c usb_linux.c util.c
87LOCAL_MODULE := usbtest
88LOCAL_CFLAGS := -Werror
89include $(BUILD_HOST_EXECUTABLE)
90endif
91
92ifeq ($(HOST_OS),windows)
93$(LOCAL_INSTALLED_MODULE): $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll
94endif
95