diff options
-rw-r--r-- | Makefile.android | 8 | ||||
-rw-r--r-- | Makefile.common | 59 | ||||
-rw-r--r-- | Makefile.target | 4 | ||||
-rw-r--r-- | android/avd/hw-config-defs.h | 305 | ||||
-rw-r--r-- | android/build/binary.make | 5 | ||||
-rw-r--r-- | android/build/definitions.make | 13 |
6 files changed, 70 insertions, 324 deletions
diff --git a/Makefile.android b/Makefile.android index 3b1619b..01cb35b 100644 --- a/Makefile.android +++ b/Makefile.android @@ -149,17 +149,17 @@ start-emulator-library = \ $(eval LOCAL_LDLIBS := $(MY_LDLIBS)) \ $(eval LOCAL_MODULE_TAGS := debug) \ $(eval LOCAL_MODULE := $1) \ + $(eval LOCAL_MODULE_CLASS := STATIC_LIBRARIES) # Used with start-emulator-library end-emulator-library = \ - $(eval include $(BUILD_HOST_STATIC_LIBRARY)) \ - $(eval EMULATOR_MODULE_TYPE := STATIC_LIBRARY) + $(eval include $(BUILD_HOST_STATIC_LIBRARY)) # A variant of start-emulator-library to start the definition of a host # program instead. Use with end-emulator-program start-emulator-program = \ $(call start-emulator-library,$1) \ - $(eval EMULATOR_MODULE_TYPE := EXECUTABLES) + $(eval LOCAL_MODULE_CLASS := EXECUTABLES) # A varient of end-emulator-library for host programs instead end-emulator-program = \ @@ -251,6 +251,8 @@ LOCAL_SRC_FILES := \ android/protocol/core-commands-proxy.c \ android/protocol/user-events-proxy.c \ +$(call gen-hw-config-defs,android/main-common.c) + LOCAL_SRC_FILES += $(SDLMAIN_SOURCES) LOCAL_STATIC_LIBRARIES += $(SDL_STATIC_LIBRARIES) diff --git a/Makefile.common b/Makefile.common index 222a1ae..b81b475 100644 --- a/Makefile.common +++ b/Makefile.common @@ -13,6 +13,42 @@ ############################################################################## ############################################################################## ### +### gen-hw-config-defs: Generate hardware configuration definitions header +### +### The 'gen-hw-config.py' script is used to generate the hw-config-defs.h +### header from the an .ini file like android/avd/hardware-properties.ini +### +### Due to the way the Android build system works, we need to regenerate +### it for each module (the output will go into a module-specific directory). +### +### This defines a function that can be used inside a module definition +### +### $(call gen-hw-config-defs) +### + +# First, define a rule to generate a dummy "emulator_hw_config_defs" module +# which purpose is simply to host the generated header in its output directory. +intermediates := $(call intermediates-dir-for,SHARED_LIBRARIES,emulator_hw_config_defs,true) + +QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini +QEMU_HW_CONFIG_DEFS_H := $(intermediates)/android/avd/hw-config-defs.h +$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH) +$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(LOCAL_PATH)/android/tools/gen-hw-config.py $< $@ +$(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py + $(hide) rm -f $@ + $(transform-generated-source) + +QEMU_HW_CONFIG_DEFS_INCLUDES := $(intermediates) + +# Second, define a function that needs to be called inside each module that contains +# a source file that includes the generated header file. +gen-hw-config-defs = \ + $(eval LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H))\ + $(eval LOCAL_C_INCLUDES += $(QEMU_HW_CONFIG_DEFS_INCLUDES)) + +############################################################################## +############################################################################## +### ### emulator-common: LIBRARY OF COMMON FUNCTIONS ### ### THESE ARE POTENTIALLY USED BY ALL COMPONENTS @@ -90,6 +126,8 @@ LOCAL_SRC_FILES += \ android/utils/tempfile.c \ android/utils/vector.c \ +$(call gen-hw-config-defs) + LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) $(call end-emulator-library) @@ -215,6 +253,8 @@ LOCAL_SRC_FILES += \ android/qemulator.c \ android/keycode.c \ +$(call gen-hw-config-defs) + # enable MMX code for our skin scaler ifeq ($(HOST_ARCH),x86) LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx @@ -383,6 +423,8 @@ CORE_MISC_SOURCES = \ android/snapshot.c \ android/utils/timezone.c \ +$(call gen-hw-config-defs) + ifeq ($(HOST_ARCH),x86) CORE_MISC_SOURCES += i386-dis.c endif @@ -475,19 +517,6 @@ LOCAL_SRC_FILES += \ qlist.c \ qstring.c \ -# hw-config-defs.h is generated from android/avd/hardware-properties.ini -# -QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini -QEMU_HW_CONFIG_DEFS_H := $(LOCAL_PATH)/android/avd/hw-config-defs.h -$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH) -$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_SOURCES := $(QEMU_HARDWARE_PROPERTIES_INI) -$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $(QEMU_HARDWARE_PROPERTIES_INI) $@ -$(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py - $(hide) rm -f $@ - $(transform-generated-source) - -$(LOCAL_PATH)/android/avd/hw-config.h: $(QEMU_HW_CONFIG_DEFS_H) - # gdbstub-xml.c contains C-compilable arrays corresponding to the content # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script. # @@ -603,7 +632,7 @@ $(call end-emulator-library) gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3)) define gen-hx-header-ev -intermediates := $$(call intermediates-dir-for,$$(EMULATOR_MODULE_TYPE),$$(LOCAL_MODULE),true) +intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true) QEMU_HEADER_H := $$(intermediates)/$$2 $$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH) @@ -613,7 +642,5 @@ $$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H) LOCAL_C_INCLUDES += $$(intermediates) -_objects := $$(patsubst %,$$(intermediates)/%,$$(3:.c=.o)) -$$(_objects): $$(QEMU_HEADER_H) endef diff --git a/Makefile.target b/Makefile.target index 5f7a8b2..ccc86b4 100644 --- a/Makefile.target +++ b/Makefile.target @@ -86,6 +86,8 @@ HW_SOURCES := \ usb.c \ watchdog.c +$(call gen-hw-config-defs) + ifeq ($(EMULATOR_TARGET_ARCH),arm) HW_SOURCES += android_arm.c \ arm_pic.c \ @@ -277,6 +279,7 @@ LOCAL_SRC_FILES := \ $(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c) $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h) +$(call gen-hw-config-defs) ifeq ($(HOST_OS),darwin) FRAMEWORKS := OpenGL Cocoa QuickTime ApplicationServices Carbon IOKit @@ -356,6 +359,7 @@ LOCAL_SRC_FILES := \ $(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c) $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h) +$(call gen-hw-config-defs) # The following files cannot be in static libraries because they contain # constructor functions that are otherwise stripped by the final linker diff --git a/android/avd/hw-config-defs.h b/android/avd/hw-config-defs.h deleted file mode 100644 index bb523d5..0000000 --- a/android/avd/hw-config-defs.h +++ /dev/null @@ -1,305 +0,0 @@ -/* this file is automatically generated from 'hardware-properties.ini' - * DO NOT EDIT IT. To re-generate it, use android/tools/gen-hw-config.py' - */ -#ifndef HWCFG_INT -#error HWCFG_INT not defined -#endif -#ifndef HWCFG_BOOL -#error HWCFG_BOOL not defined -#endif -#ifndef HWCFG_DISKSIZE -#error HWCFG_DISKSIZE not defined -#endif -#ifndef HWCFG_STRING -#error HWCFG_STRING not defined -#endif -#ifndef HWCFG_DOUBLE -#error HWCFG_DOUBLE not defined -#endif - -HWCFG_STRING( - hw_cpu_arch, - "hw.cpu.arch", - "arm", - "CPU Architecture", - "The CPU Architecture to emulator") - -HWCFG_STRING( - hw_cpu_model, - "hw.cpu.model", - "", - "CPU model", - "The CPU model (QEMU-specific string)") - -HWCFG_INT( - hw_ramSize, - "hw.ramSize", - 0, - "Device ram size", - "The amount of physical RAM on the device, in megabytes.") - -HWCFG_BOOL( - hw_touchScreen, - "hw.touchScreen", - "yes", - "Touch-screen support", - "Whether there is a touch screen or not on the device.") - -HWCFG_BOOL( - hw_trackBall, - "hw.trackBall", - "yes", - "Track-ball support", - "Whether there is a trackball on the device.") - -HWCFG_BOOL( - hw_keyboard, - "hw.keyboard", - "yes", - "Keyboard support", - "Whether the device has a QWERTY keyboard.") - -HWCFG_BOOL( - hw_keyboard_lid, - "hw.keyboard.lid", - "yes", - "Keyboard lid support", - "Whether the QWERTY keyboard can be opened/closed.") - -HWCFG_BOOL( - hw_dPad, - "hw.dPad", - "yes", - "DPad support", - "Whether the device has DPad keys") - -HWCFG_BOOL( - hw_gsmModem, - "hw.gsmModem", - "yes", - "GSM modem support", - "Whether there is a GSM modem in the device.") - -HWCFG_BOOL( - hw_camera, - "hw.camera", - "no", - "Camera support", - "Whether the device has a camera.") - -HWCFG_INT( - hw_camera_maxHorizontalPixels, - "hw.camera.maxHorizontalPixels", - 640, - "Maximum horizontal camera pixels", - "") - -HWCFG_INT( - hw_camera_maxVerticalPixels, - "hw.camera.maxVerticalPixels", - 480, - "Maximum vertical camera pixels", - "") - -HWCFG_BOOL( - hw_gps, - "hw.gps", - "yes", - "GPS support", - "Whether there is a GPS in the device.") - -HWCFG_BOOL( - hw_battery, - "hw.battery", - "yes", - "Battery support", - "Whether the device can run on a battery.") - -HWCFG_BOOL( - hw_accelerometer, - "hw.accelerometer", - "yes", - "Accelerometer", - "Whether there is an accelerometer in the device.") - -HWCFG_BOOL( - hw_audioInput, - "hw.audioInput", - "yes", - "Audio recording support", - "Whether the device can record audio") - -HWCFG_BOOL( - hw_audioOutput, - "hw.audioOutput", - "yes", - "Audio playback support", - "Whether the device can play audio") - -HWCFG_BOOL( - hw_sdCard, - "hw.sdCard", - "yes", - "SD Card support", - "Whether the device supports insertion/removal of virtual SD Cards.") - -HWCFG_STRING( - hw_sdCard_path, - "hw.sdCard.path", - "", - "SD Card image path", - "") - -HWCFG_BOOL( - disk_cachePartition, - "disk.cachePartition", - "yes", - "Cache partition support", - "Whether we use a /cache partition on the device.") - -HWCFG_STRING( - disk_cachePartition_path, - "disk.cachePartition.path", - "", - "Cache partition", - "Cache partition to use on the device. Ignored if disk.cachePartition is not 'yes'.") - -HWCFG_DISKSIZE( - disk_cachePartition_size, - "disk.cachePartition.size", - "66MB", - "Cache partition size", - "") - -HWCFG_INT( - hw_lcd_width, - "hw.lcd.width", - 320, - "LCD pixel width", - "") - -HWCFG_INT( - hw_lcd_height, - "hw.lcd.height", - 640, - "LCD pixel height", - "") - -HWCFG_INT( - hw_lcd_depth, - "hw.lcd.depth", - 16, - "LCD color depth", - "Must be 16 or 32. Color bit depth of emulated framebuffer.") - -HWCFG_INT( - hw_lcd_density, - "hw.lcd.density", - 160, - "Abstracted LCD density", - "Must be one of 120, 160 or 240. A value used to roughly describe the density of the LCD screen for automatic resource/asset selection.") - -HWCFG_BOOL( - hw_lcd_backlight, - "hw.lcd.backlight", - "yes", - "LCD backlight", - "Enable/Disable LCD backlight simulation,yes-enabled,no-disabled.") - -HWCFG_INT( - vm_heapSize, - "vm.heapSize", - 0, - "Max VM application heap size", - "The maximum heap size a Dalvik application might allocate before being killed by the system. Value is in megabytes.") - -HWCFG_BOOL( - hw_sensors_proximity, - "hw.sensors.proximity", - "yes", - "Proximity support", - "Whether there is an proximity in the device.") - -HWCFG_STRING( - kernel_path, - "kernel.path", - "", - "Path to the kernel image", - "Path to the kernel image.") - -HWCFG_STRING( - kernel_parameters, - "kernel.parameters", - "", - "kernel boot parameters string.", - "") - -HWCFG_STRING( - disk_ramdisk_path, - "disk.ramdisk.path", - "", - "Path to the ramdisk image", - "Path to the ramdisk image.") - -HWCFG_STRING( - disk_systemPartition_path, - "disk.systemPartition.path", - "", - "Path to runtime system partition image", - "") - -HWCFG_STRING( - disk_systemPartition_initPath, - "disk.systemPartition.initPath", - "", - "Initial system partition image", - "") - -HWCFG_DISKSIZE( - disk_systemPartition_size, - "disk.systemPartition.size", - "0", - "Ideal size of system partition", - "") - -HWCFG_STRING( - disk_dataPartition_path, - "disk.dataPartition.path", - "<temp>", - "Path to data partition file", - "Path to data partition file. Cannot be empty. Special value <temp> means using a temporary file. If disk.dataPartition.initPath is not empty, its content will be copied to the disk.dataPartition.path file at boot-time.") - -HWCFG_STRING( - disk_dataPartition_initPath, - "disk.dataPartition.initPath", - "", - "Initial data partition", - "If not empty, its content will be copied to the disk.dataPartition.path file at boot-time.") - -HWCFG_DISKSIZE( - disk_dataPartition_size, - "disk.dataPartition.size", - "0", - "Ideal size of data partition", - "") - -HWCFG_STRING( - disk_snapStorage_path, - "disk.snapStorage.path", - "", - "Path to snapshot storage", - "Path to a 'snapshot storage' file, where all snapshots are stored.") - -HWCFG_STRING( - avd_name, - "avd.name", - "<build>", - "Name of the AVD being run", - "") - -#undef HWCFG_INT -#undef HWCFG_BOOL -#undef HWCFG_DISKSIZE -#undef HWCFG_STRING -#undef HWCFG_DOUBLE -/* end of auto-generated file */ diff --git a/android/build/binary.make b/android/build/binary.make index f6542dc..3bc4fe9 100644 --- a/android/build/binary.make +++ b/android/build/binary.make @@ -25,6 +25,8 @@ LOCAL_GENERATED_C_SOURCES := $(filter %.c,$(LOCAL_GENERATED_SOURCES)) LOCAL_CXX_SOURCES := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES) $(LOCAL_GENERATED_SOURCES)) LOCAL_OBJC_SOURCES := $(filter %.m,$(LOCAL_SRC_FILES) $(LOCAL_GENERATED_SOURCES)) +LOCAL_CFLAGS := $(strip $(patsubst %,-I%,$(LOCAL_C_INCLUDES)) $(LOCAL_CFLAGS)) + $(foreach src,$(LOCAL_C_SOURCES), \ $(eval $(call compile-c-source,$(src))) \ ) @@ -41,4 +43,7 @@ $(foreach src,$(LOCAL_OBJC_SOURCES), \ $(eval $(call compile-objc-source,$(src))) \ ) +# Ensure that we build all generated sources before the objects +$(LOCAL_OBJECTS): | $(LOCAL_GENERATED_SOURCES) + CLEAN_OBJS_DIRS += $(LOCAL_OBJS_DIR) diff --git a/android/build/definitions.make b/android/build/definitions.make index e31131b..ddf9150 100644 --- a/android/build/definitions.make +++ b/android/build/definitions.make @@ -13,6 +13,19 @@ # limitations under the License. # +# this turns off the suffix rules built into make +.SUFFIXES: + +# this turns off the RCS / SCCS implicit rules of GNU Make +% : RCS/%,v +% : RCS/% +% : %,v +% : s.% +% : SCCS/s.% + +# If a rule fails, delete $@. +.DELETE_ON_ERROR: + # shared definitions ifeq ($(strip $(SHOW)),) define pretty |