blob: 558ecbfb713e6d7fec51e33c51b12cab538dce28 [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' Turner86b1fb02014-03-21 15:20:21 +010055 tcg/optimize.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010056 tcg/tcg.c \
Octavian Purdila9f9deaf2013-11-08 19:00:56 +020057 tcg-runtime.c \
David 'Digit' Turner86b1fb02014-03-21 15:20:21 +010058 util/bitops.c \
David 'Digit' Turnerdc781222014-03-07 16:53:45 +010059 util/host-utils.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010060
61##############################################################################
62# Emulated hardware devices.
63#
64
65HW_SOURCES := \
David 'Digit' Turner2ec695a2013-12-17 10:03:39 +010066 core/irq.c \
David 'Digit' Turner10745422013-12-17 10:05:40 +010067 core/qdev.c \
David 'Digit' Turner291300f2013-12-17 10:06:47 +010068 core/sysbus.c \
David 'Digit' Turnerf7c8d822013-12-17 14:02:11 +010069 core/dma.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +010070 android/goldfish/audio.c \
71 android/goldfish/device.c \
72 android/goldfish/events_device.c \
73 android/goldfish/fb.c \
74 android/goldfish/battery.c \
75 android/goldfish/mmc.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +010076 android/goldfish/nand.c \
77 android/goldfish/pipe.c \
78 android/goldfish/tty.c \
79 android/goldfish/vmem.c \
David 'Digit' Turner7977bd62013-12-17 11:17:24 +010080 pci/pci.c \
David 'Digit' Turnere2f74052013-12-17 11:29:40 +010081 watchdog/watchdog.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010082
David 'Digit' Turner42fc4492011-06-29 13:16:16 +020083
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010084ifeq ($(EMULATOR_TARGET_ARCH),arm)
David 'Digit' Turnerd1298762013-12-17 10:22:24 +010085HW_SOURCES += \
David 'Digit' Turnerea066692013-12-17 14:03:28 +010086 android/android_arm.c \
David 'Digit' Turnerd1298762013-12-17 10:22:24 +010087 arm/pic.c \
88 arm/boot.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +010089 android/goldfish/interrupt.c \
Vince Harron4c3a1e12014-06-25 22:42:36 -070090 android/goldfish/timer.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010091
92# The following sources must be compiled with the final executables
93# because they contain device_init() or machine_init() statements.
David 'Digit' Turnerebf1de02013-12-17 13:57:47 +010094HW_OBJ_SOURCES := hw/net/smc91c111.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010095HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
96
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +010097common_LOCAL_SRC_FILES += disas/arm.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010098
99# smc91c111.c requires <zlib.h>
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700100common_LOCAL_CFLAGS += $(ZLIB_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100101endif
102
David 'Digit' Turner764a3c92011-05-05 12:40:49 +0200103# required to ensure we properly initialize virtual audio hardware
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700104common_LOCAL_CFLAGS += -DHAS_AUDIO
David 'Digit' Turner764a3c92011-05-05 12:40:49 +0200105
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100106ifeq ($(EMULATOR_TARGET_ARCH),x86)
107HW_SOURCES += \
David 'Digit' Turner3fbb6562013-12-17 10:08:21 +0100108 intc/apic.c \
David 'Digit' Turner91335252013-12-17 13:52:01 +0100109 intc/i8259.c \
David 'Digit' Turner6d7b5292013-12-17 13:53:17 +0100110 timer/mc146818rtc.c \
David 'Digit' Turnerbfa4dab2013-12-17 11:19:22 +0100111 pci-host/piix.c \
David 'Digit' Turner6459c4a2013-12-17 10:31:05 +0100112 timer/i8254.c \
David 'Digit' Turner7b769262013-12-17 13:54:37 +0100113 input/pckbd.c \
David 'Digit' Turner1079fa72013-12-17 13:55:27 +0100114 intc/ioapic.c \
David 'Digit' Turner4ecc3dd2013-12-17 11:16:00 +0100115 input/ps2.c \
David 'Digit' Turner343e9282013-12-17 13:56:48 +0100116 i386/smbios.c \
David 'Digit' Turnera367a102013-12-17 11:36:33 +0100117 nvram/fw_cfg.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100118
119# The following sources must be compiled with the final executables
120# because they contain device_init() or machine_init() statements.
121HW_OBJ_SOURCES := \
David 'Digit' Turner08405982013-12-17 11:35:00 +0100122 hw/net/ne2000.c \
David 'Digit' Turnerbb228542013-12-17 13:53:59 +0100123 hw/i386/pc.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100124
125HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
126
127endif
128
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700129ifeq ($(EMULATOR_TARGET_ARCH),mips)
130HW_SOURCES += \
David 'Digit' Turnerea066692013-12-17 14:03:28 +0100131 android/android_mips.c \
David 'Digit' Turneraf0fc432013-12-17 14:00:52 +0100132 mips/mips_pic.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +0100133 android/goldfish/interrupt.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +0100134 android/goldfish/timer.c \
David 'Digit' Turneraf0fc432013-12-17 14:00:52 +0100135 mips/cputimer.c \
136 mips/mips_int.c
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700137
138# The following sources must be compiled with the final executables
139# because they contain device_init() or machine_init() statements.
David 'Digit' Turnerebf1de02013-12-17 13:57:47 +0100140HW_OBJ_SOURCES := hw/net/smc91c111.c
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700141HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
142
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100143common_LOCAL_SRC_FILES += disas/mips.c
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700144
145# smc91c111.c requires <zlib.h>
146LOCAL_CFLAGS += $(ZLIB_CFLAGS)
147ifeq ($(ARCH_HAS_BIGENDIAN),true)
148 LOCAL_CFLAGS += -DTARGET_WORDS_BIGENDIAN
149endif
150
151endif
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700152common_LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100153
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700154common_LOCAL_SRC_FILES += \
David 'Digit' Turner2a0488a2013-12-17 11:22:12 +0100155 backends/msmouse.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100156 cpu-exec.c \
David 'Digit' Turner3dc53fc2014-01-17 01:23:40 +0100157 cputlb.c \
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200158 exec.c \
David 'Digit' Turnerf9077a82014-02-10 23:10:47 +0100159 main-loop.c \
David 'Digit' Turnerfdec1f12014-03-21 11:49:03 +0100160 memory-android.c \
David 'Digit' Turneraa1180c2014-01-28 06:08:00 +0100161 monitor-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100162 translate-all.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100163
164##############################################################################
165# CPU-specific emulation.
166#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700167common_LOCAL_CFLAGS += -fno-PIC -fomit-frame-pointer -Wno-sign-compare
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100168
169ifeq ($(HOST_ARCH),ppc)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700170 common_LOCAL_CFLAGS += -D__powerpc__
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100171endif
172
173ifeq ($(EMULATOR_TARGET_ARCH),arm)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700174common_LOCAL_SRC_FILES += \
David 'Digit' Turner82a591c2013-12-17 09:10:58 +0100175 target-arm/arm-semi.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100176 target-arm/op_helper.c \
177 target-arm/iwmmxt_helper.c \
178 target-arm/neon_helper.c \
179 target-arm/helper.c \
David 'Digit' Turner288208c2011-05-11 19:37:35 +0200180 target-arm/helper-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100181 target-arm/translate.c \
182 target-arm/machine.c \
David 'Digit' Turnercd0c34b2013-12-17 10:19:44 +0100183 hw/arm/armv7m.c \
184 hw/arm/armv7m_nvic.c
David 'Digit' Turnere2288402014-01-09 18:35:14 +0100185endif # EMULATOR_TARGET_ARCH == arm
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100186
187ifeq ($(EMULATOR_TARGET_ARCH), x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700188common_LOCAL_SRC_FILES += \
David 'Digit' Turnerebb1b242014-04-07 14:47:57 +0200189 target-i386/cc_helper.c \
David 'Digit' Turner0c9bc162014-04-07 18:18:21 +0200190 target-i386/excp_helper.c \
David 'Digit' Turnerb9b1ef62014-04-07 18:24:43 +0200191 target-i386/fpu_helper.c \
David 'Digit' Turner47fcd072014-04-07 18:32:11 +0200192 target-i386/int_helper.c \
David 'Digit' Turnerc0a7e0d2014-04-07 18:35:13 +0200193 target-i386/mem_helper.c \
David 'Digit' Turner19385552014-04-07 18:53:50 +0200194 target-i386/misc_helper.c \
David 'Digit' Turner28f41822014-04-07 18:45:29 +0200195 target-i386/seg_helper.c \
David 'Digit' Turnerbacb7c92014-04-07 18:49:00 +0200196 target-i386/smm_helper.c \
David 'Digit' Turnerceb5a592014-04-07 18:50:36 +0200197 target-i386/svm_helper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100198 target-i386/helper.c \
199 target-i386/translate.c \
200 target-i386/machine.c \
201
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800202ifeq ($(HOST_OS),darwin)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700203common_LOCAL_SRC_FILES += \
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800204 target-i386/hax-all.c \
205 target-i386/hax-darwin.c
206endif
207
208ifeq ($(HOST_OS),windows)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700209common_LOCAL_SRC_FILES += \
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800210 target-i386/hax-all.c \
211 target-i386/hax-windows.c
212endif
David 'Digit' Turnere2288402014-01-09 18:35:14 +0100213endif # EMULATOR_TARGET_ARCH == x86
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100214
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700215ifeq ($(EMULATOR_TARGET_ARCH), mips)
216common_LOCAL_SRC_FILES += \
217 target-mips/op_helper.c \
218 target-mips/helper.c \
219 target-mips/translate.c \
220 target-mips/machine.c
David 'Digit' Turnere2288402014-01-09 18:35:14 +0100221endif # EMULATOR_TARGET_ARCH == mips
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700222
223common_LOCAL_SRC_FILES += fpu/softfloat.c
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700224
Jun Nakajima1321c762011-03-04 17:17:45 -0800225# compile KVM only if target is x86 on x86 Linux
David 'Digit' Turner36597752011-05-20 01:18:01 +0200226QEMU_KVM_TAG := $(QEMU_HOST_TAG)-$(EMULATOR_TARGET_ARCH)
227QEMU_DO_KVM := $(if $(filter linux-x86-x86 linux-x86_64-x86,$(QEMU_KVM_TAG)),true,false)
228ifeq ($(QEMU_DO_KVM),true)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700229 common_LOCAL_SRC_FILES += \
David 'Digit' Turner36597752011-05-20 01:18:01 +0200230 target-i386/kvm.c \
Jun Nakajimabb0140b2011-05-27 18:24:21 -0700231 target-i386/kvm-gs-restore.c \
David 'Digit' Turner36597752011-05-20 01:18:01 +0200232 kvm-all.c \
233 kvm-android.c
Jun Nakajima1321c762011-03-04 17:17:45 -0800234endif
235
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100236##############################################################################
237# Memory-access checking support.
238# Memory access checker uses information collected by instrumented code in
239# libc.so in order to keep track of memory blocks allocated from heap. Memory
240# checker then uses this information to make sure that every access to allocated
241# memory is within allocated block. This information also allows detecting
242# memory leaks and attempts to free/realloc invalid pointers.
243#
David 'Digit' Turnerf8f73752014-03-14 17:30:51 +0100244common_LOCAL_CFLAGS += $(ELFF_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100245
246MCHK_SOURCES := \
247 memcheck.c \
248 memcheck_proc_management.c \
249 memcheck_malloc_map.c \
250 memcheck_mmrange_map.c \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700251 memcheck_util.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100252
David 'Digit' Turner96e493a2014-03-14 17:17:26 +0100253common_LOCAL_SRC_FILES += $(MCHK_SOURCES:%=android/qemu/memcheck/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100254
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700255common_LOCAL_SRC_FILES += \
David 'Digit' Turnerae3098a2011-05-11 16:01:57 +0200256 cpus.c \
257 arch_init.c
258
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200259# What a mess, os-posix.c depends on the exact values of options
260# which are target specific.
261ifeq ($(HOST_OS),windows)
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100262 common_LOCAL_SRC_FILES += os-win32.c util/oslib-win32.c
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200263else
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100264 common_LOCAL_SRC_FILES += os-posix.c util/oslib-posix.c
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200265endif
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100266
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700267
268## one for 32-bit
269$(call start-emulator-library, emulator-target-$(EMULATOR_TARGET_CPU))
270LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
271LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
272$(call gen-hw-config-defs)
273$(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100274$(call end-emulator-library)
275
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200276$(call start-emulator64-library, emulator64-target-$(EMULATOR_TARGET_CPU))
277LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
278LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
279$(call gen-hw-config-defs)
280$(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c)
281$(call end-emulator-library)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700282
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100283##############################################################################
284##############################################################################
285###
286### emulator-$ARCH: Standalone emulator program
287###
288###
289
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700290common_LOCAL_LDLIBS =
291common_LOCAL_CFLAGS =
292common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100293
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700294
295common_LOCAL_STATIC_LIBRARIES := \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100296 emulator-libui \
297 emulator-libqemu \
298 emulator-target-$(EMULATOR_TARGET_CPU) \
299 emulator-libelff \
David 'Digit' Turner6ddf8732014-06-12 10:29:23 +0200300 emulator-common \
301 emulator-zlib
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100302
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700303common_LOCAL_LDLIBS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100304 $(EMULATOR_COMMON_LDLIBS) \
305 $(EMULATOR_LIBQEMU_LDLIBS) \
306 $(EMULATOR_LIBUI_LDLIBS) \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700307 $(ELFF_LDLIBS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100308
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700309common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100310 $(EMULATOR_TARGET_CFLAGS) \
311 $(EMULATOR_COMMON_CFLAGS) \
312 $(EMULATOR_LIBQEMU_CFLAGS) \
313 $(EMULATOR_LIBUI_CFLAGS)
314
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700315common_LOCAL_SRC_FILES := \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100316 audio/audio.c \
317 disas.c \
318 dma-helpers.c \
319 gdbstub.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100320 qemu-timer.c \
David 'Digit' Turnerf9077a82014-02-10 23:10:47 +0100321 log-rotate-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100322 vl-android.c \
323 android/cmdline-option.c \
324 android/console.c \
David 'Digit' Turner045bdbe2014-04-28 22:26:52 +0200325 android/cpu_accelerator.cpp \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100326 android/display.c \
327 android/display-core.c \
328 android/help.c \
329 android/main-common.c \
330 android/main.c \
David 'Digit' Turnercb88e792011-08-26 01:35:14 +0200331 android/opengles.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100332 android/protocol/core-commands-qemu.c \
333 android/protocol/ui-commands-qemu.c \
David 'Digit' Turnerd4e803c2013-12-14 23:45:50 +0100334 android/user-events-qemu.c \
David 'Digit' Turner70a98202013-12-17 09:30:04 +0100335 hw/core/loader.c \
David 'Digit' Turner852088c2013-12-14 23:04:12 +0100336 ui/keymaps.c \
David 'Digit' Turnera18ede02014-02-06 14:30:48 +0100337 util/qemu-timer-common.c \
David 'Digit' Turner1befd342014-01-15 17:56:45 +0100338 util/iov.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100339
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100340# The following files cannot be in static libraries because they contain
341# constructor functions that are otherwise stripped by the final linker
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700342common_LOCAL_SRC_FILES += $(HW_OBJ_SOURCES)
343common_LOCAL_CFLAGS += $(HW_OBJ_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100344
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700345common_LOCAL_SRC_FILES += $(BLOCK_SOURCES)
346common_LOCAL_CFLAGS += $(BLOCK_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100347
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100348# Generate a completely static executable if needed.
349# Note that this means no sound and graphics on Linux.
350#
Andrew Hsieh632a0e12012-04-28 00:48:53 +0800351ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),)
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100352 common_LOCAL_SRC_FILES += android/dynlink-static.c
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700353 common_LOCAL_LDLIBS += -static
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100354endif
355
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700356## one for 32-bit
357$(call start-emulator-program, emulator-$(EMULATOR_TARGET_ARCH))
358LOCAL_STATIC_LIBRARIES += \
359 emulator-libui \
360 emulator-libqemu \
361 emulator-target-$(EMULATOR_TARGET_CPU) \
Lars Poeschel33da99a2012-08-22 09:42:42 +0200362 emulator-libjpeg \
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700363 emulator-libelff \
364 emulator-common \
David 'Digit' Turnerdddfa642014-06-12 18:48:17 +0200365 emulator-libext4_utils \
366 emulator-libsparse \
367 emulator-libselinux \
David 'Digit' Turner6ddf8732014-06-12 10:29:23 +0200368 emulator-zlib \
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700369 $(SDL_STATIC_LIBRARIES)
David 'Digit' Turner6ddf8732014-06-12 10:29:23 +0200370
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700371LOCAL_LDLIBS += $(common_LOCAL_LDLIBS)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100372LOCAL_LDFLAGS += $(common_LOCAL_LDFLAGS)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700373LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
374LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700375$(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
376$(call gen-hw-config-defs)
Raphael Mollcdbea232012-05-04 15:04:27 -0700377
378ifeq ($(HOST_OS),windows)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100379 $(eval $(call insert-windows-icon))
380 ifneq ($(BUILD_STANDALONE_EMULATOR),)
381 # Special exception for Windows: -lmingw32 must appear before libSDLmain
382 # on the link command-line, because it depends on _WinMain@16 which is
383 # exported by the latter.
384 LOCAL_LDFLAGS += -lmingw32
385 else
386 # The previous trick doesn't work with the platform build system because
387 # it places all linker flags _after_ the actually libraries, so instead
388 # recompiler SDLmain from source so its object file is listed in the link
389 # command, forcing the linker to use it.
390 LOCAL_SRC_FILES += $(SDLMAIN_SOURCES:%=$(SDL_DIR)/%)
391 endif
Raphael Mollcdbea232012-05-04 15:04:27 -0700392endif
393
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100394$(call end-emulator-program)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700395
396
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200397$(call start-emulator64-program, emulator64-$(EMULATOR_TARGET_ARCH))
398LOCAL_STATIC_LIBRARIES += \
399 emulator64-libui \
400 emulator64-libqemu \
401 emulator64-target-$(EMULATOR_TARGET_CPU) \
402 emulator64-libjpeg \
403 emulator64-libelff \
404 emulator64-common \
David 'Digit' Turnerdddfa642014-06-12 18:48:17 +0200405 emulator64-libext4_utils \
406 emulator64-libsparse \
407 emulator64-libselinux \
David 'Digit' Turner6ddf8732014-06-12 10:29:23 +0200408 emulator64-zlib \
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200409 $(SDL_STATIC_LIBRARIES_64)
David 'Digit' Turner6ddf8732014-06-12 10:29:23 +0200410
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200411LOCAL_LDLIBS += $(common_LOCAL_LDLIBS)
412LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
413LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
414$(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)