blob: 598b430fa9ba89a5ea70e910187f3915b9ee993c [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
David 'Digit' Turner9a0f1fb2010-02-25 14:22:29 -080019MY_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' Turner9a0f1fb2010-02-25 14:22:29 -080028MY_CFLAGS += -DCONFIG_MEMCHECK
29
David 'Digit' Turnerb95f8922009-08-21 23:10:16 -070030MY_LDLIBS :=
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080031
32# this is needed to build the emulator on 64-bit Linux systems
33ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
34 MY_CFLAGS += -Wa,--32
35endif
36
37ifeq ($(HOST_OS),freebsd)
38 MY_CFLAGS += -Wa,--32 -I /usr/local/include
39endif
40
41ifeq ($(HOST_OS),windows)
42 MY_CFLAGS += -D_WIN32 -mno-cygwin
43 # we need Win32 features that are available since Windows 2000 Professional/Server (NT 5.0)
44 MY_CFLAGS += -DWINVER=0x501
45endif
46
47ifeq ($(HOST_ARCH),ppc)
48 MY_CFLAGS += -D__powerpc__
49endif
50
51ifeq ($(HOST_OS),darwin)
David 'Digit' Turner2910f182010-05-10 18:48:35 -070052 MY_CFLAGS += -mdynamic-no-pic
David Turnerbba461c2009-06-03 10:48:15 -070053
54 # When building on Leopard or above, we need to use the 10.4 SDK
55 # or the generated binary will not run on Tiger.
56 DARWIN_VERSION := $(strip $(shell sw_vers -productVersion))
57 ifneq ($(filter 10.1 10.2 10.3 10.1.% 10.2.% 10.3.%,$(DARWIN_VERSION)),)
58 $(error Building the Android emulator requires OS X 10.4 or above)
59 endif
60 ifeq ($(filter 10.4 10.4.%,$(DARWIN_VERSION)),)
61 # We are on Leopard or above
62 TIGER_SDK := /Developer/SDKs/MacOSX10.4u.sdk
63 ifeq ($(strip $(wildcard $(TIGER_SDK))),)
64 $(info Please install the 10.4 SDK on this machine at $(TIGER_SDK))
65 $(error Aborting the build.)
66 endif
David 'Digit' Turnerb95f8922009-08-21 23:10:16 -070067 MY_CFLAGS += -isysroot $(TIGER_SDK) -mmacosx-version-min=10.4 -DMACOSX_DEPLOYMENT_TARGET=10.4
68 MY_LDLIBS += -isysroot $(TIGER_SDK) -Wl,-syslibroot,$(TIGER_SDK) -mmacosx-version-min=10.4
Kenny Root095cd0f2009-09-19 18:32:44 -050069
70 # Beginning with Snow Leopard, the default compiler is GCC 4.2
71 # which is incompatible with the 10.4 SDK, so we must
72 # specify the use of GCC 4.0.
73 ifeq ($(filter 10.5 10.5.%,$(DARWIN_VERSION)),)
74 # We are on Snow Leopard or above
75 MY_CC := gcc-4.0
76 endif
David Turnerbba461c2009-06-03 10:48:15 -070077 endif
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080078endif
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080079
80# BUILD_STANDALONE_EMULATOR is only defined when building with
81# the android-rebuild.sh script. The script will also provide
82# adequate values for HOST_CC
83#
84ifneq ($(BUILD_STANDALONE_EMULATOR),true)
85
86 ifneq ($(USE_CCACHE),)
87 MY_CC := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache $(MY_CC)
88 endif
89endif
90
91
92ifneq ($(combo_target)$(TARGET_SIMULATOR),HOST_true)
93 ifneq ($(HOST_ARCH),x86_64)
David 'Digit' Turnerb95f8922009-08-21 23:10:16 -070094 MY_CFLAGS += -m32
95 MY_LDLIBS += -m32
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080096 endif
97endif
98
99include $(CLEAR_VARS)
100
101###########################################################
102# Zlib configuration
103#
104ZLIB_DIR := distrib/zlib-1.2.3
105include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make
106
107###########################################################
108# Libpng configuration
109#
110LIBPNG_DIR := distrib/libpng-1.2.19
111include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
112
113###############################################################################
114# build the TCG code generator
115#
116include $(CLEAR_VARS)
117
118LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
119LOCAL_CC := $(MY_CC)
120LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
David 'Digit' Turnerb95f8922009-08-21 23:10:16 -0700121LOCAL_LDLIBS := $(MY_LDLIBS)
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800122LOCAL_MODULE := emulator-tcg
123
124TCG_TARGET := $(HOST_ARCH)
125ifeq ($(TCG_TARGET),x86)
126 TCG_TARGET := i386
127endif
128
129TCG_CFLAGS := -I$(LOCAL_PATH)/tcg -I$(LOCAL_PATH)/tcg/$(TCG_TARGET)
130
131LOCAL_CFLAGS += $(TCG_CFLAGS) \
132 -I$(LOCAL_PATH)/target-arm \
133 -I$(LOCAL_PATH)/fpu \
134
135LOCAL_SRC_FILES := \
136 tcg/tcg.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800137
138include $(BUILD_HOST_STATIC_LIBRARY)
139
140##############################################################################
141# build the HW emulation support
142#
143include $(CLEAR_VARS)
144
145LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
146LOCAL_CC := $(MY_CC)
147LOCAL_MODULE := emulator-hw
148
149HW_CFLAGS := -I$(LOCAL_PATH)/hw
150
151LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
152LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(HW_CFLAGS)
153LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
154
155HW_SOURCES := \
156 android_arm.c \
157 arm_pic.c \
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700158 bt.c \
159 bt-hci.c \
160 bt-hid.c \
161 bt-l2cap.c \
162 bt-sdp.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800163 cdrom.c \
164 dma.c \
165 irq.c \
166 goldfish_audio.c \
167 goldfish_battery.c \
168 goldfish_device.c \
169 goldfish_events_device.c \
170 goldfish_fb.c \
171 goldfish_interrupt.c \
172 goldfish_memlog.c \
173 goldfish_mmc.c \
174 goldfish_nand.c \
175 goldfish_switch.c \
176 goldfish_timer.c \
177 goldfish_trace.c \
178 goldfish_tty.c \
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700179 msmouse.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800180 pci.c \
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700181 qdev.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800182 scsi-disk.c \
183 smc91c111.c \
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700184 sysbus.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800185 usb-hid.c \
186 usb-hub.c \
187 usb-msd.c \
188 usb-ohci.c \
189 usb.c \
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700190 watchdog.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800191
192LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%)
193
194include $(BUILD_HOST_STATIC_LIBRARY)
195
196##############################################################################
Vladimir Chtchetkine5389aa12010-02-16 10:38:35 -0800197# build the ELF/DWARF stuff
198# This library is used by emulator's memory checker to extract debug information
199# from the symbol files when reporting memory allocation violations. In
200# particular, this library is used to extract routine name and source file
201# location for the code address where violation has been detected.
202#
203include $(CLEAR_VARS)
204
205LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
206LOCAL_CC := $(MY_CC)
207LOCAL_MODULE := emulator-elff
208LOCAL_CPP_EXTENSION := .cc
209
210ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
211
212LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
213LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(ELFF_CFLAGS)
214LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
215
216ELFF_SOURCES := \
217 dwarf_cu.cc \
218 dwarf_die.cc \
219 dwarf_utils.cc \
220 elf_alloc.cc \
221 elf_file.cc \
222 elf_mapped_section.cc \
223 elff_api.cc \
224
225LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
226ELFF_LDLIBS := -lstdc++
227
228include $(BUILD_HOST_STATIC_LIBRARY)
229
230##############################################################################
231# build the memory access checking support
232# Memory access checker uses information collected by instrumented code in
233# libc.so in order to keep track of memory blocks allocated from heap. Memory
234# checker then uses this information to make sure that every access to allocated
235# memory is within allocated block. This information also allows detecting
236# memory leaks and attempts to free/realloc invalid pointers.
237#
238include $(CLEAR_VARS)
239
240LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
241LOCAL_CC := $(MY_CC)
242LOCAL_MODULE := emulator-memcheck
243
244MCHK_CFLAGS := -I$(LOCAL_PATH)/memcheck -I$(LOCAL_PATH)/elff
245
246LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
247LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(MCHK_CFLAGS)
248LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
249
250MCHK_SOURCES := \
251 memcheck.c \
252 memcheck_proc_management.c \
253 memcheck_malloc_map.c \
254 memcheck_mmrange_map.c \
255 memcheck_util.c \
256
257LOCAL_SRC_FILES += $(MCHK_SOURCES:%=memcheck/%)
258
259include $(BUILD_HOST_STATIC_LIBRARY)
260
261##############################################################################
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800262# build the ARM-specific emulation engine sources
263#
264include $(CLEAR_VARS)
265
266LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
267LOCAL_CC := $(MY_CC)
268LOCAL_MODULE := emulator-arm
David 'Digit' Turnerb95f8922009-08-21 23:10:16 -0700269LOCAL_LDLIBS := $(MY_LDLIBS)
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800270LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
271LOCAL_STATIC_LIBRARIES := emulator-hw
272
273LOCAL_CFLAGS := -fno-PIC -fomit-frame-pointer -Wno-sign-compare
274LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
275
276LOCAL_CFLAGS += -I$(LOCAL_PATH) \
277 -I$(LOCAL_PATH)/target-arm \
278 -I$(LOCAL_PATH)/fpu \
279 $(TCG_CFLAGS) \
280 $(HW_CFLAGS) \
281
282ifeq ($(HOST_ARCH),ppc)
283 LOCAL_CFLAGS += -D__powerpc__
284endif
285
286LOCAL_SRC_FILES += exec.c cpu-exec.c \
287 target-arm/op_helper.c \
288 target-arm/iwmmxt_helper.c \
289 target-arm/neon_helper.c \
290 target-arm/helper.c \
291 target-arm/translate.c \
292 target-arm/machine.c \
293 translate-all.c \
294 hw/armv7m.c \
295 hw/armv7m_nvic.c \
296 arm-semi.c \
297 trace.c \
298 varint.c \
299 dcache.c \
Vladimir Chtchetkine5389aa12010-02-16 10:38:35 -0800300 softmmu_outside_jit.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800301
302LOCAL_SRC_FILES += fpu/softfloat.c
303
304include $(BUILD_HOST_STATIC_LIBRARY)
305
306##############################################################################
307# SDL-related definitions
308#
309
310SDL_CONFIG ?= prebuilt/$(HOST_PREBUILT_TAG)/sdl/bin/sdl-config
311SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
312
313# We need to filter out the _GNU_SOURCE variable because it breaks recent
314# releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
315# need this macro at all to build the Android emulator.
316SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
317SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
318
319
320##############################################################################
321# determine audio sources, build the prebuilt audio-library if needed
322#
323
324# determine AUDIO sources based on current configuration
325#
Vladimir Chtchetkineeeac0132010-05-03 10:46:28 -0700326AUDIO_SOURCES := audio.c noaudio.c wavaudio.c wavcapture.c mixeng.c
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800327AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
328AUDIO_LDLIBS :=
329
330ifeq ($(HOST_OS),darwin)
331 CONFIG_COREAUDIO ?= yes
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700332 AUDIO_CFLAGS += -DHOST_BSD=1
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800333endif
334
335ifeq ($(HOST_OS),windows)
336 CONFIG_WINAUDIO ?= yes
337endif
338
339ifeq ($(HOST_OS),linux)
340 CONFIG_OSS ?= yes
341 CONFIG_ALSA ?= yes
342 CONFIG_ESD ?= yes
343endif
344
345ifeq ($(HOST_OS),freebsd)
346 CONFIG_OSS ?= yes
347endif
348
349ifeq ($(CONFIG_COREAUDIO),yes)
350 AUDIO_SOURCES += coreaudio.c
351 AUDIO_CFLAGS += -DCONFIG_COREAUDIO
352 AUDIO_LDLIBS += -Wl,-framework,CoreAudio
353endif
354
355ifeq ($(CONFIG_WINAUDIO),yes)
356 AUDIO_SOURCES += winaudio.c
357 AUDIO_CFLAGS += -DCONFIG_WINAUDIO
358endif
359
360ifeq ($(CONFIG_ALSA),yes)
361 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
362 AUDIO_CFLAGS += -DCONFIG_ALSA
363endif
364
365ifeq ($(CONFIG_ESD),yes)
366 AUDIO_SOURCES += esdaudio.c
367 AUDIO_CFLAGS += -DCONFIG_ESD
368endif
369
370ifeq ($(CONFIG_OSS),yes)
371 AUDIO_SOURCES += ossaudio.c
372 AUDIO_CFLAGS += -DCONFIG_OSS
373endif
374
375AUDIO_SOURCES := $(AUDIO_SOURCES:%=audio/%)
376
377# determine whether we're going to use the prebuilt
378# audio library (this is useful on Linux to avoid requiring
379# all sound-related development packages to be installed on
380# the build and developer machines).
381#
382# note that you can define BUILD_QEMU_AUDIO_LIB to true
383# in your environment to force recompilation.
384#
385QEMU_AUDIO_LIB :=
386
387ifneq ($(BUILD_STANDALONE_EMULATOR),true)
388 QEMU_AUDIO_LIB := $(wildcard \
389 prebuilt/$(HOST_PREBUILT_TAG)/emulator/libqemu-audio.a)
390endif
391
392ifeq ($(BUILD_QEMU_AUDIO_LIB),true)
393 include $(CLEAR_VARS)
394 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
395 LOCAL_CC := $(MY_CC)
396 LOCAL_MODULE := libqemu-audio
David 'Digit' Turnerb95f8922009-08-21 23:10:16 -0700397 LOCAL_LDLIBS := $(MY_LDLIBS)
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800398
399 LOCAL_CFLAGS := -Wno-sign-compare \
400 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \
401 -I$(LOCAL_PATH) \
402 -I$(LOCAL_PATH)/target-arm \
403 -I$(LOCAL_PATH)/fpu \
404
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200405 # this is very important, otherwise the generated binaries may
406 # not link properly on our build servers
407 ifeq ($(HOST_OS),linux)
408 LOCAL_CFLAGS += -fno-stack-protector
409 endif
410
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800411 LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(AUDIO_CFLAGS)
412
413 LOCAL_CFLAGS += $(SDL_CFLAGS)
414
415 LOCAL_SRC_FILES += $(AUDIO_SOURCES)
416
417 include $(BUILD_HOST_STATIC_LIBRARY)
418 QEMU_AUDIO_LIB := $(LOCAL_BUILT_MODULE)
419
420endif # !QEMU_AUDIO_LIB
421
422##############################################################################
423# now build the emulator itself
424#
425include $(CLEAR_VARS)
426
427LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
428LOCAL_CC := $(MY_CC)
429LOCAL_MODULE := emulator
Vladimir Chtchetkine5389aa12010-02-16 10:38:35 -0800430LOCAL_STATIC_LIBRARIES := emulator-memcheck emulator-hw emulator-arm emulator-tcg
431LOCAL_STATIC_LIBRARIES += emulator-elff
David 'Digit' Turnerb95f8922009-08-21 23:10:16 -0700432LOCAL_LDLIBS := $(MY_LDLIBS)
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800433
434# don't remove the -fno-strict-aliasing, or you'll break things
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700435# (e.g. slirp-android/network support)
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800436#
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700437LOCAL_CFLAGS := -fno-PIC -Wno-sign-compare \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800438 -fno-strict-aliasing -g -W -Wall -Wno-unused-parameter
439
440LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
441
442# add the build ID to the default macro definitions
443LOCAL_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))"
444
David 'Digit' Turnera383d022009-12-03 13:50:00 -0800445# For non-standalone builds, extract the major version number from the Android SDK
446# tools revision number.
447ifneq ($(BUILD_STANDALONE_EMULATOR),true)
448 ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties)
449endif
450
451ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION))
452ifdef ANDROID_SDK_TOOLS_REVISION
453 LOCAL_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION)
454endif
455
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800456# include the Zlib sources
457#
458LOCAL_SRC_FILES += $(ZLIB_SOURCES)
459LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
460
461# include the Libpng sources
462#
463LOCAL_SRC_FILES += $(LIBPNG_SOURCES)
464LOCAL_CFLAGS += $(LIBPNG_CFLAGS) -I$(LOCAL_PATH)/$(LIBPNG_DIR)
465
466LOCAL_CFLAGS += -I$(LOCAL_PATH)/ \
467 -I$(LOCAL_PATH)/target-arm \
468 -I$(LOCAL_PATH)/fpu \
469 $(TCG_CFLAGS) \
470 $(HW_CFLAGS) \
471
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700472# Needed by the upstream code
473LOCAL_CFLAGS += -DNEED_CPU_H
474
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800475# include telephony stuff
476#
477TELEPHONY_SOURCES := android_modem.c modem_driver.c gsm.c sim_card.c sysdeps_qemu.c sms.c remote_call.c
478LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
479LOCAL_CFLAGS += -I$(LOCAL_PATH)/telephony
480
481# include sound support source files. we first try to see if we have a prebuilt audio
482# library. if not, we build things the "hard" way.
483#
484# note that to generate the prebuilt audio library, you should do the following:
485#
486# cd tools/qemu
487# ./android-rebuild.sh
488# distrib/update-audio.sh
489#
490ifeq ($(QEMU_AUDIO_LIB),)
491 LOCAL_SRC_FILES += $(AUDIO_SOURCES)
492endif # !QEMU_AUDIO_LIB
493
494LOCAL_CFLAGS += $(AUDIO_CFLAGS)
495LOCAL_LDLIBS += $(AUDIO_LDLIBS)
496
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700497# include slirp-android code, i.e. the user-level networking stuff
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800498#
499SLIRP_SOURCES := bootp.c cksum.c debug.c if.c ip_icmp.c ip_input.c ip_output.c \
500 mbuf.c misc.c sbuf.c slirp.c socket.c tcp_input.c tcp_output.c \
501 tcp_subr.c tcp_timer.c tftp.c udp.c
502
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700503LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
504LOCAL_CFLAGS += -I$(LOCAL_PATH)/slirp-android
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800505
506# socket proxy support
507#
508PROXY_SOURCES := \
509 proxy_common.c \
510 proxy_http.c \
511 proxy_http_connector.c \
512 proxy_http_rewriter.c \
513
514LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
515LOCAL_CFLAGS += -I$(LOCAL_PATH)/proxy
516
517# the linux-user sources, I doubt we really need these
518#
519#LINUX_SOURCES := main.c elfload.c mmap.c signal.c path.c syscall.c
520#LOCAL_SRC_FILES += $(LINUX_SOURCES:%=linux-user/%)
521
522# the skin support sources
523#
524SKIN_SOURCES := rect.c \
525 region.c \
526 image.c \
527 trackball.c \
528 keyboard.c \
529 keyset.c \
530 file.c \
531 window.c \
532 scaler.c \
533 composer.c \
534 surface.c \
535
536LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
537#LOCAL_CFLAGS += -I$(LOCAL_PATH)/skin
538
539ifeq ($(HOST_ARCH),x86)
540# enable MMX code for our skin scaler
541LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
542endif
543
544# include other sources
545#
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700546VL_SOURCES := vl-android.c osdep.c cutils.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800547 block.c readline.c monitor.c console.c loader.c sockets.c \
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700548 aes.c d3des.c \
549 block/qcow.c \
550 block/qcow2.c \
551 block/qcow2-refcount.c \
552 block/qcow2-snapshot.c \
553 block/qcow2-cluster.c \
554 block/cloop.c \
555 block/dmg.c \
556 block/vvfat.c \
557 buffered_file.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800558 cbuffer.c \
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700559 gdbstub.c \
David 'Digit' Turner3266b512010-05-10 18:44:56 -0700560 ioport.c \
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700561 vnc-android.c disas.c arm-dis.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800562 shaper.c charpipe.c loadpng.c \
563 framebuffer.c \
564 tcpdump.c \
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700565 qemu-char-android.c \
566 qemu-malloc.c \
567 qemu-option.c \
568 savevm.c \
569 net-android.c \
570 acl.c \
571 aio-android.c \
572 dma-helpers.c \
573 qemu-sockets-android.c \
574 keymaps.c \
575 bt-host.c \
576 bt-vhci.c \
577 module.c \
David 'Digit' Turner2910f182010-05-10 18:48:35 -0700578 json-lexer.c \
579 json-parser.c \
580 json-streamer.c \
581 qbool.c \
582 qdict.c \
583 qfloat.c \
584 qint.c \
585 qjson.c \
586 qlist.c \
587 qstring.c \
David Turner9c0c5152009-06-02 12:30:47 -0700588 android/boot-properties.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800589 android/charmap.c \
590 android/cmdline-option.c \
591 android/config.c \
592 android/console.c \
593 android/gps.c \
594 android/help.c \
595 android/hw-control.c \
596 android/hw-events.c \
597 android/hw-kmsg.c \
David 'Digit' Turnerc5b12702009-06-19 00:36:12 +0200598 android/hw-lcd.c \
The Android Open Source Project9877e2e2009-03-18 17:39:44 -0700599 android/hw-qemud.c \
600 android/hw-sensors.c \
David 'Digit' Turner87250c22009-09-17 16:45:03 -0700601 android/keycode.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800602 android/main.c \
Vladimir Chtchetkine01193622010-05-11 13:07:22 -0700603 android/qemulator.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800604 android/resource.c \
605 android/user-config.c \
606 android/utils/bufprint.c \
607 android/utils/debug.c \
608 android/utils/dirscanner.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800609 android/utils/ini.c \
610 android/utils/filelock.c \
611 android/utils/misc.c \
612 android/utils/path.c \
613 android/utils/reflist.c \
614 android/utils/stralloc.c \
615 android/utils/system.c \
616 android/utils/tempfile.c \
617 android/utils/timezone.c \
Vladimir Chtchetkine8339d182010-03-25 10:57:29 -0700618 android/utils/mapfile.c \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800619 android/avd/hw-config.c \
620 android/avd/info.c \
621
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800622VL_SOURCES += hw/arm_boot.c \
623 hw/android_arm.c \
624
625ifeq ($(HOST_OS),windows)
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700626 VL_SOURCES += block/raw-win32.c \
627 migration-dummy-android.c \
628 iolooper-select.c
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800629else
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700630 VL_SOURCES += block/raw-posix.c \
631 migration.c \
632 migration-exec.c \
633 migration-tcp-android.c \
634 iolooper-select.c
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800635endif
636
637ifeq ($(HOST_OS),linux)
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700638 VL_SOURCES += usb-linux.c \
639 qemu-thread.c
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700640else
641 VL_SOURCES += usb-dummy-android.c
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800642endif
643
644ifeq ($(HOST_ARCH),x86)
645 VL_SOURCES += i386-dis.c
646endif
647ifeq ($(HOST_ARCH),x86_64)
648 VL_SOURCES += i386-dis.c
649endif
650ifeq ($(HOST_ARCH),ppc)
651 VL_SOURCES += ppc-dis.c
652endif
653
654ifeq ($(HOST_OS),windows)
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700655 VL_SOURCES += tap-win32.c
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800656 LOCAL_LDLIBS += -mno-cygwin -mwindows -mconsole
657endif
658
Alexey Tarasov43fbac12009-06-15 14:28:15 +1100659ifeq ($(HOST_OS),freebsd)
660 LOCAL_LDLIBS += -L/usr/local/lib -lpthread -lX11 -lutil
661endif
662
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800663LOCAL_SRC_FILES += $(VL_SOURCES)
664
665ifeq ($(HOST_OS),linux)
666 LOCAL_LDLIBS += -lutil -lrt
667endif
668
669# add SDL-specific flags
670#
671LOCAL_CFLAGS += $(SDL_CFLAGS)
672LOCAL_LDLIBS += $(SDL_LDLIBS)
Raphaelaea1b872010-04-14 12:16:28 -0700673# Circular dependencies between libSDL and libSDLmain;
674# We repeat the libraries in the final link to work around it.
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800675LOCAL_STATIC_LIBRARIES += libSDL libSDLmain
676LOCAL_STATIC_LIBRARIES += libSDL libSDLmain
677
Vladimir Chtchetkine5389aa12010-02-16 10:38:35 -0800678# add ELFF-specific flags
679#
680LOCAL_LDLIBS += $(ELFF_LDLIBS)
681
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800682# on Windows, link the icon file as well into the executable
683# unfortunately, our build system doesn't help us much, so we need
684# to use some weird pathnames to make this work...
685#
686ifeq ($(HOST_OS),windows)
Raphaelaea1b872010-04-14 12:16:28 -0700687
688# Locate windres executable
689WINDRES := windres
690ifneq ($(USE_MINGW),)
691 # When building the Windows emulator under Linux, use the MinGW one
692 WINDRES := i586-mingw32msvc-windres
693endif
694
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800695INTERMEDIATE := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
696ANDROID_ICON_OBJ := android_icon.o
697ANDROID_ICON_PATH := $(LOCAL_PATH)/images
698$(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc
Raphaelaea1b872010-04-14 12:16:28 -0700699 $(WINDRES) $< -I $(ANDROID_ICON_PATH) -o $@
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800700
701# seems to be the only way to add an object file that was not generated from
702# a C/C++/Java source file to our build system. and very unfortunately,
703# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces
704# us to put the object file in the source directory...
705#
706LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ)
707endif
708
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700709# qemu-options.h is generated from qemu-options.hx with the "hxtool" shell script
710#
711intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
712
713QEMU_OPTIONS_H := $(intermediates)/qemu-options.h
714$(QEMU_OPTIONS_H): PRIVATE_PATH := $(LOCAL_PATH)
715$(QEMU_OPTIONS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@
716$(QEMU_OPTIONS_H): $(LOCAL_PATH)/qemu-options.hx $(LOCAL_PATH)/hxtool
717 $(transform-generated-source)
718
719$(intermediates)/vl-android.o: $(QEMU_OPTIONS_H)
720
721LOCAL_GENERATED_SOURCES += $(QEMU_OPTIONS_H)
722
723# qemu-monitor.h is generated from qemu-monitor.hx with the "hxtool" shell script
724#
725intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
726
727QEMU_MONITOR_H := $(intermediates)/qemu-monitor.h
728$(QEMU_MONITOR_H): PRIVATE_PATH := $(LOCAL_PATH)
729$(QEMU_MONITOR_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@
730$(QEMU_MONITOR_H): $(LOCAL_PATH)/qemu-monitor.hx $(LOCAL_PATH)/hxtool
731 $(transform-generated-source)
732
733$(intermediates)/vl-android.o: $(QEMU_MONITOR_H)
734
735LOCAL_GENERATED_SOURCES += $(QEMU_MONITOR_H)
736
737
738# gdbstub-xml.c contains C-compilable arrays corresponding to the content
739# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
740#
741ifeq ($(QEMU_TARGET_XML_SOURCES),)
742 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
743 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
744endif
745
746QEMU_GDBSTUB_XML_C := $(intermediates)/gdbstub-xml.c
747$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
748$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
749$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
750$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
751 $(hide) rm -f $@
752 $(transform-generated-source)
753
754$(intermediates)/vl-android.o: $(QEMU_GDBSTUB_XML_C)
755
756LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
757
David 'Digit' Turner065242d2009-10-07 13:43:33 -0700758# hw-config-defs.h is generated from android/avd/hardware-properties.ini
759#
David 'Digit' Turner2ec45592009-10-07 14:48:19 -0700760QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini
David 'Digit' Turner065242d2009-10-07 13:43:33 -0700761QEMU_HW_CONFIG_DEFS_H := $(LOCAL_PATH)/android/avd/hw-config-defs.h
762$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH)
David 'Digit' Turner2ec45592009-10-07 14:48:19 -0700763$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_SOURCES := $(QEMU_HARDWARE_PROPERTIES_INI)
764$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $(QEMU_HARDWARE_PROPERTIES_INI) $@
765$(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 -0700766 $(hide) rm -f $@
767 $(transform-generated-source)
768
769$(LOCAL_PATH)/android/avd/hw-config.h: $(QEMU_HW_CONFIG_DEFS_H)
770
771LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H)
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700772
773# this is already done by the Android build system, but is done for the
774# benefit of the stand-alone one.
775#
776ifeq ($(BUILD_STANDALONE_EMULATOR),true)
777 LOCAL_CFLAGS += -I$(intermediates)
778endif
779
780
781
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800782# other flags
783LOCAL_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
Raphaelaea1b872010-04-14 12:16:28 -0700784LOCAL_LDLIBS += -lm
Vladimir Chtchetkine5389aa12010-02-16 10:38:35 -0800785
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800786ifeq ($(HOST_OS),windows)
787 LOCAL_LDLIBS += -lwinmm -lws2_32 -liphlpapi
Raphaelaea1b872010-04-14 12:16:28 -0700788else
789 LOCAL_LDLIBS += -lpthread
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800790endif
791
792LOCAL_LDLIBS += $(QEMU_AUDIO_LIB)
793
David 'Digit' Turnerab873b72010-03-08 18:33:50 -0800794# Generate a completely static executable if needed.
795# Note that this means no sound and graphics on Linux.
796#
797ifeq ($(CONFIG_STATIC_EXECUTABLE),true)
798 LOCAL_SRC_FILES += dynlink-static.c
799 LOCAL_LDLIBS += -static
800endif
801
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800802LOCAL_MODULE := emulator
803
804include $(BUILD_HOST_EXECUTABLE)
805
806endif # TARGET_ARCH == arm