• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1ifeq ($(TARGET_ARCH),arm)
2LOCAL_PATH:= $(call my-dir)
3
4# determine the location of platform-specific directories
5#
6CONFIG_DIRS     := \
7    $(LOCAL_PATH)/android/config \
8    $(LOCAL_PATH)/android/config/$(HOST_PREBUILT_TAG)
9
10CONFIG_INCLUDES := $(CONFIG_DIRS:%=-I%)
11
12MY_OPTIM := -O2 -g -fno-PIC -falign-functions=0 -fomit-frame-pointer
13ifeq ($(BUILD_DEBUG_EMULATOR),true)
14    MY_OPTIM := -O0 -g
15endif
16
17MY_CFLAGS := $(CONFIG_INCLUDES) $(MY_OPTIM)
18
19# Overwrite configuration for debug builds.
20#
21ifeq ($(BUILD_DEBUG_EMULATOR),true)
22    MY_CFLAGS := $(CONFIG_INCLUDES) -O0 -g \
23                 -fno-PIC -falign-functions=0
24endif
25
26MY_LDLIBS :=
27
28# this is needed to build the emulator on 64-bit Linux systems
29ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
30  MY_CFLAGS += -Wa,--32
31endif
32
33ifeq ($(HOST_OS),freebsd)
34  MY_CFLAGS += -Wa,--32 -I /usr/local/include
35endif
36
37ifeq ($(HOST_OS),windows)
38  MY_CFLAGS += -D_WIN32 -mno-cygwin
39  # we need Win32 features  that are available since Windows 2000 Professional/Server (NT 5.0)
40  MY_CFLAGS += -DWINVER=0x501
41endif
42
43ifeq ($(HOST_ARCH),ppc)
44    MY_CFLAGS += -D__powerpc__
45endif
46
47ifeq ($(HOST_OS),darwin)
48    MY_CFLAGS += -mdynamic-no-pic
49
50    # When building on Leopard or above, we need to use the 10.4 SDK
51    # or the generated binary will not run on Tiger.
52    DARWIN_VERSION := $(strip $(shell sw_vers -productVersion))
53    ifneq ($(filter 10.1 10.2 10.3 10.1.% 10.2.% 10.3.%,$(DARWIN_VERSION)),)
54        $(error Building the Android emulator requires OS X 10.4 or above)
55    endif
56    ifeq ($(filter 10.4 10.4.%,$(DARWIN_VERSION)),)
57        # We are on Leopard or above
58        TIGER_SDK := /Developer/SDKs/MacOSX10.4u.sdk
59        ifeq ($(strip $(wildcard $(TIGER_SDK))),)
60            $(info  Please install the 10.4 SDK on this machine at $(TIGER_SDK))
61            $(error Aborting the build.)
62        endif
63        MY_CFLAGS += -isysroot $(TIGER_SDK) -mmacosx-version-min=10.4 -DMACOSX_DEPLOYMENT_TARGET=10.4
64        MY_LDLIBS += -isysroot $(TIGER_SDK) -Wl,-syslibroot,$(TIGER_SDK) -mmacosx-version-min=10.4
65    endif
66endif
67MY_CC := $(HOST_CC)
68
69# BUILD_STANDALONE_EMULATOR is only defined when building with
70# the android-rebuild.sh script. The script will also provide
71# adequate values for HOST_CC
72#
73ifneq ($(BUILD_STANDALONE_EMULATOR),true)
74
75  ifneq ($(USE_CCACHE),)
76    MY_CC := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache $(MY_CC)
77  endif
78endif
79
80
81ifneq ($(combo_target)$(TARGET_SIMULATOR),HOST_true)
82  ifneq ($(HOST_ARCH),x86_64)
83    MY_CFLAGS += -m32
84    MY_LDLIBS += -m32
85  endif
86endif
87
88include $(CLEAR_VARS)
89
90###########################################################
91# Zlib configuration
92#
93ZLIB_DIR := distrib/zlib-1.2.3
94include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make
95
96###########################################################
97# Libpng configuration
98#
99LIBPNG_DIR := distrib/libpng-1.2.19
100include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
101
102###############################################################################
103# build the TCG code generator
104#
105include $(CLEAR_VARS)
106
107LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
108LOCAL_CC                        := $(MY_CC)
109LOCAL_CFLAGS                    := $(MY_CFLAGS) $(LOCAL_CFLAGS)
110LOCAL_LDLIBS                    := $(MY_LDLIBS)
111LOCAL_MODULE                    := emulator-tcg
112
113TCG_TARGET := $(HOST_ARCH)
114ifeq ($(TCG_TARGET),x86)
115  TCG_TARGET := i386
116endif
117
118TCG_CFLAGS := -I$(LOCAL_PATH)/tcg -I$(LOCAL_PATH)/tcg/$(TCG_TARGET)
119
120LOCAL_CFLAGS += $(TCG_CFLAGS) \
121                -I$(LOCAL_PATH)/target-arm \
122                -I$(LOCAL_PATH)/fpu \
123
124LOCAL_SRC_FILES := \
125    tcg/tcg.c \
126    tcg/tcg-runtime.c \
127
128include $(BUILD_HOST_STATIC_LIBRARY)
129
130##############################################################################
131# build the HW emulation support
132#
133include $(CLEAR_VARS)
134
135LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
136LOCAL_CC                        := $(MY_CC)
137LOCAL_MODULE                    := emulator-hw
138
139HW_CFLAGS    := -I$(LOCAL_PATH)/hw
140
141LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
142LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(HW_CFLAGS)
143LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
144
145HW_SOURCES := \
146    android_arm.c \
147    arm_pic.c \
148    bt.c \
149    bt-hci.c \
150    bt-hid.c \
151    bt-l2cap.c \
152    bt-sdp.c \
153    cdrom.c \
154    dma.c \
155    irq.c \
156    goldfish_audio.c \
157    goldfish_battery.c \
158    goldfish_device.c \
159    goldfish_events_device.c \
160    goldfish_fb.c \
161    goldfish_interrupt.c \
162    goldfish_memlog.c \
163    goldfish_mmc.c \
164    goldfish_nand.c  \
165    goldfish_switch.c \
166    goldfish_timer.c \
167    goldfish_trace.c \
168    goldfish_tty.c \
169    msmouse.c \
170    pci.c \
171    qdev.c \
172    scsi-disk.c \
173    smc91c111.c \
174    sysbus.c \
175    usb-hid.c \
176    usb-hub.c \
177    usb-msd.c \
178    usb-ohci.c \
179    usb.c \
180    watchdog.c \
181
182LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%)
183
184include $(BUILD_HOST_STATIC_LIBRARY)
185
186##############################################################################
187# build the ARM-specific emulation engine sources
188#
189include $(CLEAR_VARS)
190
191LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
192LOCAL_CC                        := $(MY_CC)
193LOCAL_MODULE                    := emulator-arm
194LOCAL_LDLIBS                    := $(MY_LDLIBS)
195LOCAL_CFLAGS                    := $(MY_CFLAGS) $(LOCAL_CFLAGS)
196LOCAL_STATIC_LIBRARIES          := emulator-hw
197
198LOCAL_CFLAGS := -fno-PIC -fomit-frame-pointer -Wno-sign-compare
199LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
200
201LOCAL_CFLAGS += -I$(LOCAL_PATH) \
202                -I$(LOCAL_PATH)/target-arm \
203                -I$(LOCAL_PATH)/fpu \
204                $(TCG_CFLAGS) \
205                $(HW_CFLAGS) \
206
207ifeq ($(HOST_ARCH),ppc)
208    LOCAL_CFLAGS += -D__powerpc__
209endif
210
211LOCAL_SRC_FILES += exec.c cpu-exec.c  \
212                   target-arm/op_helper.c \
213                   target-arm/iwmmxt_helper.c \
214                   target-arm/neon_helper.c \
215                   target-arm/helper.c \
216                   target-arm/translate.c \
217                   target-arm/machine.c \
218                   translate-all.c \
219                   hw/armv7m.c \
220                   hw/armv7m_nvic.c \
221                   arm-semi.c \
222                   trace.c \
223                   varint.c \
224                   dcache.c \
225
226LOCAL_SRC_FILES += fpu/softfloat.c
227
228include $(BUILD_HOST_STATIC_LIBRARY)
229
230##############################################################################
231# SDL-related definitions
232#
233
234SDL_CONFIG ?= prebuilt/$(HOST_PREBUILT_TAG)/sdl/bin/sdl-config
235SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
236
237# We need to filter out the _GNU_SOURCE variable because it breaks recent
238# releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
239# need this macro at all to build the Android emulator.
240SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
241SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
242
243
244##############################################################################
245# determine audio sources, build the prebuilt audio-library if needed
246#
247
248# determine AUDIO sources based on current configuration
249#
250AUDIO_SOURCES := audio.c noaudio.c wavaudio.c sdlaudio.c wavcapture.c mixeng.c
251AUDIO_CFLAGS  := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
252AUDIO_LDLIBS  :=
253
254ifeq ($(HOST_OS),darwin)
255  CONFIG_COREAUDIO ?= yes
256  AUDIO_CFLAGS += -DHOST_BSD=1
257endif
258
259ifeq ($(HOST_OS),windows)
260  CONFIG_WINAUDIO ?= yes
261endif
262
263ifeq ($(HOST_OS),linux)
264  CONFIG_OSS  ?= yes
265  CONFIG_ALSA ?= yes
266  CONFIG_ESD  ?= yes
267endif
268
269ifeq ($(HOST_OS),freebsd)
270  CONFIG_OSS ?= yes
271endif
272
273ifeq ($(CONFIG_COREAUDIO),yes)
274  AUDIO_SOURCES += coreaudio.c
275  AUDIO_CFLAGS  += -DCONFIG_COREAUDIO
276  AUDIO_LDLIBS  += -Wl,-framework,CoreAudio
277endif
278
279ifeq ($(CONFIG_WINAUDIO),yes)
280  AUDIO_SOURCES += winaudio.c
281  AUDIO_CFLAGS  += -DCONFIG_WINAUDIO
282endif
283
284ifeq ($(CONFIG_ALSA),yes)
285  AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
286  AUDIO_CFLAGS  += -DCONFIG_ALSA
287endif
288
289ifeq ($(CONFIG_ESD),yes)
290  AUDIO_SOURCES += esdaudio.c
291  AUDIO_CFLAGS  += -DCONFIG_ESD
292endif
293
294ifeq ($(CONFIG_OSS),yes)
295  AUDIO_SOURCES += ossaudio.c
296  AUDIO_CFLAGS  += -DCONFIG_OSS
297endif
298
299AUDIO_SOURCES := $(AUDIO_SOURCES:%=audio/%)
300
301# determine whether we're going to use the prebuilt
302# audio library (this is useful on Linux to avoid requiring
303# all sound-related development packages to be installed on
304# the build and developer machines).
305#
306# note that you can define BUILD_QEMU_AUDIO_LIB to true
307# in your environment to force recompilation.
308#
309QEMU_AUDIO_LIB :=
310
311ifneq ($(BUILD_STANDALONE_EMULATOR),true)
312  QEMU_AUDIO_LIB := $(wildcard \
313	prebuilt/$(HOST_PREBUILT_TAG)/emulator/libqemu-audio.a)
314endif
315
316ifeq ($(BUILD_QEMU_AUDIO_LIB),true)
317  include $(CLEAR_VARS)
318  LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
319  LOCAL_CC                        := $(MY_CC)
320  LOCAL_MODULE                    := libqemu-audio
321  LOCAL_LDLIBS                    := $(MY_LDLIBS)
322
323  LOCAL_CFLAGS := -Wno-sign-compare \
324                  -fno-strict-aliasing -W -Wall -Wno-unused-parameter \
325                  -I$(LOCAL_PATH) \
326                  -I$(LOCAL_PATH)/target-arm \
327                  -I$(LOCAL_PATH)/fpu \
328
329  # this is very important, otherwise the generated binaries may
330  # not link properly on our build servers
331  ifeq ($(HOST_OS),linux)
332    LOCAL_CFLAGS += -fno-stack-protector
333  endif
334
335  LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(AUDIO_CFLAGS)
336
337  LOCAL_CFLAGS += $(SDL_CFLAGS)
338
339  LOCAL_SRC_FILES += $(AUDIO_SOURCES)
340
341  include $(BUILD_HOST_STATIC_LIBRARY)
342  QEMU_AUDIO_LIB := $(LOCAL_BUILT_MODULE)
343
344endif  # !QEMU_AUDIO_LIB
345
346##############################################################################
347# now build the emulator itself
348#
349include $(CLEAR_VARS)
350
351LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
352LOCAL_CC                        := $(MY_CC)
353LOCAL_MODULE                    := emulator
354LOCAL_STATIC_LIBRARIES          := emulator-hw emulator-arm emulator-tcg
355LOCAL_LDLIBS                    := $(MY_LDLIBS)
356
357# don't remove the -fno-strict-aliasing, or you'll break things
358# (e.g. slirp-android/network support)
359#
360LOCAL_CFLAGS := -fno-PIC -Wno-sign-compare \
361                -fno-strict-aliasing -g -W -Wall -Wno-unused-parameter
362
363LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
364
365# add the build ID to the default macro definitions
366LOCAL_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))"
367
368# include the Zlib sources
369#
370LOCAL_SRC_FILES += $(ZLIB_SOURCES)
371LOCAL_CFLAGS    += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
372
373# include the Libpng sources
374#
375LOCAL_SRC_FILES += $(LIBPNG_SOURCES)
376LOCAL_CFLAGS    += $(LIBPNG_CFLAGS) -I$(LOCAL_PATH)/$(LIBPNG_DIR)
377
378LOCAL_CFLAGS    += -I$(LOCAL_PATH)/ \
379                   -I$(LOCAL_PATH)/target-arm \
380                   -I$(LOCAL_PATH)/fpu \
381                   $(TCG_CFLAGS) \
382                   $(HW_CFLAGS) \
383
384# Needed by the upstream code
385LOCAL_CFLAGS += -DNEED_CPU_H
386
387# include telephony stuff
388#
389TELEPHONY_SOURCES := android_modem.c modem_driver.c gsm.c sim_card.c sysdeps_qemu.c sms.c remote_call.c
390LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
391LOCAL_CFLAGS    += -I$(LOCAL_PATH)/telephony
392
393# include sound support source files. we first try to see if we have a prebuilt audio
394# library. if not, we build things the "hard" way.
395#
396# note that to generate the prebuilt audio library, you should do the following:
397#
398#   cd tools/qemu
399#   ./android-rebuild.sh
400#   distrib/update-audio.sh
401#
402ifeq ($(QEMU_AUDIO_LIB),)
403  LOCAL_SRC_FILES += $(AUDIO_SOURCES)
404endif  # !QEMU_AUDIO_LIB
405
406LOCAL_CFLAGS  += $(AUDIO_CFLAGS)
407LOCAL_LDLIBS  += $(AUDIO_LDLIBS)
408
409# include slirp-android code, i.e. the user-level networking stuff
410#
411SLIRP_SOURCES := bootp.c     cksum.c      debug.c  if.c     ip_icmp.c  ip_input.c   ip_output.c  \
412                 mbuf.c      misc.c       sbuf.c   slirp.c  socket.c   tcp_input.c  tcp_output.c \
413                 tcp_subr.c  tcp_timer.c  tftp.c   udp.c
414
415LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
416LOCAL_CFLAGS    += -I$(LOCAL_PATH)/slirp-android
417
418# socket proxy support
419#
420PROXY_SOURCES := \
421    proxy_common.c \
422    proxy_http.c \
423    proxy_http_connector.c \
424    proxy_http_rewriter.c \
425
426LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
427LOCAL_CFLAGS    += -I$(LOCAL_PATH)/proxy
428
429# the linux-user sources, I doubt we really need these
430#
431#LINUX_SOURCES := main.c elfload.c mmap.c signal.c path.c syscall.c
432#LOCAL_SRC_FILES += $(LINUX_SOURCES:%=linux-user/%)
433
434# the skin support sources
435#
436SKIN_SOURCES := rect.c \
437                region.c \
438                image.c \
439                trackball.c \
440                keyboard.c \
441                keyset.c \
442                file.c \
443                window.c \
444                scaler.c \
445                composer.c \
446                surface.c \
447
448LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
449#LOCAL_CFLAGS    += -I$(LOCAL_PATH)/skin
450
451ifeq ($(HOST_ARCH),x86)
452# enable MMX code for our skin scaler
453LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
454endif
455
456# include other sources
457#
458VL_SOURCES := vl-android.c osdep.c cutils.c \
459              block.c readline.c monitor.c console.c loader.c sockets.c \
460              aes.c d3des.c \
461              block/qcow.c \
462              block/qcow2.c \
463              block/qcow2-refcount.c \
464              block/qcow2-snapshot.c \
465              block/qcow2-cluster.c \
466              block/cloop.c \
467              block/dmg.c \
468              block/vvfat.c \
469              buffered_file.c \
470              cbuffer.c \
471              gdbstub.c \
472              vnc-android.c disas.c arm-dis.c \
473              shaper.c charpipe.c loadpng.c \
474              framebuffer.c \
475              tcpdump.c \
476              qemu-char-android.c \
477              qemu-malloc.c \
478              qemu-option.c \
479              savevm.c \
480              net-android.c \
481              acl.c \
482              aio-android.c \
483              dma-helpers.c \
484              qemu-sockets-android.c \
485              keymaps.c \
486              bt-host.c \
487              bt-vhci.c \
488              module.c \
489              android/boot-properties.c \
490              android/charmap.c \
491              android/cmdline-option.c \
492              android/config.c \
493              android/console.c \
494              android/gps.c \
495              android/help.c \
496              android/hw-control.c \
497              android/hw-events.c \
498              android/hw-kmsg.c \
499              android/hw-lcd.c \
500              android/hw-qemud.c \
501              android/hw-sensors.c \
502              android/keycode.c \
503              android/main.c \
504              android/resource.c \
505              android/user-config.c \
506              android/utils/bufprint.c \
507              android/utils/debug.c \
508              android/utils/dirscanner.c \
509              android/utils/ini.c \
510              android/utils/filelock.c \
511              android/utils/misc.c \
512              android/utils/path.c \
513              android/utils/reflist.c \
514              android/utils/stralloc.c \
515              android/utils/system.c \
516              android/utils/tempfile.c \
517              android/utils/timezone.c \
518              android/avd/hw-config.c \
519              android/avd/info.c \
520
521VL_SOURCES += hw/arm_boot.c \
522              hw/android_arm.c \
523
524ifeq ($(HOST_OS),windows)
525  VL_SOURCES += block/raw-win32.c \
526                migration-dummy-android.c \
527                iolooper-select.c
528else
529  VL_SOURCES += block/raw-posix.c \
530                migration.c \
531                migration-exec.c \
532                migration-tcp-android.c \
533                iolooper-select.c
534endif
535
536ifeq ($(HOST_OS),linux)
537    VL_SOURCES += usb-linux.c \
538                  qemu-thread.c
539    LOCAL_LDLIBS += -lX11
540else
541    VL_SOURCES += usb-dummy-android.c
542endif
543
544ifeq ($(HOST_ARCH),x86)
545    VL_SOURCES += i386-dis.c
546endif
547ifeq ($(HOST_ARCH),x86_64)
548    VL_SOURCES += i386-dis.c
549endif
550ifeq ($(HOST_ARCH),ppc)
551    VL_SOURCES += ppc-dis.c
552endif
553
554ifeq ($(HOST_OS),windows)
555  VL_SOURCES   += tap-win32.c
556  LOCAL_LDLIBS += -mno-cygwin -mwindows -mconsole
557endif
558
559LOCAL_SRC_FILES += $(VL_SOURCES)
560
561ifeq ($(HOST_OS),linux)
562  LOCAL_LDLIBS += -lutil -lrt
563endif
564
565# add SDL-specific flags
566#
567LOCAL_CFLAGS += $(SDL_CFLAGS)
568LOCAL_LDLIBS += $(SDL_LDLIBS)
569LOCAL_STATIC_LIBRARIES += libSDL libSDLmain
570LOCAL_STATIC_LIBRARIES += libSDL libSDLmain
571
572# on Windows, link the icon file as well into the executable
573# unfortunately, our build system doesn't help us much, so we need
574# to use some weird pathnames to make this work...
575#
576ifeq ($(HOST_OS),windows)
577INTERMEDIATE     := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
578ANDROID_ICON_OBJ := android_icon.o
579ANDROID_ICON_PATH := $(LOCAL_PATH)/images
580$(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc
581	windres $< -I $(ANDROID_ICON_PATH) -o $@
582
583# seems to be the only way to add an object file that was not generated from
584# a C/C++/Java source file to our build system. and very unfortunately,
585# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces
586# us to put the object file in the source directory...
587#
588LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ)
589endif
590
591# qemu-options.h is generated from qemu-options.hx with the "hxtool" shell script
592#
593intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
594
595QEMU_OPTIONS_H := $(intermediates)/qemu-options.h
596$(QEMU_OPTIONS_H): PRIVATE_PATH := $(LOCAL_PATH)
597$(QEMU_OPTIONS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@
598$(QEMU_OPTIONS_H): $(LOCAL_PATH)/qemu-options.hx $(LOCAL_PATH)/hxtool
599	$(transform-generated-source)
600
601$(intermediates)/vl-android.o: $(QEMU_OPTIONS_H)
602
603LOCAL_GENERATED_SOURCES += $(QEMU_OPTIONS_H)
604
605# qemu-monitor.h is generated from qemu-monitor.hx with the "hxtool" shell script
606#
607intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
608
609QEMU_MONITOR_H := $(intermediates)/qemu-monitor.h
610$(QEMU_MONITOR_H): PRIVATE_PATH := $(LOCAL_PATH)
611$(QEMU_MONITOR_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@
612$(QEMU_MONITOR_H): $(LOCAL_PATH)/qemu-monitor.hx $(LOCAL_PATH)/hxtool
613	$(transform-generated-source)
614
615$(intermediates)/vl-android.o: $(QEMU_MONITOR_H)
616
617LOCAL_GENERATED_SOURCES += $(QEMU_MONITOR_H)
618
619
620# gdbstub-xml.c contains C-compilable arrays corresponding to the content
621# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
622#
623ifeq ($(QEMU_TARGET_XML_SOURCES),)
624    QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
625    QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
626endif
627
628QEMU_GDBSTUB_XML_C := $(intermediates)/gdbstub-xml.c
629$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
630$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
631$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
632$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
633	$(hide) rm -f $@
634	$(transform-generated-source)
635
636$(intermediates)/vl-android.o: $(QEMU_GDBSTUB_XML_C)
637
638LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
639
640# hw-config-defs.h is generated from android/avd/hardware-properties.ini
641#
642QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini
643QEMU_HW_CONFIG_DEFS_H := $(LOCAL_PATH)/android/avd/hw-config-defs.h
644$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH)
645$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_SOURCES := $(QEMU_HARDWARE_PROPERTIES_INI)
646$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $(QEMU_HARDWARE_PROPERTIES_INI) $@
647$(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py
648	$(hide) rm -f $@
649	$(transform-generated-source)
650
651$(LOCAL_PATH)/android/avd/hw-config.h: $(QEMU_HW_CONFIG_DEFS_H)
652
653LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H)
654
655# this is already done by the Android build system, but is done for the
656# benefit of the stand-alone one.
657#
658ifeq ($(BUILD_STANDALONE_EMULATOR),true)
659  LOCAL_CFLAGS += -I$(intermediates)
660endif
661
662
663
664# other flags
665LOCAL_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
666LOCAL_LDLIBS += -lm -lpthread
667
668ifeq ($(HOST_OS),windows)
669    LOCAL_LDLIBS += -lwinmm -lws2_32 -liphlpapi
670endif
671
672LOCAL_LDLIBS += $(QEMU_AUDIO_LIB)
673
674LOCAL_MODULE := emulator
675
676include $(BUILD_HOST_EXECUTABLE)
677
678endif  # TARGET_ARCH == arm
679