blob: 48fbf6b8c12932e8103794f750d67b8caa559dcf [file] [log] [blame]
David 'Digit' Turneraff94b82011-02-07 18:10:54 +01001# This file is included several times to build target-specific
2# modules for the Android emulator. It will be called several times
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -07003# for arm, x86 and mips
David 'Digit' Turneraff94b82011-02-07 18:10:54 +01004#
5
6ifndef EMULATOR_TARGET_ARCH
7$(error EMULATOR_TARGET_ARCH is not defined!)
8endif
9
10EMULATOR_TARGET_CPU := $(EMULATOR_TARGET_ARCH)
11ifeq ($(EMULATOR_TARGET_CPU),x86)
12 EMULATOR_TARGET_CPU := i386
13endif
14
15##############################################################################
16##############################################################################
17###
18### emulator-target-$CPU: target-specific emulation code.
19###
20### Used by both the core and standalone programs.
21###
22
23# Common compiler flags for all target-dependent libraries
24EMULATOR_TARGET_CFLAGS := \
25 -I$(LOCAL_PATH)/android/config/$(HOST_PREBUILT_TAG) \
26 -I$(LOCAL_PATH)/android/config/target-$(EMULATOR_TARGET_ARCH) \
27 -I$(LOCAL_PATH)/target-$(EMULATOR_TARGET_CPU) \
28 -I$(LOCAL_PATH)/fpu \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -070029 -DNEED_CPU_H
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010030
31TCG_TARGET := $(HOST_ARCH)
David 'Digit' Turnerf1d9bf12011-05-11 18:19:41 +020032ifeq ($(HOST_ARCH),x86)
33 TCG_TARGET := i386
34endif
35ifeq ($(HOST_ARCH),x86_64)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010036 TCG_TARGET := i386
37endif
38
39EMULATOR_TARGET_CFLAGS += \
40 -I$(LOCAL_PATH)/tcg \
41 -I$(LOCAL_PATH)/tcg/$(TCG_TARGET) \
42 -DTARGET_ARCH=\"$(EMULATOR_TARGET_ARCH)\"
43
44
Andrew Hsiehc7389bd2012-03-13 02:13:40 -070045common_LOCAL_CFLAGS =
46common_LOCAL_SRC_FILES =
47
David 'Digit' Turner1d1a2af2014-01-10 16:17:40 +010048common_LOCAL_CFLAGS += -I$(GLIB_INCLUDE_DIR)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010049
50# The following is to ensure that "config.h" will map to a target-specific
51# configuration file header.
Andrew Hsiehc7389bd2012-03-13 02:13:40 -070052common_LOCAL_CFLAGS += $(EMULATOR_TARGET_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010053
Andrew Hsiehc7389bd2012-03-13 02:13:40 -070054common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010055 tcg/tcg.c \
Octavian Purdila9f9deaf2013-11-08 19:00:56 +020056 tcg-runtime.c \
David 'Digit' Turnerdc781222014-03-07 16:53:45 +010057 util/host-utils.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010058
59##############################################################################
60# Emulated hardware devices.
61#
62
63HW_SOURCES := \
David 'Digit' Turner4b6bb762013-12-17 10:26:45 +010064 bt/core.c \
65 bt/hci.c \
66 bt/hid.c \
67 bt/l2cap.c \
68 bt/sdp.c \
David 'Digit' Turner4023ec82013-12-17 11:35:40 +010069 block/cdrom.c \
David 'Digit' Turner2ec695a2013-12-17 10:03:39 +010070 core/irq.c \
David 'Digit' Turner10745422013-12-17 10:05:40 +010071 core/qdev.c \
David 'Digit' Turner291300f2013-12-17 10:06:47 +010072 core/sysbus.c \
David 'Digit' Turnerf7c8d822013-12-17 14:02:11 +010073 core/dma.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +010074 android/goldfish/audio.c \
75 android/goldfish/device.c \
76 android/goldfish/events_device.c \
77 android/goldfish/fb.c \
78 android/goldfish/battery.c \
79 android/goldfish/mmc.c \
80 android/goldfish/memlog.c \
81 android/goldfish/nand.c \
82 android/goldfish/pipe.c \
83 android/goldfish/tty.c \
84 android/goldfish/vmem.c \
David 'Digit' Turner7977bd62013-12-17 11:17:24 +010085 pci/pci.c \
David 'Digit' Turnerbe5c9712013-12-17 13:56:10 +010086 scsi/scsi-disk.c \
David 'Digit' Turner704463f2013-12-17 11:33:57 +010087 usb/dev-hid.c \
88 usb/dev-hub.c \
89 usb/dev-storage.c \
90 usb/hcd-ohci.c \
91 usb/core.c \
David 'Digit' Turnere2f74052013-12-17 11:29:40 +010092 watchdog/watchdog.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010093
David 'Digit' Turner42fc4492011-06-29 13:16:16 +020094
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010095ifeq ($(EMULATOR_TARGET_ARCH),arm)
David 'Digit' Turnerd1298762013-12-17 10:22:24 +010096HW_SOURCES += \
David 'Digit' Turnerea066692013-12-17 14:03:28 +010097 android/android_arm.c \
David 'Digit' Turnerd1298762013-12-17 10:22:24 +010098 arm/pic.c \
99 arm/boot.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +0100100 android/goldfish/interrupt.c \
101 android/goldfish/switch.c \
102 android/goldfish/timer.c \
103 android/goldfish/trace.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100104
105# The following sources must be compiled with the final executables
106# because they contain device_init() or machine_init() statements.
David 'Digit' Turnerebf1de02013-12-17 13:57:47 +0100107HW_OBJ_SOURCES := hw/net/smc91c111.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100108HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
109
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100110common_LOCAL_SRC_FILES += disas/arm.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100111
112# smc91c111.c requires <zlib.h>
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700113common_LOCAL_CFLAGS += $(ZLIB_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100114endif
115
David 'Digit' Turner764a3c92011-05-05 12:40:49 +0200116# required to ensure we properly initialize virtual audio hardware
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700117common_LOCAL_CFLAGS += -DHAS_AUDIO
David 'Digit' Turner764a3c92011-05-05 12:40:49 +0200118
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100119ifeq ($(EMULATOR_TARGET_ARCH),x86)
120HW_SOURCES += \
David 'Digit' Turner3fbb6562013-12-17 10:08:21 +0100121 intc/apic.c \
David 'Digit' Turner91335252013-12-17 13:52:01 +0100122 intc/i8259.c \
David 'Digit' Turner6d7b5292013-12-17 13:53:17 +0100123 timer/mc146818rtc.c \
David 'Digit' Turnerbfa4dab2013-12-17 11:19:22 +0100124 pci-host/piix.c \
David 'Digit' Turner6459c4a2013-12-17 10:31:05 +0100125 timer/i8254.c \
David 'Digit' Turner7b769262013-12-17 13:54:37 +0100126 input/pckbd.c \
David 'Digit' Turner1079fa72013-12-17 13:55:27 +0100127 intc/ioapic.c \
David 'Digit' Turner4ecc3dd2013-12-17 11:16:00 +0100128 input/ps2.c \
David 'Digit' Turner343e9282013-12-17 13:56:48 +0100129 i386/smbios.c \
David 'Digit' Turnera367a102013-12-17 11:36:33 +0100130 nvram/fw_cfg.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100131
132# The following sources must be compiled with the final executables
133# because they contain device_init() or machine_init() statements.
134HW_OBJ_SOURCES := \
David 'Digit' Turner08405982013-12-17 11:35:00 +0100135 hw/net/ne2000.c \
David 'Digit' Turnerbb228542013-12-17 13:53:59 +0100136 hw/i386/pc.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100137
138HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
139
140endif
141
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700142ifeq ($(EMULATOR_TARGET_ARCH),mips)
143HW_SOURCES += \
David 'Digit' Turnerea066692013-12-17 14:03:28 +0100144 android/android_mips.c \
David 'Digit' Turneraf0fc432013-12-17 14:00:52 +0100145 mips/mips_pic.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +0100146 android/goldfish/interrupt.c \
147 android/goldfish/switch.c \
148 android/goldfish/timer.c \
149 android/goldfish/trace.c \
David 'Digit' Turneraf0fc432013-12-17 14:00:52 +0100150 mips/cputimer.c \
151 mips/mips_int.c
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700152
153# The following sources must be compiled with the final executables
154# because they contain device_init() or machine_init() statements.
David 'Digit' Turnerebf1de02013-12-17 13:57:47 +0100155HW_OBJ_SOURCES := hw/net/smc91c111.c
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700156HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
157
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100158common_LOCAL_SRC_FILES += disas/mips.c
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700159
160# smc91c111.c requires <zlib.h>
161LOCAL_CFLAGS += $(ZLIB_CFLAGS)
162ifeq ($(ARCH_HAS_BIGENDIAN),true)
163 LOCAL_CFLAGS += -DTARGET_WORDS_BIGENDIAN
164endif
165
166endif
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700167common_LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100168
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700169common_LOCAL_SRC_FILES += \
David 'Digit' Turner2a0488a2013-12-17 11:22:12 +0100170 backends/msmouse.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100171 cpu-exec.c \
David 'Digit' Turner3dc53fc2014-01-17 01:23:40 +0100172 cputlb.c \
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200173 exec.c \
David 'Digit' Turnerf9077a82014-02-10 23:10:47 +0100174 main-loop.c \
David 'Digit' Turnerfdec1f12014-03-21 11:49:03 +0100175 memory-android.c \
David 'Digit' Turneraa1180c2014-01-28 06:08:00 +0100176 monitor-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100177 translate-all.c \
David 'Digit' Turner13209b92013-12-17 09:54:09 +0100178 android/varint.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100179
180##############################################################################
181# CPU-specific emulation.
182#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700183common_LOCAL_CFLAGS += -fno-PIC -fomit-frame-pointer -Wno-sign-compare
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100184
185ifeq ($(HOST_ARCH),ppc)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700186 common_LOCAL_CFLAGS += -D__powerpc__
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100187endif
188
189ifeq ($(EMULATOR_TARGET_ARCH),arm)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700190common_LOCAL_SRC_FILES += \
David 'Digit' Turner82a591c2013-12-17 09:10:58 +0100191 target-arm/arm-semi.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100192 target-arm/op_helper.c \
193 target-arm/iwmmxt_helper.c \
194 target-arm/neon_helper.c \
195 target-arm/helper.c \
David 'Digit' Turner288208c2011-05-11 19:37:35 +0200196 target-arm/helper-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100197 target-arm/translate.c \
198 target-arm/machine.c \
David 'Digit' Turnercd0c34b2013-12-17 10:19:44 +0100199 hw/arm/armv7m.c \
200 hw/arm/armv7m_nvic.c
David 'Digit' Turnere2288402014-01-09 18:35:14 +0100201endif # EMULATOR_TARGET_ARCH == arm
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100202
203ifeq ($(EMULATOR_TARGET_ARCH), x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700204common_LOCAL_SRC_FILES += \
David 'Digit' Turnerebb1b242014-04-07 14:47:57 +0200205 target-i386/cc_helper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100206 target-i386/op_helper.c \
207 target-i386/helper.c \
208 target-i386/translate.c \
209 target-i386/machine.c \
210
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800211ifeq ($(HOST_OS),darwin)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700212common_LOCAL_SRC_FILES += \
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800213 target-i386/hax-all.c \
214 target-i386/hax-darwin.c
215endif
216
217ifeq ($(HOST_OS),windows)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700218common_LOCAL_SRC_FILES += \
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800219 target-i386/hax-all.c \
220 target-i386/hax-windows.c
221endif
David 'Digit' Turnere2288402014-01-09 18:35:14 +0100222endif # EMULATOR_TARGET_ARCH == x86
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100223
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700224ifeq ($(EMULATOR_TARGET_ARCH), mips)
225common_LOCAL_SRC_FILES += \
226 target-mips/op_helper.c \
227 target-mips/helper.c \
228 target-mips/translate.c \
229 target-mips/machine.c
David 'Digit' Turnere2288402014-01-09 18:35:14 +0100230endif # EMULATOR_TARGET_ARCH == mips
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700231
232common_LOCAL_SRC_FILES += fpu/softfloat.c
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700233
Jun Nakajima1321c762011-03-04 17:17:45 -0800234# compile KVM only if target is x86 on x86 Linux
David 'Digit' Turner36597752011-05-20 01:18:01 +0200235QEMU_KVM_TAG := $(QEMU_HOST_TAG)-$(EMULATOR_TARGET_ARCH)
236QEMU_DO_KVM := $(if $(filter linux-x86-x86 linux-x86_64-x86,$(QEMU_KVM_TAG)),true,false)
237ifeq ($(QEMU_DO_KVM),true)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700238 common_LOCAL_SRC_FILES += \
David 'Digit' Turner36597752011-05-20 01:18:01 +0200239 target-i386/kvm.c \
Jun Nakajimabb0140b2011-05-27 18:24:21 -0700240 target-i386/kvm-gs-restore.c \
David 'Digit' Turner36597752011-05-20 01:18:01 +0200241 kvm-all.c \
242 kvm-android.c
Jun Nakajima1321c762011-03-04 17:17:45 -0800243endif
244
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100245##############################################################################
246# Memory-access checking support.
247# Memory access checker uses information collected by instrumented code in
248# libc.so in order to keep track of memory blocks allocated from heap. Memory
249# checker then uses this information to make sure that every access to allocated
250# memory is within allocated block. This information also allows detecting
251# memory leaks and attempts to free/realloc invalid pointers.
252#
David 'Digit' Turnerf8f73752014-03-14 17:30:51 +0100253common_LOCAL_CFLAGS += $(ELFF_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100254
255MCHK_SOURCES := \
256 memcheck.c \
257 memcheck_proc_management.c \
258 memcheck_malloc_map.c \
259 memcheck_mmrange_map.c \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700260 memcheck_util.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100261
David 'Digit' Turner96e493a2014-03-14 17:17:26 +0100262common_LOCAL_SRC_FILES += $(MCHK_SOURCES:%=android/qemu/memcheck/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100263
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700264common_LOCAL_SRC_FILES += \
David 'Digit' Turnerae3098a2011-05-11 16:01:57 +0200265 cpus.c \
266 arch_init.c
267
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200268# What a mess, os-posix.c depends on the exact values of options
269# which are target specific.
270ifeq ($(HOST_OS),windows)
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100271 common_LOCAL_SRC_FILES += os-win32.c util/oslib-win32.c
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200272else
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100273 common_LOCAL_SRC_FILES += os-posix.c util/oslib-posix.c
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200274endif
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100275
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700276
277## one for 32-bit
278$(call start-emulator-library, emulator-target-$(EMULATOR_TARGET_CPU))
279LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
280LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
281$(call gen-hw-config-defs)
282$(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100283$(call end-emulator-library)
284
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100285ifdef EMULATOR_BUILD_64BITS
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100286 $(call start-emulator-library, emulator64-target-$(EMULATOR_TARGET_CPU))
287 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
288 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
289 $(call gen-hw-config-defs)
290 $(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c)
291 $(call end-emulator-library)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100292endif # EMULATOR_BUILD_64BITS
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700293
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100294##############################################################################
295##############################################################################
296###
297### emulator-$ARCH: Standalone emulator program
298###
299###
300
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700301common_LOCAL_LDLIBS =
302common_LOCAL_CFLAGS =
303common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100304
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700305
306common_LOCAL_STATIC_LIBRARIES := \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100307 emulator-libui \
308 emulator-libqemu \
309 emulator-target-$(EMULATOR_TARGET_CPU) \
310 emulator-libelff \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700311 emulator-common
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100312
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700313common_LOCAL_LDLIBS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100314 $(EMULATOR_COMMON_LDLIBS) \
315 $(EMULATOR_LIBQEMU_LDLIBS) \
316 $(EMULATOR_LIBUI_LDLIBS) \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700317 $(ELFF_LDLIBS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100318
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700319common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100320 $(EMULATOR_TARGET_CFLAGS) \
321 $(EMULATOR_COMMON_CFLAGS) \
322 $(EMULATOR_LIBQEMU_CFLAGS) \
323 $(EMULATOR_LIBUI_CFLAGS)
324
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700325common_LOCAL_SRC_FILES := \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100326 audio/audio.c \
327 disas.c \
328 dma-helpers.c \
329 gdbstub.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100330 qemu-timer.c \
David 'Digit' Turnerf9077a82014-02-10 23:10:47 +0100331 log-rotate-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100332 vl-android.c \
333 android/cmdline-option.c \
334 android/console.c \
335 android/display.c \
336 android/display-core.c \
337 android/help.c \
338 android/main-common.c \
339 android/main.c \
David 'Digit' Turnercb88e792011-08-26 01:35:14 +0200340 android/opengles.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100341 android/protocol/core-commands-qemu.c \
342 android/protocol/ui-commands-qemu.c \
David 'Digit' Turnerd4e803c2013-12-14 23:45:50 +0100343 android/user-events-qemu.c \
David 'Digit' Turner70a98202013-12-17 09:30:04 +0100344 hw/core/loader.c \
David 'Digit' Turner852088c2013-12-14 23:04:12 +0100345 ui/keymaps.c \
David 'Digit' Turnera18ede02014-02-06 14:30:48 +0100346 util/qemu-timer-common.c \
David 'Digit' Turner1befd342014-01-15 17:56:45 +0100347 util/iov.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100348
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100349# The following files cannot be in static libraries because they contain
350# constructor functions that are otherwise stripped by the final linker
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700351common_LOCAL_SRC_FILES += $(HW_OBJ_SOURCES)
352common_LOCAL_CFLAGS += $(HW_OBJ_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100353
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700354common_LOCAL_SRC_FILES += $(BLOCK_SOURCES)
355common_LOCAL_CFLAGS += $(BLOCK_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100356
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100357# Generate a completely static executable if needed.
358# Note that this means no sound and graphics on Linux.
359#
Andrew Hsieh632a0e12012-04-28 00:48:53 +0800360ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),)
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100361 common_LOCAL_SRC_FILES += android/dynlink-static.c
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700362 common_LOCAL_LDLIBS += -static
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100363endif
364
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700365## one for 32-bit
366$(call start-emulator-program, emulator-$(EMULATOR_TARGET_ARCH))
367LOCAL_STATIC_LIBRARIES += \
368 emulator-libui \
369 emulator-libqemu \
370 emulator-target-$(EMULATOR_TARGET_CPU) \
Lars Poeschel33da99a2012-08-22 09:42:42 +0200371 emulator-libjpeg \
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700372 emulator-libelff \
373 emulator-common \
374 $(SDL_STATIC_LIBRARIES)
375LOCAL_LDLIBS += $(common_LOCAL_LDLIBS)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100376LOCAL_LDFLAGS += $(common_LOCAL_LDFLAGS)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700377LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
378LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700379$(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
380$(call gen-hw-config-defs)
Raphael Mollcdbea232012-05-04 15:04:27 -0700381
382ifeq ($(HOST_OS),windows)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100383 $(eval $(call insert-windows-icon))
384 ifneq ($(BUILD_STANDALONE_EMULATOR),)
385 # Special exception for Windows: -lmingw32 must appear before libSDLmain
386 # on the link command-line, because it depends on _WinMain@16 which is
387 # exported by the latter.
388 LOCAL_LDFLAGS += -lmingw32
389 else
390 # The previous trick doesn't work with the platform build system because
391 # it places all linker flags _after_ the actually libraries, so instead
392 # recompiler SDLmain from source so its object file is listed in the link
393 # command, forcing the linker to use it.
394 LOCAL_SRC_FILES += $(SDLMAIN_SOURCES:%=$(SDL_DIR)/%)
395 endif
Raphael Mollcdbea232012-05-04 15:04:27 -0700396endif
397
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100398$(call end-emulator-program)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700399
400
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100401ifdef EMULATOR_BUILD_64BITS
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100402 $(call start-emulator-program, emulator64-$(EMULATOR_TARGET_ARCH))
403 LOCAL_STATIC_LIBRARIES += \
404 emulator64-libui \
405 emulator64-libqemu \
406 emulator64-target-$(EMULATOR_TARGET_CPU) \
407 emulator64-libjpeg \
408 emulator64-libelff \
409 emulator64-common \
410 $(SDL_STATIC_LIBRARIES_64)
411 LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) -m64
412 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
413 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100414 $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
415 $(call gen-hw-config-defs)
416 $(call end-emulator-program)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100417endif # EMULATOR_BUILD_64BITS
Raphael Mollcdbea232012-05-04 15:04:27 -0700418