diff options
Diffstat (limited to 'Makefile.android')
-rw-r--r-- | Makefile.android | 95 |
1 files changed, 62 insertions, 33 deletions
diff --git a/Makefile.android b/Makefile.android index 8116758..c7d43af 100644 --- a/Makefile.android +++ b/Makefile.android @@ -1,12 +1,18 @@ -ifneq (,$(filter $(TARGET_ARCH),arm x86)) +ifneq ($(filter true% %true,$(BUILD_EMULATOR)$(BUILD_STANDALONE_EMULATOR)),) + +ifneq (,$(filter $(TARGET_ARCH),arm x86 mips)) LOCAL_PATH:= $(call my-dir) # determine the target cpu ifeq ($(TARGET_ARCH),arm) EMULATOR_TARGET_CPU := target-arm -else +endif +ifeq ($(TARGET_ARCH),x86) EMULATOR_TARGET_CPU := target-i386 endif +ifeq ($(TARGET_ARCH),mips) +EMULATOR_TARGET_CPU := target-mips +endif # determine the host tag to use QEMU_HOST_TAG := $(HOST_PREBUILT_TAG) @@ -29,18 +35,14 @@ MY_CC := $(HOST_CC) MY_CXX := $(HOST_CXX) MY_AR := $(HOST_AR) -MY_OPTIM := -O2 -g -fno-PIC -falign-functions=0 -fomit-frame-pointer -ifeq ($(BUILD_DEBUG_EMULATOR),true) - MY_OPTIM := -O0 -g -endif - -MY_CFLAGS := $(CONFIG_INCLUDES) $(MY_OPTIM) +MY_CFLAGS := $(CONFIG_INCLUDES) -O2 -g -fno-PIC -falign-functions=0 -fomit-frame-pointer # Overwrite configuration for debug builds. # ifeq ($(BUILD_DEBUG_EMULATOR),true) - MY_CFLAGS := $(CONFIG_INCLUDES) -O0 -g \ - -fno-PIC -falign-functions=0 + MY_CFLAGS := $(CONFIG_INCLUDES) + MY_CFLAGS += -O0 -g + MY_CFLAGS += -fno-PIC -falign-functions=0 endif MY_LDLIBS := @@ -71,22 +73,9 @@ endif ifeq ($(HOST_OS),darwin) MY_CFLAGS += -mdynamic-no-pic -D_DARWIN_C_SOURCE=1 - # When building on Leopard or above, we need to use the 10.4 SDK - # or the generated binary will not run on Tiger. - DARWIN_VERSION := $(strip $(shell sw_vers -productVersion)) - ifneq ($(filter 10.1 10.2 10.3 10.1.% 10.2.% 10.3.% 10.4 10.4.%,$(DARWIN_VERSION)),) - $(error Building the Android emulator requires OS X 10.5 or above) - endif - ifneq ($(filter 10.6 10.6.%,$(DARWIN_VERSION)),) - # We are on Snow Leopard - LEOPARD_SDK := /Developer/SDKs/MacOSX10.5.sdk - ifeq ($(strip $(wildcard $(LEOPARD_SDK))),) - $(info Please install the 10.5 SDK on this machine at $(LEOPARD_SDK)) - $(error Aborting the build.) - endif - MY_CFLAGS += -isysroot $(LEOPARD_SDK) -mmacosx-version-min=10.5 -DMACOSX_DEPLOYMENT_TARGET=10.5 - MY_LDLIBS += -isysroot $(LEOPARD_SDK) -Wl,-syslibroot,$(LEOPARD_SDK) -mmacosx-version-min=10.5 - endif + MY_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version) + MY_LDLIBS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) + endif # BUILD_STANDALONE_EMULATOR is only defined when building with @@ -116,6 +105,9 @@ ifneq ($(BUILD_STANDALONE_EMULATOR),true) endif ccache := endif + + QEMU_OPENGLES_INCLUDE := sdk/emulator/opengl/host/include + QEMU_OPENGLES_LIBS := $(HOST_OUT) endif @@ -129,6 +121,10 @@ ifneq ($(combo_target)$(TARGET_SIMULATOR),HOST_true) MY_LDLIBS += -m32 endif endif + + ifneq ($(BUILD_HOST_static),) + MY_LDLIBS += -static + endif endif # Enable warning, except those related to missing field initializers @@ -157,7 +153,6 @@ start-emulator-library = \ $(eval LOCAL_CFLAGS := $(MY_CFLAGS)) \ $(eval LOCAL_AR := $(MY_AR)) \ $(eval LOCAL_LDLIBS := $(MY_LDLIBS)) \ - $(eval LOCAL_MODULE_TAGS := debug) \ $(eval LOCAL_MODULE := $1) \ $(eval LOCAL_MODULE_CLASS := STATIC_LIBRARIES) @@ -202,16 +197,43 @@ endif ifeq ($(HOST_OS),darwin) QEMU_SYSTEM_LDLIBS += -Wl,-framework,Cocoa,-framework,QTKit,-framework,CoreVideo - ifneq ($(filter 10.7 10.7.% 10.8 10.8.%,$(DARWIN_VERSION)),) - # Lion (and above) / XCode4 needs to be explicitly told the dynamic library - # lookup symbols in the precompiled libSDL are resolved at - # runtime + + # SDK 10.6+ doesn't have __dyld_func_lookup anymore. Dynamic library lookup symbols + # are instead resolved at runtime + OSX_VERSION_MAJOR := $(shell echo $(mac_sdk_version) | cut -d . -f 2) + OSX_VERSION_MAJOR_GREATER_THAN_OR_EQUAL_TO_6 := $(shell [ $(OSX_VERSION_MAJOR) -ge 6 ] && echo true) + ifeq ($(OSX_VERSION_MAJOR_GREATER_THAN_OR_EQUAL_TO_6),true) QEMU_SYSTEM_LDLIBS += -undefined dynamic_lookup endif endif include $(LOCAL_PATH)/Makefile.common +ifeq ($(HOST_OS),windows) + # on Windows, link the icon file as well into the executable + # unfortunately, our build system doesn't help us much, so we need + # to use some weird pathnames to make this work... + + # Locate windres executable + WINDRES := windres + ifneq ($(USE_MINGW),) + # When building the Windows emulator under Linux, use the MinGW one + WINDRES := i586-mingw32msvc-windres + endif + + # Usage: $(eval $(call insert-windows-icon)) + define insert-windows-icon + LOCAL_PREBUILT_OBJ_FILES += images/emulator_icon.o + endef + +# This seems to be the only way to add an object file that was not generated from +# a C/C++/Java source file to our build system. and very unfortunately, +# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces +# us to put the object file in the source directory. +$(LOCAL_PATH)/images/emulator_icon.o: $(LOCAL_PATH)/images/android_icon.rc + $(WINDRES) $< -I $(LOCAL_PATH)/images -o $@ +endif + # We want to build all variants of the emulator binaries. This makes # it easier to catch target-specific regressions during emulator development. EMULATOR_TARGET_ARCH := arm @@ -220,6 +242,9 @@ include $(LOCAL_PATH)/Makefile.target EMULATOR_TARGET_ARCH := x86 include $(LOCAL_PATH)/Makefile.target +EMULATOR_TARGET_ARCH := mips +include $(LOCAL_PATH)/Makefile.target + ############################################################################## ############################################################################## ### @@ -231,6 +256,10 @@ $(call start-emulator-program, emulator) LOCAL_SRC_FILES := android/main-emulator.c LOCAL_STATIC_LIBRARIES := emulator-common +ifeq ($(HOST_OS),windows) +$(eval $(call insert-windows-icon)) +endif + $(call end-emulator-program) ############################################################################## @@ -246,7 +275,6 @@ LOCAL_STATIC_LIBRARIES := \ emulator-libui \ emulator-common \ - LOCAL_CFLAGS += -DCONFIG_STANDALONE_UI=1 LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) $(EMULATOR_LIBUI_CFLAGS) @@ -280,4 +308,5 @@ $(call end-emulator-program) ## VOILA!! -endif # TARGET_ARCH == arm || TARGET_ARCH == x86 +endif # TARGET_ARCH == arm || TARGET_ARCH == x86 || TARGET_ARCH == mips +endif # BUILD_EMULATOR == true || BUILD_STANDALONE_EMULATOR == true |