Add _(darwin|linux|windows)

So that we can support building both linux and windows binaries at the
same time on a linux host. This replaces the ifeq($(HOST_OS),...) checks
in Android.mk files.

Bug: 23566667

Change-Id: I693e11984e36d55bb6f09fa0d49bc485463e16fb
This commit is contained in:
Dan Willemsen 2015-08-13 17:51:40 -07:00
parent 6458fd96d5
commit 7a5498568f
6 changed files with 41 additions and 22 deletions

View File

@ -645,9 +645,13 @@ ifdef LOCAL_PICKUP_FILES
ALL_MODULES.$(my_register_name).PICKUP_FILES := \
$(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES)
endif
my_required_modules := $(LOCAL_REQUIRED_MODULES) \
$(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
ifdef LOCAL_IS_HOST_MODULE
my_required_modules += $(LOCAL_REQUIRED_MODULES_$($(my_prefix)OS))
endif
ALL_MODULES.$(my_register_name).REQUIRED := \
$(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(LOCAL_REQUIRED_MODULES) \
$(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
$(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(my_required_modules))
ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
$(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \

View File

@ -153,6 +153,19 @@ my_cflags += -fPIC
endif
endif
ifdef LOCAL_IS_HOST_MODULE
my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)OS))
my_static_libraries += $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)OS))
my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)OS))
my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)OS))
my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)OS))
my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)OS))
my_ldlibs += $(LOCAL_LDLIBS_$($(my_prefix)OS))
my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)OS))
my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)OS))
my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)OS))
endif
my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix))
my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix))
my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix))

View File

@ -255,6 +255,18 @@ LOCAL_REQUIRED_MODULES_$(HOST_2ND_ARCH):=
LOCAL_CLANG_$(HOST_2ND_ARCH):=
endif
LOCAL_SRC_FILES_$(HOST_OS):=
LOCAL_STATIC_LIBRARIES_$(HOST_OS):=
LOCAL_SHARED_LIBRARIES_$(HOST_OS):=
LOCAL_CFLAGS_$(HOST_OS):=
LOCAL_CPPFLAGS_$(HOST_OS):=
LOCAL_LDFLAGS_$(HOST_OS):=
LOCAL_LDLIBS_$(HOST_OS):=
LOCAL_ASFLAGS_$(HOST_OS):=
LOCAL_C_INCLUDES_$(HOST_OS):=
LOCAL_GENERATED_SOURCES_$(HOST_OS):=
LOCAL_REQUIRED_MODULES_$(HOST_OS):=
LOCAL_SRC_FILES_32:=
LOCAL_SRC_FILES_64:=
LOCAL_SHARED_LIBRARIES_32:=

View File

@ -2,12 +2,11 @@
## Shared definitions for all host test compilations.
#####################################################
ifeq ($(HOST_OS),windows)
LOCAL_CFLAGS += -DGTEST_OS_WINDOWS
else
LOCAL_CFLAGS += -DGTEST_OS_LINUX
LOCAL_LDLIBS += -lpthread
endif
LOCAL_CFLAGS_windows += -DGTEST_OS_WINDOWS
LOCAL_CFLAGS_linux += -DGTEST_OS_LINUX
LOCAL_LDLIBS_linux += -lpthread
LOCAL_CFLAGS_darwin += -DGTEST_OS_LINUX
LOCAL_LDLIBS_darwin += -lpthread
LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g
LOCAL_C_INCLUDES += external/gtest/include

View File

@ -1,15 +1,10 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_SRC_FILES:= \
CopyFile.c
ifeq ($(HOST_OS),darwin)
LOCAL_CFLAGS += -DMACOSX_RSRC
endif
ifeq ($(HOST_OS),linux)
endif
LOCAL_CFLAGS_darwin += -DMACOSX_RSRC
LOCAL_MODULE:= libhost
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include

View File

@ -22,15 +22,11 @@ LOCAL_STATIC_LIBRARIES := \
liblog \
libzopfli
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
endif
LOCAL_LDLIBS_linux += -lrt
ifdef USE_MINGW
LOCAL_STATIC_LIBRARIES += libz
else
LOCAL_LDLIBS += -lz
endif
LOCAL_STATIC_LIBRARIES_windows += libz
LOCAL_LDLIBS_linux += -lz
LOCAL_LDLIBS_darwin += -lz
ifneq ($(strip $(BUILD_HOST_static)),)
LOCAL_LDLIBS += -lpthread