Merge "Remove USE_MINGW/CYGWIN; Whitelist windows modules"

This commit is contained in:
Dan Willemsen 2015-09-03 00:32:09 +00:00 committed by Gerrit Code Review
commit bfe322285f
8 changed files with 85 additions and 162 deletions

View File

@ -5,12 +5,6 @@
LOCAL_PATH:= $(call my-dir)
ifeq ($(HOST_OS),windows)
adb_host_clang := false # libc++ for mingw not ready yet.
else
adb_host_clang := true
endif
adb_host_sanitize :=
adb_target_sanitize :=
@ -29,8 +23,6 @@ ADB_COMMON_CFLAGS := \
ADB_COMMON_windows_CFLAGS := \
-DUNICODE=1 -D_UNICODE=1 \
ADB_COMMON_CFLAGS += $(ADB_COMMON_$(HOST_OS)_CFLAGS)
# libadb
# =========================================================
@ -63,7 +55,8 @@ LIBADB_CFLAGS := \
LIBADB_linux_CFLAGS := \
-std=c++14 \
LIBADB_CFLAGS += $(LIBADB_$(HOST_OS)_CFLAGS)
LIBADB_windows_CFLAGS := \
$(ADB_COMMON_windows_CFLAGS) \
LIBADB_darwin_SRC_FILES := \
fdevent.cpp \
@ -97,7 +90,6 @@ LOCAL_SRC_FILES := \
usb_linux_client.cpp \
LOCAL_SANITIZE := $(adb_target_sanitize)
LOCAL_SHARED_LIBRARIES := libbase
# Even though we're building a static library (and thus there's no link step for
# this to take effect), this adds the includes to our path.
@ -106,24 +98,27 @@ LOCAL_STATIC_LIBRARIES := libbase
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CLANG := $(adb_host_clang)
LOCAL_MODULE := libadb
LOCAL_MODULE_HOST_OS := darwin linux windows
LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
LOCAL_CFLAGS_windows := $(LIBADB_windows_CFLAGS)
LOCAL_CFLAGS_linux := $(LIBADB_linux_CFLAGS)
LOCAL_SRC_FILES := \
$(LIBADB_SRC_FILES) \
$(LIBADB_$(HOST_OS)_SRC_FILES) \
adb_auth_host.cpp \
LOCAL_SRC_FILES_darwin := $(LIBADB_darwin_SRC_FILES)
LOCAL_SRC_FILES_linux := $(LIBADB_linux_SRC_FILES)
LOCAL_SRC_FILES_windows := $(LIBADB_windows_SRC_FILES)
LOCAL_SANITIZE := $(adb_host_sanitize)
LOCAL_SHARED_LIBRARIES := libbase
# Even though we're building a static library (and thus there's no link step for
# this to take effect), this adds the includes to our path.
LOCAL_STATIC_LIBRARIES := libcrypto_static libbase
ifeq ($(HOST_OS),windows)
LOCAL_C_INCLUDES += development/host/windows/usb/api/
else
LOCAL_C_INCLUDES_windows := development/host/windows/usb/api/
ifneq ($(HOST_OS),windows)
LOCAL_MULTILIB := 64
endif
@ -146,14 +141,13 @@ include $(BUILD_NATIVE_TEST)
# =========================================================
include $(CLEAR_VARS)
LOCAL_CLANG := $(adb_host_clang)
LOCAL_MODULE := adb_test
LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
LOCAL_SRC_FILES := \
$(LIBADB_TEST_SRCS) \
$(LIBADB_TEST_$(HOST_OS)_SRCS) \
services.cpp \
LOCAL_CFLAGS_windows := $(LIBADB_windows_CFLAGS)
LOCAL_CFLAGS_linux := $(LIBADB_linux_CFLAGS)
LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
LOCAL_SRC_FILES_linux := $(LIBADB_TEST_linux_SRCS)
LOCAL_SRC_FILES_darwin := $(LIBADB_TEST_darwin_SRCS)
LOCAL_SANITIZE := $(adb_host_sanitize)
LOCAL_SHARED_LIBRARIES := liblog libbase
LOCAL_STATIC_LIBRARIES := \
@ -161,18 +155,10 @@ LOCAL_STATIC_LIBRARIES := \
libcrypto_static \
libcutils \
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt -ldl -lpthread
endif
ifeq ($(HOST_OS),darwin)
LOCAL_LDLIBS += -framework CoreFoundation -framework IOKit
endif
ifeq ($(HOST_OS),windows)
LOCAL_LDLIBS += -lws2_32 -luserenv
LOCAL_STATIC_LIBRARIES += AdbWinApi
endif
LOCAL_LDLIBS_linux := -lrt -ldl -lpthread
LOCAL_LDLIBS_darwin := -framework CoreFoundation -framework IOKit
LOCAL_LDLIBS_windows := -lws2_32 -luserenv
LOCAL_STATIC_LIBRARIES_windows := AdbWinApi
include $(BUILD_HOST_NATIVE_TEST)
@ -181,9 +167,10 @@ include $(BUILD_HOST_NATIVE_TEST)
ifeq ($(HOST_OS),linux)
include $(CLEAR_VARS)
LOCAL_CLANG := $(adb_host_clang)
LOCAL_MODULE := adb_device_tracker_test
LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
LOCAL_CFLAGS_windows := $(LIBADB_windows_CFLAGS)
LOCAL_CFLAGS_linux := $(LIBADB_linux_CFLAGS)
LOCAL_SRC_FILES := test_track_devices.cpp
LOCAL_SANITIZE := $(adb_host_sanitize)
LOCAL_SHARED_LIBRARIES := liblog libbase
@ -196,23 +183,16 @@ endif
# =========================================================
include $(CLEAR_VARS)
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt -ldl -lpthread
endif
LOCAL_LDLIBS_linux := -lrt -ldl -lpthread
ifeq ($(HOST_OS),darwin)
LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
LOCAL_CFLAGS += -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
endif
LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
LOCAL_CFLAGS_darwin := -Wno-sizeof-pointer-memaccess -Wno-unused-parameter
ifeq ($(HOST_OS),windows)
# Use wmain instead of main
LOCAL_LDFLAGS += -municode
LOCAL_LDLIBS += -lws2_32 -lgdi32
EXTRA_STATIC_LIBS := AdbWinApi
endif
LOCAL_CLANG := $(adb_host_clang)
# Use wmain instead of main
LOCAL_LDFLAGS_windows := -municode
LOCAL_LDLIBS_windows := -lws2_32 -lgdi32
LOCAL_STATIC_LIBRARIES_windows := AdbWinApi
LOCAL_REQUIRED_MODULES_windows := AdbWinApi AdbWinUsbApi
LOCAL_SRC_FILES := \
client/main.cpp \
@ -227,8 +207,12 @@ LOCAL_CFLAGS += \
-D_GNU_SOURCE \
-DADB_HOST=1 \
LOCAL_CFLAGS_windows := \
$(ADB_COMMON_windows_CFLAGS)
LOCAL_MODULE := adb
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE_HOST_OS := darwin linux windows
LOCAL_SANITIZE := $(adb_host_sanitize)
LOCAL_STATIC_LIBRARIES := \
@ -237,12 +221,8 @@ LOCAL_STATIC_LIBRARIES := \
libcrypto_static \
libcutils \
liblog \
$(EXTRA_STATIC_LIBS) \
# libc++ not available on windows yet
ifneq ($(HOST_OS),windows)
LOCAL_CXX_STL := libc++_static
endif
LOCAL_CXX_STL := libc++_static
# Don't add anything here, we don't want additional shared dependencies
# on the host adb tool, and shared libraries that link against libc++
@ -253,12 +233,6 @@ include $(BUILD_HOST_EXECUTABLE)
$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
ifeq ($(HOST_OS),windows)
$(LOCAL_INSTALLED_MODULE): \
$(HOST_OUT_EXECUTABLES)/AdbWinApi.dll \
$(HOST_OUT_EXECUTABLES)/AdbWinUsbApi.dll
endif
# adbd device daemon
# =========================================================

