Home | History | Annotate | Download | only in fastboot
      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 
     15 LOCAL_PATH:= $(call my-dir)
     16 
     17 include $(CLEAR_VARS)
     18 
     19 LOCAL_C_INCLUDES := $(LOCAL_PATH)/../mkbootimg \
     20   $(LOCAL_PATH)/../../extras/ext4_utils \
     21   $(LOCAL_PATH)/../../extras/f2fs_utils
     22 LOCAL_SRC_FILES := protocol.c engine.c bootimg.c fastboot.c util.c fs.c
     23 LOCAL_MODULE := fastboot
     24 LOCAL_MODULE_TAGS := debug
     25 LOCAL_CFLAGS += -std=gnu99 -Werror
     26 
     27 ifeq ($(HOST_OS),linux)
     28   LOCAL_SRC_FILES += usb_linux.c util_linux.c
     29 endif
     30 
     31 ifeq ($(HOST_OS),darwin)
     32   LOCAL_SRC_FILES += usb_osx.c util_osx.c
     33   LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit \
     34 	-framework Carbon
     35 endif
     36 
     37 ifeq ($(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
     50 endif
     51 
     52 LOCAL_STATIC_LIBRARIES := \
     53     $(EXTRA_STATIC_LIBS) \
     54     libzipfile \
     55     libunz \
     56     libext4_utils_host \
     57     libsparse_host \
     58     libz
     59 
     60 ifneq ($(HOST_OS),windows)
     61 LOCAL_STATIC_LIBRARIES += libselinux
     62 endif # HOST_OS != windows
     63 
     64 ifeq ($(HOST_OS),linux)
     65 # libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn")
     66 LOCAL_CFLAGS += -DUSE_F2FS
     67 LOCAL_LDFLAGS += -ldl -rdynamic -Wl,-rpath,.
     68 LOCAL_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.
     71 LOCAL_STATIC_LIBRARIES += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
     72 endif
     73 
     74 include $(BUILD_HOST_EXECUTABLE)
     75 
     76 my_dist_files := $(LOCAL_BUILT_MODULE)
     77 ifeq ($(HOST_OS),linux)
     78 my_dist_files += $(HOST_LIBRARY_PATH)/libf2fs_fmt_host_dyn$(HOST_SHLIB_SUFFIX)
     79 endif
     80 $(call dist-for-goals,dist_files sdk,$(my_dist_files))
     81 my_dist_files :=
     82 
     83 
     84 ifeq ($(HOST_OS),linux)
     85 include $(CLEAR_VARS)
     86 LOCAL_SRC_FILES := usbtest.c usb_linux.c util.c
     87 LOCAL_MODULE := usbtest
     88 LOCAL_CFLAGS := -Werror
     89 include $(BUILD_HOST_EXECUTABLE)
     90 endif
     91 
     92 ifeq ($(HOST_OS),windows)
     93 $(LOCAL_INSTALLED_MODULE): $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll
     94 endif
     95