Android.mk revision 6b048ce839ce0bcbce684284f68a2f32ee9d764c
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    LOCAL_C_INCLUDES += /usr/include/w32api/ddk
44  endif
45  ifneq ($(strip $(USE_MINGW)),)
46    # MinGW under Linux case
47    LOCAL_LDLIBS += -lws2_32
48    USE_SYSDEPS_WIN32 := 1
49    LOCAL_C_INCLUDES += /usr/i586-mingw32msvc/include/ddk
50  endif
51  LOCAL_C_INCLUDES += development/host/windows/usb/api
52endif
53
54LOCAL_STATIC_LIBRARIES := \
55    $(EXTRA_STATIC_LIBS) \
56    libzipfile \
57    libunz \
58    libext4_utils_host \
59    libsparse_host \
60    libz
61
62ifneq ($(HOST_OS),windows)
63LOCAL_STATIC_LIBRARIES += libselinux
64endif # HOST_OS != windows
65
66ifeq ($(HOST_OS),linux)
67# libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn")
68LOCAL_CFLAGS += -DUSE_F2FS
69LOCAL_LDFLAGS += -ldl -rdynamic
70LOCAL_REQUIRED_MODULES := libf2fs_fmt_host_dyn
71# The following libf2fs_* are from system/extras/f2fs_utils,
72# and do not use code in external/f2fs-tools.
73LOCAL_STATIC_LIBRARIES += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
74endif
75
76include $(BUILD_HOST_EXECUTABLE)
77
78my_dist_files := $(LOCAL_BUILT_MODULE)
79ifeq ($(HOST_OS),linux)
80my_dist_files += $(HOST_LIBRARY_PATH)/libf2fs_fmt_host_dyn$(HOST_SHLIB_SUFFIX)
81endif
82$(call dist-for-goals,dist_files sdk,$(my_dist_files))
83my_dist_files :=
84
85
86ifeq ($(HOST_OS),linux)
87include $(CLEAR_VARS)
88LOCAL_SRC_FILES := usbtest.c usb_linux.c util.c
89LOCAL_MODULE := usbtest
90LOCAL_CFLAGS := -Werror
91include $(BUILD_HOST_EXECUTABLE)
92endif
93
94ifeq ($(HOST_OS),windows)
95$(LOCAL_INSTALLED_MODULE): $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll
96endif
97