View File

@ -68,6 +68,7 @@ LOCAL_CPPFLAGS := $(libbase_cppflags)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := libcutils
LOCAL_MULTILIB := both
LOCAL_MODULE_HOST_OS := darwin linux windows
include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)

View File

@ -24,38 +24,25 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../mkbootimg \
LOCAL_SRC_FILES := protocol.cpp engine.cpp bootimg_utils.cpp fastboot.cpp util.cpp fs.cpp
LOCAL_MODULE := fastboot
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE_HOST_OS := darwin linux windows
LOCAL_CONLYFLAGS += -std=gnu99
LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
LOCAL_CFLAGS += -DFASTBOOT_REVISION='"$(fastboot_version)"'
ifeq ($(HOST_OS),linux)
LOCAL_SRC_FILES += usb_linux.cpp util_linux.cpp
endif
LOCAL_SRC_FILES_linux := usb_linux.cpp util_linux.cpp
ifeq ($(HOST_OS),darwin)
LOCAL_SRC_FILES += usb_osx.cpp util_osx.cpp
LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
LOCAL_CFLAGS += -Wno-unused-parameter
endif
LOCAL_SRC_FILES_darwin := usb_osx.cpp util_osx.cpp
LOCAL_LDLIBS_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
LOCAL_CFLAGS_darwin := -Wno-unused-parameter
ifeq ($(HOST_OS),windows)
LOCAL_SRC_FILES += usb_windows.cpp util_windows.cpp
EXTRA_STATIC_LIBS := AdbWinApi
ifneq ($(strip $(USE_CYGWIN)),)
# Pure cygwin case
LOCAL_LDLIBS += -lpthread
endif
ifneq ($(strip $(USE_MINGW)),)
# MinGW under Linux case
LOCAL_LDLIBS += -lws2_32
USE_SYSDEPS_WIN32 := 1
endif
LOCAL_C_INCLUDES += development/host/windows/usb/api
endif
LOCAL_SRC_FILES_windows := usb_windows.cpp util_windows.cpp
LOCAL_STATIC_LIBRARIES_windows := AdbWinApi
LOCAL_REQUIRED_MODULES_windows := AdbWinApi
LOCAL_LDLIBS_windows := -lws2_32
LOCAL_C_INCLUDES_windows := development/host/windows/usb/api
LOCAL_STATIC_LIBRARIES := \
$(EXTRA_STATIC_LIBS) \
libziparchive-host \
libext4_utils_host \
libsparse_host \
@ -64,24 +51,18 @@ LOCAL_STATIC_LIBRARIES := \
libz \
libbase
ifneq ($(HOST_OS),windows)
LOCAL_STATIC_LIBRARIES += libselinux
endif # HOST_OS != windows
LOCAL_STATIC_LIBRARIES_darwin := libselinux
LOCAL_STATIC_LIBRARIES_linux := libselinux
ifeq ($(HOST_OS),linux)
# libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn")
LOCAL_CFLAGS += -DUSE_F2FS
LOCAL_LDFLAGS += -ldl -rdynamic -Wl,-rpath,.
LOCAL_REQUIRED_MODULES := libf2fs_fmt_host_dyn
LOCAL_CFLAGS_linux := -DUSE_F2FS
LOCAL_LDFLAGS_linux := -ldl -rdynamic -Wl,-rpath,.
LOCAL_REQUIRED_MODULES_linux := libf2fs_fmt_host_dyn
# The following libf2fs_* are from system/extras/f2fs_utils,
# and do not use code in external/f2fs-tools.
LOCAL_STATIC_LIBRARIES += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
endif
LOCAL_STATIC_LIBRARIES_linux += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
# libc++ not available on windows yet
ifneq ($(HOST_OS),windows)
LOCAL_CXX_STL := libc++_static
endif
LOCAL_CXX_STL := libc++_static
# Don't add anything here, we don't want additional shared dependencies
# on the host fastboot tool, and shared libraries that link against libc++
@ -104,7 +85,3 @@ LOCAL_MODULE := usbtest
LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_EXECUTABLE)
endif
ifeq ($(HOST_OS),windows)
$(LOCAL_INSTALLED_MODULE): $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll
endif

