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