diff options
Diffstat (limited to 'Makefile.android')
-rw-r--r-- | Makefile.android | 402 |
1 files changed, 192 insertions, 210 deletions
diff --git a/Makefile.android b/Makefile.android index d51a6d2..fe89e4a 100644 --- a/Makefile.android +++ b/Makefile.android @@ -9,11 +9,15 @@ CONFIG_DIRS := \ CONFIG_INCLUDES := $(CONFIG_DIRS:%=-I%) -MY_CFLAGS := $(CONFIG_INCLUDES) +MY_CFLAGS := $(CONFIG_INCLUDES) -O2 -g \ + -fno-PIC \ + -falign-functions=0 \ + -fomit-frame-pointer \ + MY_LDFLAGS := # this is needed to build the emulator on 64-bit Linux systems -ifeq ($(HOST_OS),linux) +ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) MY_CFLAGS += -Wa,--32 endif @@ -27,6 +31,13 @@ ifeq ($(HOST_OS),windows) MY_CFLAGS += -DWINVER=0x501 endif +ifeq ($(HOST_ARCH),ppc) + MY_CFLAGS += -D__powerpc__ +endif + +ifeq ($(HOST_OS),darwin) + MY_CFLAGS += -mdynamic-no-pic +endif MY_CC := $(HOST_CC) # BUILD_STANDALONE_EMULATOR is only defined when building with @@ -34,14 +45,6 @@ MY_CC := $(HOST_CC) # adequate values for HOST_CC # ifneq ($(BUILD_STANDALONE_EMULATOR),true) - # We're going to use a specific version of gcc (3.4.6) if it is available - # from the prebuilt directory. This prevents many nasty emulator problems - # due to the way QEMU works - # - ifneq ($(strip $(wildcard $(GCCQEMU))),) - # GCCQEMU is set by the host file under build/core/combo/ - MY_CC := $(GCCQEMU) - endif ifneq ($(USE_CCACHE),) MY_CC := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache $(MY_CC) @@ -50,93 +53,104 @@ endif ifneq ($(combo_target)$(TARGET_SIMULATOR),HOST_true) - MY_CFLAGS += -m32 - MY_LDFLAGS += -m32 + ifneq ($(HOST_ARCH),x86_64) + MY_CFLAGS += -m32 + MY_LDFLAGS += -m32 + endif endif include $(CLEAR_VARS) +########################################################### +# Zlib configuration +# +ZLIB_DIR := distrib/zlib-1.2.3 +include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make + +########################################################### +# Libpng configuration +# +LIBPNG_DIR := distrib/libpng-1.2.19 +include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make + ############################################################################### -# compile the 'dyngen' executable, it is used to generate the various -# runtime code generators used by the emulator. it does that by parsing a -# special .o file containing routines for each one of the pseudo-opcodes -# handled by the CPU-specific translator +# build the TCG code generator # +include $(CLEAR_VARS) + LOCAL_NO_DEFAULT_COMPILER_FLAGS := true LOCAL_CC := $(MY_CC) LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) LOCAL_LDFLAGS := $(MY_LDFLAGS) -LOCAL_SRC_FILES := dyngen.c +LOCAL_MODULE := emulator-tcg -ifeq ($(HOST_OS),windows) - LOCAL_LDLIBS += -mno-cygwin -mconsole +TCG_TARGET := $(HOST_ARCH) +ifeq ($(TCG_TARGET),x86) + TCG_TARGET := i386 endif -LOCAL_MODULE := emulator-dyngen -include $(BUILD_HOST_EXECUTABLE) - -DYNGEN := $(LOCAL_BUILT_MODULE) +TCG_CFLAGS := -I$(LOCAL_PATH)/tcg -I$(LOCAL_PATH)/tcg/$(TCG_TARGET) -############################################################################### -# build the normal dynamic translation code as a library, because it needs -# specific compilation flags. not that we are poking some object -# files directly through dyngen ! -# +LOCAL_CFLAGS += $(TCG_CFLAGS) \ + -I$(LOCAL_PATH)/target-arm \ + -I$(LOCAL_PATH)/fpu \ -# determine the C flags used to compile op.c into op.h and others -# -OP_CFLAGS := -I$(LOCAL_PATH)/target-arm \ - -I$(LOCAL_PATH)/fpu \ - $(MY_CFLAGS) - -OP_CFLAGS += -O2 -g -fomit-frame-pointer -fno-strict-aliasing -falign-functions=0 \ - -fno-gcse -fno-reorder-blocks -fno-optimize-sibling-calls \ - -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ - -fno-PIC - -ifeq ($(HOST_ARCH),ppc) - OP_CFLAGS += -D__powerpc__ -mdynamic-no-pic -endif +LOCAL_SRC_FILES := \ + tcg/tcg.c \ + tcg/tcg-dyngen.c \ + tcg/tcg-runtime.c \ -ifeq ($(HOST_ARCH),x86) -ifeq ($(HOST_OS),darwin) - OP_CFLAGS += -mpreferred-stack-boundary=4 -mdynamic-no-pic -else - OP_CFLAGS += -mpreferred-stack-boundary=2 -endif -endif +include $(BUILD_HOST_STATIC_LIBRARY) -# build the nomal dynamic translation code as the 'emulator-op' library +############################################################################## +# build the HW emulation support # include $(CLEAR_VARS) -LOCAL_MODULE := emulator-op -OP_SUFFIX := - -include $(LOCAL_PATH)/translate.make - -include $(BUILD_HOST_STATIC_LIBRARY) - +LOCAL_NO_DEFAULT_COMPILER_FLAGS := true +LOCAL_CC := $(MY_CC) +LOCAL_MODULE := emulator-hw -# build the tracing dynamic translation code as the 'emulator-op-trace' library -# -include $(CLEAR_VARS) +HW_CFLAGS := -I$(LOCAL_PATH)/hw -LOCAL_MODULE := emulator-op-trace -LOCAL_CFLAGS := -DGEN_TRACE=1 -OP_SUFFIX := -trace +LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) +LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(HW_CFLAGS) +LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR) + +HW_SOURCES := \ + android_arm.c \ + arm_pic.c \ + cdrom.c \ + dma.c \ + irq.c \ + goldfish_audio.c \ + goldfish_battery.c \ + goldfish_device.c \ + goldfish_events_device.c \ + goldfish_fb.c \ + goldfish_interrupt.c \ + goldfish_memlog.c \ + goldfish_mmc.c \ + goldfish_nand.c \ + goldfish_switch.c \ + goldfish_timer.c \ + goldfish_trace.c \ + goldfish_tty.c \ + pci.c \ + scsi-disk.c \ + smc91c111.c \ + usb-hid.c \ + usb-hub.c \ + usb-msd.c \ + usb-ohci.c \ + usb.c \ -include $(LOCAL_PATH)/translate.make +LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%) include $(BUILD_HOST_STATIC_LIBRARY) -# define to true to build the ARM-specific code generator as an independent -# static library. this allows you to apply different optimization strategy -BUILD_ARM_LIBRARY := true - -ifeq ($(BUILD_ARM_LIBRARY),true) ############################################################################## -# build the ARM-specific target sources +# build the ARM-specific emulation engine sources # include $(CLEAR_VARS) @@ -144,53 +158,40 @@ LOCAL_NO_DEFAULT_COMPILER_FLAGS := true LOCAL_CC := $(MY_CC) LOCAL_MODULE := emulator-arm LOCAL_LDFLAGS := $(MY_LDFLAGS) +LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) +LOCAL_STATIC_LIBRARIES := emulator-hw LOCAL_CFLAGS := -fno-PIC -fomit-frame-pointer -Wno-sign-compare LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) -ifeq ($(HOST_OS),darwin) -LOCAL_CFLAGS += -O2 -endif -ifeq ($(HOST_OS),windows) -LOCAL_CFLAGS += -O2 -endif - -# generate the normal translator source files from emulator-op library -# -LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm \ - -I$(LOCAL_PATH)/fpu \ - -I$(INTERMEDIATE) +LOCAL_CFLAGS += -I$(LOCAL_PATH) \ + -I$(LOCAL_PATH)/target-arm \ + -I$(LOCAL_PATH)/fpu \ + $(TCG_CFLAGS) \ + $(HW_CFLAGS) \ ifeq ($(HOST_ARCH),ppc) LOCAL_CFLAGS += -D__powerpc__ endif -ifeq ($(HOST_OS),darwin) - LOCAL_CFLAGS += -mdynamic-no-pic -endif - -# include CPU translation sources -# LOCAL_SRC_FILES += exec.c cpu-exec.c \ target-arm/op_helper.c \ - target-arm/helper.c - -# include ARM-specific soft-float implementation -# -NWFPE_SOURCES := fpa11.c fpa11_cpdo.c fpa11_cpdt.c fpa11_cprt.c fpopcode.c single_cpdo.c \ - double_cpdo.c extended_cpdo.c - -FPU_SOURCES := softfloat.c - -LOCAL_SRC_FILES += $(XXNWFPE_SOURCES:%=target-arm/nwfpe/%) \ - $(FPU_SOURCES:%=fpu/%) - -LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm/nwfpe \ - -I$(LOCAL_PATH)/linux-user \ - -I$(LOCAL_PATH)/linux-user/arm + target-arm/iwmmxt_helper.c \ + target-arm/neon_helper.c \ + target-arm/helper.c \ + target-arm/translate.c \ + target-arm/machine.c \ + translate-all.c \ + hw/armv7m.c \ + hw/armv7m_nvic.c \ + arm-semi.c \ + trace.c \ + varint.c \ + dcache.c \ + +LOCAL_SRC_FILES += fpu/softfloat.c include $(BUILD_HOST_STATIC_LIBRARY) -endif # BUILD_ARM_LIBRARY ############################################################################## # SDL-related definitions @@ -230,6 +231,10 @@ ifeq ($(HOST_OS),linux) CONFIG_ESD ?= yes endif +ifeq ($(HOST_OS),freebsd) + CONFIG_OSS ?= yes +endif + ifeq ($(CONFIG_COREAUDIO),yes) AUDIO_SOURCES += coreaudio.c AUDIO_CFLAGS += -DCONFIG_COREAUDIO @@ -261,7 +266,10 @@ AUDIO_SOURCES := $(AUDIO_SOURCES:%=audio/%) # determine whether we're going to use the prebuilt # audio library (this is useful on Linux to avoid requiring # all sound-related development packages to be installed on -# the build and developer machines. +# the build and developer machines). +# +# note that you can define BUILD_QEMU_AUDIO_LIB to true +# in your environment to force recompilation. # QEMU_AUDIO_LIB := @@ -277,9 +285,8 @@ ifeq ($(BUILD_QEMU_AUDIO_LIB),true) LOCAL_MODULE := libqemu-audio LOCAL_LDFLAGS := $(MY_LDFLAGS) - LOCAL_CFLAGS := -fno-PIC -fomit-frame-pointer -Wno-sign-compare \ - -fno-strict-aliasing -g -W -Wall -Wno-unused-parameter \ - -O2 \ + LOCAL_CFLAGS := -Wno-sign-compare \ + -fno-strict-aliasing -W -Wall -Wno-unused-parameter \ -I$(LOCAL_PATH) \ -I$(LOCAL_PATH)/target-arm \ -I$(LOCAL_PATH)/fpu \ @@ -303,7 +310,7 @@ include $(CLEAR_VARS) LOCAL_NO_DEFAULT_COMPILER_FLAGS := true LOCAL_CC := $(MY_CC) LOCAL_MODULE := emulator -LOCAL_STATIC_LIBRARIES := $(EMULATOR_OP_LIBRARIES) emulator-arm +LOCAL_STATIC_LIBRARIES := emulator-hw emulator-arm emulator-tcg LOCAL_LDFLAGS := $(MY_LDFLAGS) # don't remove the -fno-strict-aliasing, or you'll break things @@ -314,65 +321,24 @@ LOCAL_CFLAGS := -fno-PIC -fomit-frame-pointer -Wno-sign-compare \ LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) -ifeq ($(HOST_OS),darwin) -LOCAL_CFLAGS += -O2 -endif -ifeq ($(HOST_OS),windows) -LOCAL_CFLAGS += -O2 -endif # add the build ID to the default macro definitions LOCAL_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))" -ifeq ($(HOST_ARCH),ppc) - LOCAL_CFLAGS += -D__powerpc__ -endif - -ifeq ($(HOST_OS),darwin) - LOCAL_CFLAGS += -mdynamic-no-pic -endif - # include the Zlib sources # -ZLIB_DIR := distrib/zlib-1.2.3 -include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make LOCAL_SRC_FILES += $(ZLIB_SOURCES) LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR) # include the Libpng sources # -LIBPNG_DIR := distrib/libpng-1.2.19 -include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make LOCAL_SRC_FILES += $(LIBPNG_SOURCES) LOCAL_CFLAGS += $(LIBPNG_CFLAGS) -I$(LOCAL_PATH)/$(LIBPNG_DIR) -LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm \ +LOCAL_CFLAGS += -I$(LOCAL_PATH)/ \ + -I$(LOCAL_PATH)/target-arm \ -I$(LOCAL_PATH)/fpu \ - -I$(INTERMEDIATE) - -ifneq ($(BUILD_ARM_LIBRARY),true) -# generate the normal translator source files from emulator-op library -# - -# include CPU translation sources -# -LOCAL_SRC_FILES += exec.c cpu-exec.c \ - target-arm/op_helper.c \ - target-arm/helper.c - -# include ARM-specific soft-float implementation -# -NWFPE_SOURCES := fpa11.c fpa11_cpdo.c fpa11_cpdt.c fpa11_cprt.c fpopcode.c single_cpdo.c \ - double_cpdo.c extended_cpdo.c - -FPU_SOURCES := softfloat.c - -LOCAL_SRC_FILES += $(XXNWFPE_SOURCES:%=target-arm/nwfpe/%) \ - $(FPU_SOURCES:%=fpu/%) - -LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm/nwfpe \ - -I$(LOCAL_PATH)/linux-user \ - -I$(LOCAL_PATH)/linux-user/arm -endif # !BUILD_ARM_LIBRARY + $(TCG_CFLAGS) \ + $(HW_CFLAGS) \ # include telephony stuff # @@ -396,22 +362,6 @@ endif # !QEMU_AUDIO_LIB LOCAL_CFLAGS += $(AUDIO_CFLAGS) LOCAL_LDLIBS += $(AUDIO_LDLIBS) -# include emulated hardware source files -# -HW_SOURCES := android_arm.c arm_boot.c arm_pic.c cdrom.c \ - goldfish_events_device.c pci.c irq.c \ - goldfish_nand.c \ - goldfish_audio.c goldfish_device.c goldfish_fb.c \ - goldfish_interrupt.c goldfish_mmc.c goldfish_switch.c \ - goldfish_memlog.c goldfish_battery.c \ - goldfish_timer.c goldfish_tty.c scsi-disk.c \ - smc91c111.c goldfish_trace.c usb-hid.c usb-hub.c usb-msd.c usb-ohci.c \ - usb.c \ - dma.c - -LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%) -LOCAL_CFLAGS += -I$(LOCAL_PATH)/hw - # include slirp2 code, i.e. the user-level networking stuff # SLIRP_SOURCES := bootp.c cksum.c debug.c if.c ip_icmp.c ip_input.c ip_output.c \ @@ -439,20 +389,20 @@ LOCAL_CFLAGS += -I$(LOCAL_PATH)/proxy # the skin support sources # -SKIN_SOURCES := skin_rect.c \ - skin_region.c \ - skin_image.c \ - skin_trackball.c \ - skin_keyboard.c \ - skin_keyset.c \ - skin_file.c \ - skin_window.c \ - skin_scaler.c \ - skin_composer.c \ - skin_surface.c \ - -LOCAL_SRC_FILES += $(SKIN_SOURCES:%=skins/%) -LOCAL_CFLAGS += -I$(LOCAL_PATH)/skins +SKIN_SOURCES := rect.c \ + region.c \ + image.c \ + trackball.c \ + keyboard.c \ + keyset.c \ + file.c \ + window.c \ + scaler.c \ + composer.c \ + surface.c \ + +LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%) +#LOCAL_CFLAGS += -I$(LOCAL_PATH)/skin ifeq ($(HOST_ARCH),x86) # enable MMX code for our skin scaler @@ -461,35 +411,63 @@ endif # include other sources # -VL_SOURCES := vl.c osdep.c \ - block.c readline.c monitor.c console.c loader.c sockets.c \ - block-qcow.c aes.c block-cloop.c block-dmg.c \ +VL_SOURCES := vl.c osdep.c cutils.c \ + block.c readline.c monitor.c console.c loader.c sockets.c \ + block-qcow.c aes.c d3des.c block-cloop.c block-dmg.c block-vvfat.c \ + block-qcow2.c block-cow.c \ cbuffer.c \ gdbstub.c usb-linux.c \ - trace.c dcache.c varint.c vnc.c disas.c arm-dis.c \ - qemu_timers.c \ + vnc.c disas.c arm-dis.c \ shaper.c charpipe.c loadpng.c \ framebuffer.c \ tcpdump.c \ - android_debug.c \ - android_help.c \ - android_option.c \ - android_main.c \ - android_charmap.c \ - android_resource.c \ - android_utils.c \ - android_console.c \ - android_events.c \ - android_timezone.c \ - android_config.c \ - android_gps.c \ - android_qemud.c \ - android_kmsg.c \ - android_hw_control.c \ - android/utils/ini.c \ + android/charmap.c \ + android/cmdline-option.c \ + android/config.c \ + android/console.c \ + android/gps.c \ + android/help.c \ + android/hw-control.c \ + android/hw-events.c \ + android/hw-kmsg.c \ + android/main.c \ + android/qemud.c \ + android/resource.c \ + android/utils/bufprint.c \ + android/utils/debug.c \ android/utils/dirscanner.c \ - android/vm/hw-config.c \ - android/vm/info.c \ + android/utils/display.c \ + android/utils/ini.c \ + android/utils/filelock.c \ + android/utils/misc.c \ + android/utils/path.c \ + android/utils/reflist.c \ + android/utils/stralloc.c \ + android/utils/system.c \ + android/utils/tempfile.c \ + android/utils/timezone.c \ + android/avd/hw-config.c \ + android/avd/info.c \ + +# we need to add a Quartz-specific file +ifeq ($(HOST_OS),darwin) + # Alas, the Android build system doesn't know how to deal + # with Objective C sources yet. + ifeq ($(BUILD_STANDALONE_EMULATOR),true) + VL_SOURCES += android/utils/display-quartz.m + else + LOCAL_CFLAGS += -DCONFIG_NO_COCOA + endif +endif + +VL_SOURCES += hw/arm_boot.c \ + hw/android_arm.c \ + +ifeq ($(HOST_OS),windows) + VL_SOURCES += block-raw-win32.c +else + VL_SOURCES += block-raw-posix.c +endif ifeq ($(HOST_OS),linux) LOCAL_LDLIBS += -lX11 @@ -498,12 +476,15 @@ endif ifeq ($(HOST_ARCH),x86) VL_SOURCES += i386-dis.c endif +ifeq ($(HOST_ARCH),x86_64) + VL_SOURCES += i386-dis.c +endif ifeq ($(HOST_ARCH),ppc) VL_SOURCES += ppc-dis.c endif ifeq ($(HOST_OS),windows) - VL_SOURCES += tap-win32.c + #VL_SOURCES += tap-win32.c LOCAL_LDLIBS += -mno-cygwin -mwindows -mconsole endif @@ -518,6 +499,7 @@ endif LOCAL_CFLAGS += $(SDL_CFLAGS) LOCAL_LDLIBS += $(SDL_LDLIBS) LOCAL_STATIC_LIBRARIES += libSDL libSDLmain +LOCAL_STATIC_LIBRARIES += libSDL libSDLmain # on Windows, link the icon file as well into the executable # unfortunately, our build system doesn't help us much, so we need @@ -532,8 +514,8 @@ $(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc # 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 prepend to this value, which forces -# use to put the object file in the source directory... +# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces +# us to put the object file in the source directory... # LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ) endif |