View File

@ -37,19 +37,7 @@ commonSources := \
# some files must not be compiled when building against Mingw
# they correspond to features not used by our host development tools
# which are also hard or even impossible to port to native Win32
WINDOWS_HOST_ONLY :=
ifeq ($(HOST_OS),windows)
ifeq ($(strip $(USE_CYGWIN)),)
WINDOWS_HOST_ONLY := 1
endif
endif
# USE_MINGW is defined when we build against Mingw on Linux
ifneq ($(strip $(USE_MINGW)),)
WINDOWS_HOST_ONLY := 1
endif
ifneq ($(WINDOWS_HOST_ONLY),1)
commonSources += \
nonWindowsSources := \
fs.c \
multiuser.c \
socket_inaddr_any_server.c \
@ -60,31 +48,32 @@ ifneq ($(WINDOWS_HOST_ONLY),1)
socket_network_client.c \
sockets.c \
commonHostSources += \
nonWindowsHostSources := \
ashmem-host.c \
trace-host.c
endif
# Shared and static library for host
# ========================================================
LOCAL_MODULE := libcutils
LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
LOCAL_SRC_FILES := $(commonSources) dlmalloc_stubs.c
LOCAL_SRC_FILES_darwin := $(nonWindowsSources) $(nonWindowsHostSources)
LOCAL_SRC_FILES_linux := $(nonWindowsSources) $(nonWindowsHostSources)
LOCAL_STATIC_LIBRARIES := liblog
ifneq ($(HOST_OS),windows)
LOCAL_CFLAGS += -Werror -Wall -Wextra
endif
LOCAL_CFLAGS_darwin := -Werror -Wall -Wextra
LOCAL_CFLAGS_linux := -Werror -Wall -Wextra
LOCAL_MULTILIB := both
LOCAL_MODULE_HOST_OS := darwin linux windows
include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcutils
LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
LOCAL_SRC_FILES := $(commonSources) dlmalloc_stubs.c
LOCAL_SRC_FILES_darwin := $(nonWindowsSources) $(nonWindowsHostSources)
LOCAL_SRC_FILES_linux := $(nonWindowsSources) $(nonWindowsHostSources)
LOCAL_SHARED_LIBRARIES := liblog
ifneq ($(HOST_OS),windows)
LOCAL_CFLAGS += -Werror -Wall -Wextra
endif
LOCAL_CFLAGS_darwin := -Werror -Wall -Wextra
LOCAL_CFLAGS_linux := -Werror -Wall -Wextra
LOCAL_MULTILIB := both
include $(BUILD_HOST_SHARED_LIBRARY)
@ -96,6 +85,7 @@ include $(BUILD_HOST_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcutils
LOCAL_SRC_FILES := $(commonSources) \
$(nonWindowsSources) \
android_reboot.c \
ashmem-dev.c \
debugger.c \

View File

@ -24,41 +24,30 @@ include $(CLEAR_VARS)
# so make sure we do not regret hard-coding it as follows:
liblog_cflags := -DLIBLOG_LOG_TAG=1005
liblog_sources := logd_write.c log_event_write.c
# some files must not be compiled when building against Mingw
# they correspond to features not used by our host development tools
# which are also hard or even impossible to port to native Win32
ifeq ($(strip $(USE_MINGW)),)
liblog_sources += \
event_tag_map.c
else
liblog_sources += \
uio.c
endif
liblog_host_sources := $(liblog_sources) fake_log_device.c event.logtags
liblog_target_sources := $(liblog_sources) log_time.cpp log_is_loggable.c
ifeq ($(strip $(USE_MINGW)),)
liblog_host_sources := logd_write.c log_event_write.c fake_log_device.c event.logtags
liblog_target_sources := logd_write.c log_event_write.c event_tag_map.c log_time.cpp log_is_loggable.c
liblog_target_sources += logprint.c
endif
liblog_target_sources += log_read.c
# Shared and static library for host
# ========================================================
LOCAL_MODULE := liblog
LOCAL_SRC_FILES := $(liblog_host_sources)
# some files must not be compiled when building against Mingw
# they correspond to features not used by our host development tools
# which are also hard or even impossible to port to native Win32
LOCAL_SRC_FILES_darwin := event_tag_map.c
LOCAL_SRC_FILES_linux := event_tag_map.c
LOCAL_SRC_FILES_windows := uio.c
LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -Werror $(liblog_cflags)
LOCAL_MULTILIB := both
LOCAL_MODULE_HOST_OS := darwin linux windows
include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := liblog
LOCAL_WHOLE_STATIC_LIBRARIES := liblog
ifeq ($(strip $(HOST_OS)),linux)
LOCAL_LDLIBS := -lrt
endif
LOCAL_LDLIBS_linux := -lrt
LOCAL_MULTILIB := both
LOCAL_CXX_STL := none
include $(BUILD_HOST_SHARED_LIBRARY)

View File

@ -18,6 +18,7 @@ LOCAL_MODULE := libsparse_host
LOCAL_STATIC_LIBRARIES := libz
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CFLAGS := -Werror
LOCAL_MODULE_HOST_OS := darwin linux windows
include $(BUILD_HOST_STATIC_LIBRARY)

View File

@ -43,27 +43,19 @@ commonSources:= \
host_commonCflags := -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -Werror
ifeq ($(HOST_OS),windows)
ifeq ($(strip $(USE_CYGWIN),),)
# Under MinGW, ctype.h doesn't need multi-byte support
host_commonCflags += -DMB_CUR_MAX=1
endif
endif
# For the host
# =====================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(commonSources)
ifeq ($(HOST_OS), linux)
LOCAL_SRC_FILES += Looper.cpp
endif
ifeq ($(HOST_OS),darwin)
LOCAL_CFLAGS += -Wno-unused-parameter
endif
LOCAL_SRC_FILES_linux := Looper.cpp
LOCAL_CFLAGS_darwin := -Wno-unused-parameter
LOCAL_MODULE:= libutils
LOCAL_STATIC_LIBRARIES := liblog
LOCAL_CFLAGS += $(host_commonCflags)
# Under MinGW, ctype.h doesn't need multi-byte support
LOCAL_CFLAGS_windows := -DMB_CUR_MAX=1
LOCAL_MULTILIB := both
LOCAL_MODULE_HOST_OS := darwin linux windows
include $(BUILD_HOST_STATIC_LIBRARY)

View File

@ -33,10 +33,9 @@ LOCAL_SRC_FILES := ${source_files}
LOCAL_STATIC_LIBRARIES := libz libutils libbase
LOCAL_MODULE:= libziparchive-host
LOCAL_CFLAGS := -Werror
ifneq ($(strip $(USE_MINGW)),)
LOCAL_CFLAGS += -mno-ms-bitfields
endif
LOCAL_CFLAGS_windows := -mno-ms-bitfields
LOCAL_MULTILIB := both
LOCAL_MODULE_HOST_OS := darwin linux windows
include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)