diff options
Diffstat (limited to 'core/combo')
-rw-r--r-- | core/combo/darwin-x86.mk | 97 | ||||
-rw-r--r-- | core/combo/javac.mk | 37 | ||||
-rw-r--r-- | core/combo/linux-arm.mk | 154 | ||||
-rw-r--r-- | core/combo/linux-x86.mk | 33 | ||||
-rw-r--r-- | core/combo/select.mk | 81 | ||||
-rw-r--r-- | core/combo/target_linux-x86.mk | 129 | ||||
-rw-r--r-- | core/combo/windows-x86.mk | 53 |
7 files changed, 584 insertions, 0 deletions
diff --git a/core/combo/darwin-x86.mk b/core/combo/darwin-x86.mk new file mode 100644 index 0000000..2150960 --- /dev/null +++ b/core/combo/darwin-x86.mk @@ -0,0 +1,97 @@ +# Configuration for Darwin (Mac OS X) on PPC. +# Included by combo/select.make + +$(combo_target)GLOBAL_CFLAGS += -fPIC +$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error + +$(combo_target)CC := $(CC) +$(combo_target)CXX := $(CXX) +$(combo_target)AR := $(AR) + +$(combo_target)SHLIB_SUFFIX := .dylib +$(combo_target)JNILIB_SUFFIX := .jnilib + +$(combo_target)GLOBAL_CFLAGS += \ + -include $(call select-android-config-h,darwin-x86) +$(combo_target)RUN_RANLIB_AFTER_COPYING := true + +ifeq ($(combo_target),TARGET_) +$(combo_target)CUSTOM_LD_COMMAND := true +define transform-o-to-shared-lib-inner + $(TARGET_CXX) \ + -dynamiclib -single_module -read_only_relocs suppress \ + $(TARGET_GLOBAL_LD_DIRS) \ + $(PRIVATE_ALL_OBJECTS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(PRIVATE_LDLIBS) \ + -o $@ \ + $(PRIVATE_LDFLAGS) \ + $(if $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES),-all_load) \ + $(TARGET_LIBGCC) +endef + +define transform-o-to-executable-inner + $(TARGET_CXX) \ + -o $@ \ + -Wl,-dynamic -headerpad_max_install_names \ + $(TARGET_GLOBAL_LD_DIRS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ + $(PRIVATE_ALL_OBJECTS) \ + $(PRIVATE_LDLIBS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(TARGET_LIBGCC) +endef + +define transform-o-to-static-executable-inner + $(TARGET_CXX) \ + -static \ + -o $@ \ + $(TARGET_GLOBAL_LD_DIRS) \ + $(PRIVATE_LDFLAGS) \ + $(PRIVATE_ALL_OBJECTS) \ + $(PRIVATE_LDLIBS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(TARGET_LIBGCC) +endef + +else +$(combo_target)CUSTOM_LD_COMMAND := true + +define transform-host-o-to-shared-lib-inner + $(HOST_CXX) \ + -dynamiclib -single_module -read_only_relocs suppress \ + $(HOST_GLOBAL_LD_DIRS) \ + $(PRIVATE_ALL_OBJECTS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(PRIVATE_LDLIBS) \ + -o $@ \ + $(PRIVATE_LDFLAGS) \ + $(HOST_LIBGCC) +endef + +define transform-host-o-to-executable-inner +$(HOST_CXX) \ + -o $@ \ + -Wl,-dynamic -headerpad_max_install_names \ + $(HOST_GLOBAL_LD_DIRS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ + $(PRIVATE_ALL_OBJECTS) \ + $(PRIVATE_LDLIBS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(HOST_LIBGCC) +endef + +# $(1): The file to check +define get-file-size +stat -f "%z" $(1) +endef + +endif + diff --git a/core/combo/javac.mk b/core/combo/javac.mk new file mode 100644 index 0000000..d4c04e7 --- /dev/null +++ b/core/combo/javac.mk @@ -0,0 +1,37 @@ +# Selects a Java compiler. +# +# Inputs: +# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system +# default +# +# Outputs: +# COMMON_JAVAC -- Java compiler command with common arguments + +# Whatever compiler is on this system. +ifeq ($(HOST_OS), windows) + COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \ + -target 1.5 -Xmaxerrs 9999999 +else + COMMON_JAVAC := javac -J-Xmx512M -target 1.5 -Xmaxerrs 9999999 +endif + +# Eclipse. +ifeq ($(CUSTOM_JAVA_COMPILER), eclipse) + COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \ + -maxProblems 9999999 -nowarn + $(info CUSTOM_JAVA_COMPILER=eclipse) +endif + +# OpenJDK. +ifeq ($(CUSTOM_JAVA_COMPILER), openjdk) + # We set the VM options (like -Xmx) in the javac script. + COMMON_JAVAC := prebuilt/common/openjdk/bin/javac -target 1.5 \ + -Xmaxerrs 9999999 + $(info CUSTOM_JAVA_COMPILER=openjdk) +endif + +HOST_JAVAC ?= $(COMMON_JAVAC) +TARGET_JAVAC ?= $(COMMON_JAVAC) + +#$(info HOST_JAVAC=$(HOST_JAVAC)) +#$(info TARGET_JAVAC=$(TARGET_JAVAC)) diff --git a/core/combo/linux-arm.mk b/core/combo/linux-arm.mk new file mode 100644 index 0000000..507e4dd --- /dev/null +++ b/core/combo/linux-arm.mk @@ -0,0 +1,154 @@ +# Configuration for Linux on ARM. +# Included by combo/select.make + +# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else +ifeq ($(strip $($(combo_target)TOOLS_PREFIX)),) +$(combo_target)TOOLS_PREFIX := \ + prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.2.1/bin/arm-eabi- +endif + +$(combo_target)CC := $($(combo_target)TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX) +$(combo_target)CXX := $($(combo_target)TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX) +$(combo_target)AR := $($(combo_target)TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX) +$(combo_target)OBJCOPY := $($(combo_target)TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX) +$(combo_target)LD := $($(combo_target)TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX) + +$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined + +TARGET_arm_release_CFLAGS := -fomit-frame-pointer \ + -fstrict-aliasing \ + -funswitch-loops \ + -finline-limit=300 + +TARGET_thumb_release_CFLAGS := -mthumb \ + -Os \ + -fomit-frame-pointer \ + -fno-strict-aliasing \ + -finline-limit=64 + +# When building for debug, compile everything as arm. +TARGET_arm_debug_CFLAGS := $(TARGET_arm_release_CFLAGS) -fno-omit-frame-pointer -fno-strict-aliasing +TARGET_thumb_debug_CFLAGS := $(TARGET_thumb_release_CFLAGS) -marm -fno-omit-frame-pointer + +# NOTE: if you try to build a debug build with thumb, several +# of the libraries (libpv, libwebcore, libkjs) need to be built +# with -mlong-calls. When built at -O0, those libraries are +# too big for a thumb "BL <label>" to go from one end to the other. + +## As hopefully a temporary hack, +## use this to force a full ARM build (for easier debugging in gdb) +## (don't forget to do a clean build) +##TARGET_arm_release_CFLAGS := $(TARGET_arm_release_CFLAGS) -fno-omit-frame-pointer +##TARGET_thumb_release_CFLAGS := $(TARGET_thumb_release_CFLAGS) -marm -fno-omit-frame-pointer + +## on some hosts, the target cross-compiler is not available so do not run this command +ifneq ($(wildcard $($(combo_target)CC)),) +$(combo_target)LIBGCC := $(shell $($(combo_target)CC) -mthumb-interwork -print-libgcc-file-name) +endif + +$(combo_target)GLOBAL_CFLAGS += \ + -march=armv5te -mtune=xscale \ + -msoft-float -fpic \ + -mthumb-interwork \ + -ffunction-sections \ + -funwind-tables \ + -fstack-protector \ + -fno-short-enums \ + -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \ + -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \ + -include $(call select-android-config-h,linux-arm) + +$(combo_target)GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden + +$(combo_target)RELEASE_CFLAGS := \ + -DSK_RELEASE -DNDEBUG \ + -O2 -g \ + -Wstrict-aliasing=2 \ + -finline-functions \ + -fno-inline-functions-called-once \ + -fgcse-after-reload \ + -frerun-cse-after-loop \ + -frename-registers + +libc_root := bionic/libc +libm_root := bionic/libm +libstdc++_root := bionic/libstdc++ +libthread_db_root := bionic/libthread_db + +# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use +# symlinks located in out/ to point to the appropriate kernel +# headers. see 'config/kernel_headers.make' for more details +# +ifneq ($(CUSTOM_KERNEL_HEADERS),) + KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS) + KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS) +else + KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common + KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH) +endif +KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) + +$(combo_target)C_INCLUDES := \ + $(libc_root)/arch-arm/include \ + $(libc_root)/include \ + $(libstdc++_root)/include \ + $(KERNEL_HEADERS) \ + $(libm_root)/include \ + $(libm_root)/include/arch/arm \ + $(libthread_db_root)/include + +TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o +TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o +TARGET_CRTEND_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o + +TARGET_STRIP_MODULE:=true + +$(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm + +$(combo_target)CUSTOM_LD_COMMAND := true +define transform-o-to-shared-lib-inner +$(TARGET_CXX) \ + -nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/armelf.xsc \ + -Wl,--gc-sections \ + -Wl,-shared,-Bsymbolic \ + $(TARGET_GLOBAL_LD_DIRS) \ + $(PRIVATE_ALL_OBJECTS) \ + -Wl,--whole-archive \ + $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ + -Wl,--no-whole-archive \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ + -o $@ \ + $(PRIVATE_LDFLAGS) \ + $(TARGET_LIBGCC) +endef + +define transform-o-to-executable-inner +$(TARGET_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \ + -Wl,-dynamic-linker,/system/bin/linker \ + -Wl,--gc-sections \ + -Wl,-z,nocopyreloc \ + -o $@ \ + $(TARGET_GLOBAL_LD_DIRS) \ + -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ + $(TARGET_CRTBEGIN_DYNAMIC_O) \ + $(PRIVATE_ALL_OBJECTS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(PRIVATE_LDFLAGS) \ + $(TARGET_LIBGCC) \ + $(TARGET_CRTEND_O) +endef + +define transform-o-to-static-executable-inner +$(TARGET_CXX) -nostdlib -Bstatic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \ + -Wl,--gc-sections \ + -o $@ \ + $(TARGET_GLOBAL_LD_DIRS) \ + $(TARGET_CRTBEGIN_STATIC_O) \ + $(PRIVATE_LDFLAGS) \ + $(PRIVATE_ALL_OBJECTS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(TARGET_LIBGCC) \ + $(TARGET_CRTEND_O) +endef diff --git a/core/combo/linux-x86.mk b/core/combo/linux-x86.mk new file mode 100644 index 0000000..372c63e --- /dev/null +++ b/core/combo/linux-x86.mk @@ -0,0 +1,33 @@ +# Configuration for Linux on x86. +# Included by combo/select.make + +# right now we get these from the environment, but we should +# pick them from the tree somewhere +$(combo_target)CC := $(CC) +$(combo_target)CXX := $(CXX) +$(combo_target)AR := $(AR) + +ifeq ($(combo_target),HOST_) +# $(1): The file to check +define get-file-size +stat --format "%s" "$(1)" +endef +endif + +# On the sim, we build the "host" tools in 64 bit iff the compiler +# does it for us automatically. In other words, that means on 64 bit +# system, they're 64 bit and on 32 bit systems, they're 32 bits. In +# all other cases, we build 32 bit, since this is what we release. +ifneq ($(combo_target)$(TARGET_SIMULATOR),HOST_true) +$(combo_target)GLOBAL_CFLAGS := $($(combo_target)GLOBAL_CFLAGS) -m32 +$(combo_target)GLOBAL_LDFLAGS := $($(combo_target)GLOBAL_LDFLAGS) -m32 +endif + + +$(combo_target)GLOBAL_CFLAGS += -fPIC +$(combo_target)GLOBAL_CFLAGS += \ + -include $(call select-android-config-h,linux-x86) + +$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined + + diff --git a/core/combo/select.mk b/core/combo/select.mk new file mode 100644 index 0000000..c54da22 --- /dev/null +++ b/core/combo/select.mk @@ -0,0 +1,81 @@ +# Select a combo based on the compiler being used. +# +# Inputs: +# combo_target -- prefix for final variables (HOST_ or TARGET_) +# +# Outputs: +# $(combo_target)OS -- standard name for this host (LINUX, DARWIN, etc.) +# $(combo_target)ARCH -- standard name for process architecture (powerpc, x86, etc.) +# $(combo_target)GLOBAL_CFLAGS -- C compiler flags to use for everything +# $(combo_target)DEBUG_CFLAGS -- additional C compiler flags for debug builds +# $(combo_target)RELEASE_CFLAGS -- additional C compiler flags for release builds +# $(combo_target)GLOBAL_ARFLAGS -- flags to use for static linking everything +# $(combo_target)SHLIB_SUFFIX -- suffix of shared libraries + +# Build a target string like "linux-arm" or "darwin-x86". +combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH) + +# Set the defaults. + +HOST_CC ?= $(CC) +HOST_CXX ?= $(CXX) +HOST_AR ?= $(AR) + +$(combo_target)BINDER_MINI := 0 + +$(combo_target)HAVE_EXCEPTIONS := 0 +$(combo_target)HAVE_UNIX_FILE_PATH := 1 +$(combo_target)HAVE_WINDOWS_FILE_PATH := 0 +$(combo_target)HAVE_RTTI := 1 +$(combo_target)HAVE_CALL_STACKS := 1 +$(combo_target)HAVE_64BIT_IO := 1 +$(combo_target)HAVE_CLOCK_TIMERS := 1 +$(combo_target)HAVE_PTHREAD_RWLOCK := 1 +$(combo_target)HAVE_STRNLEN := 1 +$(combo_target)HAVE_STRERROR_R_STRRET := 1 +$(combo_target)HAVE_STRLCPY := 0 +$(combo_target)HAVE_STRLCAT := 0 +$(combo_target)HAVE_KERNEL_MODULES := 0 + +# These flags might (will) be overridden by the target makefiles +$(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar +$(combo_target)DEBUG_CFLAGS := -O0 -g +$(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing +$(combo_target)GLOBAL_ARFLAGS := crs + +$(combo_target)EXECUTABLE_SUFFIX := +$(combo_target)SHLIB_SUFFIX := .so +$(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX) +$(combo_target)STATIC_LIB_SUFFIX := .a + +$(combo_target)PRELINKER_MAP := $(BUILD_SYSTEM)/prelink-$(combo_os_arch).map + +# We try to find a target or host specific file for the os/arch specified, and +# default to just looking for the os/arch one. This will allow us to define +# things separately for targets and hosts that have the same architecture +# but need different defines. e.g. target_linux-x86 and host_linux-x86 + +ifneq ($(TARGET_SIMULATOR),true) +# Convert the combo_target string to lowercase +combo_target_lc := $(shell echo $(combo_target) | tr '[A-Z]' '[a-z]') + +# form combo makefile name like "<path>/target_linux-x86.make", +# "<path>/host_darwin-x86.make", etc. +combo_target_os_arch := $(BUILD_COMBOS)/$(combo_target_lc)$(combo_os_arch).mk +else +combo_target_os_arch := +endif + +# Now include the combo for this specific target. +ifneq ($(wildcard $(combo_target_os_arch)),) +include $(combo_target_os_arch) +else +include $(BUILD_COMBOS)/$(combo_os_arch).mk +endif + +ifneq ($(USE_CCACHE),) + ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache + $(combo_target)CC := $(ccache) $($(combo_target)CC) + $(combo_target)CXX := $(ccache) $($(combo_target)CXX) + ccache = +endif diff --git a/core/combo/target_linux-x86.mk b/core/combo/target_linux-x86.mk new file mode 100644 index 0000000..2d359ff --- /dev/null +++ b/core/combo/target_linux-x86.mk @@ -0,0 +1,129 @@ +# Configuration for Linux on x86 as a target. +# Included by combo/select.make + +# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else +ifeq ($(strip $($(combo_target)TOOLS_PREFIX)),) +$(combo_target)TOOLS_PREFIX := \ + prebuilt/$(HOST_PREBUILT_TAG)/toolchain/i686-unknown-linux-gnu-4.2.1/bin/i686-unknown-linux-gnu- +endif + +$(combo_target)CC := $($(combo_target)TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX) +$(combo_target)CXX := $($(combo_target)TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX) +$(combo_target)AR := $($(combo_target)TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX) +$(combo_target)OBJCOPY := $($(combo_target)TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX) +$(combo_target)LD := $($(combo_target)TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX) + +ifneq ($(wildcard $($(combo_target)CC)),) +$(combo_target)LIBGCC := \ + $(shell $($(combo_target)CC) -m32 -print-file-name=libgcc.a) \ + $(shell $($(combo_target)CC) -m32 -print-file-name=libgcc_eh.a) +endif + +$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined + +libc_root := bionic/libc +libm_root := bionic/libm +libstdc++_root := bionic/libstdc++ +libthread_db_root := bionic/libthread_db + +# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use +# symlinks located in out/ to point to the appropriate kernel +# headers. see 'config/kernel_headers.make' for more details +# +ifneq ($(CUSTOM_KERNEL_HEADERS),) + KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS) + KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS) +else + KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common + KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH) +endif +KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) + +$(combo_target)GLOBAL_CFLAGS += \ + -march=i686 \ + -m32 \ + -fPIC \ + -include $(call select-android-config-h,target_linux-x86) + +$(combo_target)GLOBAL_CPPFLAGS += \ + -fno-use-cxa-atexit + +$(combo_target)C_INCLUDES := \ + $(libc_root)/arch-x86/include \ + $(libc_root)/include \ + $(libstdc++_root)/include \ + $(KERNEL_HEADERS) \ + $(libm_root)/include \ + $(libm_root)/include/i387 \ + $(libthread_db_root)/include + +TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o +TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o +TARGET_CRTEND_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o + + +TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o +TARGET_CRTEND_SO_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o + +# TARGET_STRIP_MODULE:=true + +$(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm + +$(combo_target)CUSTOM_LD_COMMAND := true +define transform-o-to-shared-lib-inner +$(TARGET_CXX) \ + $(TARGET_GLOBAL_LDFLAGS) \ + -nostdlib -Wl,-soname,$(notdir $@) \ + -shared -Bsymbolic \ + -fPIC -march=i686 \ + $(TARGET_GLOBAL_LD_DIRS) \ + $(TARGET_CRTBEGIN_SO_O) \ + $(PRIVATE_ALL_OBJECTS) \ + -Wl,--whole-archive \ + $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ + -Wl,--no-whole-archive \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ + -o $@ \ + $(PRIVATE_LDFLAGS) \ + $(TARGET_LIBGCC) \ + $(TARGET_CRTEND_SO_O) +endef + + +define transform-o-to-executable-inner +$(TARGET_CXX) \ + $(TARGET_GLOBAL_LDFLAGS) \ + -nostdlib -Bdynamic \ + -Wl,-dynamic-linker,/system/bin/linker \ + -Wl,-z,nocopyreloc \ + -o $@ \ + $(TARGET_GLOBAL_LD_DIRS) \ + -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ + $(TARGET_CRTBEGIN_DYNAMIC_O) \ + $(PRIVATE_ALL_OBJECTS) \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(PRIVATE_LDFLAGS) \ + $(TARGET_LIBGCC) \ + $(TARGET_CRTEND_O) +endef + +define transform-o-to-static-executable-inner +$(TARGET_CXX) \ + $(TARGET_GLOBAL_LDFLAGS) \ + -nostdlib -Bstatic \ + -o $@ \ + $(TARGET_GLOBAL_LD_DIRS) \ + $(TARGET_CRTBEGIN_STATIC_O) \ + $(PRIVATE_LDFLAGS) \ + $(PRIVATE_ALL_OBJECTS) \ + -Wl,--start-group \ + $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ + $(TARGET_LIBGCC) \ + -Wl,--end-group \ + $(TARGET_CRTEND_O) +endef + +$(combo_target)GLOBAL_CFLAGS += -m32 +$(combo_target)GLOBAL_LDFLAGS += -m32 diff --git a/core/combo/windows-x86.mk b/core/combo/windows-x86.mk new file mode 100644 index 0000000..e32a077 --- /dev/null +++ b/core/combo/windows-x86.mk @@ -0,0 +1,53 @@ +# Configuration for Linux on x86. +# Included by combo/select.make + +# right now we get these from the environment, but we should +# pick them from the tree somewhere +TOOLS_PREFIX := #prebuilt/windows/host/bin/ +TOOLS_EXE_SUFFIX := .exe + +# Settings to use MinGW has a cross-compiler under Linux +ifneq ($(findstring Linux,$(UNAME)),) +ifneq ($(strip $(USE_MINGW)),) +HOST_ACP_UNAVAILABLE := true +TOOLS_PREFIX := /usr/bin/i586-mingw32msvc- +TOOLS_EXE_SUFFIX := +$(combo_target)GLOBAL_CFLAGS += -DUSE_MINGW +$(combo_target)C_INCLUDES += /usr/lib/gcc/i586-mingw32msvc/3.4.4/include +$(combo_target)GLOBAL_LD_DIRS += -L/usr/i586-mingw32msvc/lib +endif +endif + +$(combo_target)CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX) +$(combo_target)CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX) +$(combo_target)AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX) + +$(combo_target)GLOBAL_CFLAGS += -include $(call select-android-config-h,windows) +$(combo_target)GLOBAL_LDFLAGS += --enable-stdcall-fixup + +# when building under Cygwin, ensure that we use Mingw compilation by default. +# you can disable this (i.e. to generate Cygwin executables) by defining the +# USE_CYGWIN variable in your environment, e.g.: +# +# export USE_CYGWIN=1 +# +# note that the -mno-cygwin flags are not needed when cross-compiling the +# Windows host tools on Linux +# +ifneq ($(findstring CYGWIN,$(UNAME)),) +ifeq ($(strip $(USE_CYGWIN)),) +$(combo_target)GLOBAL_CFLAGS += -mno-cygwin +$(combo_target)GLOBAL_LDFLAGS += -mno-cygwin -mconsole +endif +endif + +$(combo_target)SHLIB_SUFFIX := .dll +$(combo_target)EXECUTABLE_SUFFIX := .exe + +ifeq ($(combo_target),HOST_) +# $(1): The file to check +# TODO: find out what format cygwin's stat(1) uses +define get-file-size +999999999 +endef +endif |