blob: d34f8e55a9f89036312e41859d1584e36ccbc62e [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' Turneraff94b82011-02-07 18:10:54 +010048
49# The following is to ensure that "config.h" will map to a target-specific
50# configuration file header.
Andrew Hsiehc7389bd2012-03-13 02:13:40 -070051common_LOCAL_CFLAGS += $(EMULATOR_TARGET_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010052
Andrew Hsiehc7389bd2012-03-13 02:13:40 -070053common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010054 tcg/tcg.c \
55
56##############################################################################
57# Emulated hardware devices.
58#
59
60HW_SOURCES := \
David 'Digit' Turner4b6bb762013-12-17 10:26:45 +010061 bt/core.c \
62 bt/hci.c \
63 bt/hid.c \
64 bt/l2cap.c \
65 bt/sdp.c \
David 'Digit' Turner4023ec82013-12-17 11:35:40 +010066 block/cdrom.c \
David 'Digit' Turner2ec695a2013-12-17 10:03:39 +010067 core/irq.c \
David 'Digit' Turner10745422013-12-17 10:05:40 +010068 core/qdev.c \
David 'Digit' Turner291300f2013-12-17 10:06:47 +010069 core/sysbus.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010070 dma.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +010071 android/goldfish/audio.c \
72 android/goldfish/device.c \
73 android/goldfish/events_device.c \
74 android/goldfish/fb.c \
75 android/goldfish/battery.c \
76 android/goldfish/mmc.c \
77 android/goldfish/memlog.c \
78 android/goldfish/nand.c \
79 android/goldfish/pipe.c \
80 android/goldfish/tty.c \
81 android/goldfish/vmem.c \
David 'Digit' Turner7977bd62013-12-17 11:17:24 +010082 pci/pci.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010083 scsi-disk.c \
David 'Digit' Turner704463f2013-12-17 11:33:57 +010084 usb/dev-hid.c \
85 usb/dev-hub.c \
86 usb/dev-storage.c \
87 usb/hcd-ohci.c \
88 usb/core.c \
David 'Digit' Turnere2f74052013-12-17 11:29:40 +010089 watchdog/watchdog.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010090
David 'Digit' Turner42fc4492011-06-29 13:16:16 +020091
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010092ifeq ($(EMULATOR_TARGET_ARCH),arm)
David 'Digit' Turnerd1298762013-12-17 10:22:24 +010093HW_SOURCES += \
94 android_arm.c \
95 arm/pic.c \
96 arm/boot.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +010097 android/goldfish/interrupt.c \
98 android/goldfish/switch.c \
99 android/goldfish/timer.c \
100 android/goldfish/trace.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100101
102# The following sources must be compiled with the final executables
103# because they contain device_init() or machine_init() statements.
104HW_OBJ_SOURCES := hw/smc91c111.c
105HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
106
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100107common_LOCAL_SRC_FILES += disas/arm.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100108
109# smc91c111.c requires <zlib.h>
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700110common_LOCAL_CFLAGS += $(ZLIB_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100111endif
112
David 'Digit' Turner764a3c92011-05-05 12:40:49 +0200113# required to ensure we properly initialize virtual audio hardware
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700114common_LOCAL_CFLAGS += -DHAS_AUDIO
David 'Digit' Turner764a3c92011-05-05 12:40:49 +0200115
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100116ifeq ($(EMULATOR_TARGET_ARCH),x86)
117HW_SOURCES += \
David 'Digit' Turner3fbb6562013-12-17 10:08:21 +0100118 intc/apic.c \
David 'Digit' Turner91335252013-12-17 13:52:01 +0100119 intc/i8259.c \
David 'Digit' Turner6d7b5292013-12-17 13:53:17 +0100120 timer/mc146818rtc.c \
David 'Digit' Turnerbfa4dab2013-12-17 11:19:22 +0100121 pci-host/piix.c \
David 'Digit' Turner6459c4a2013-12-17 10:31:05 +0100122 timer/i8254.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100123 pckbd.c \
124 ioapic.c \
David 'Digit' Turner4ecc3dd2013-12-17 11:16:00 +0100125 input/ps2.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100126 smbios.c \
David 'Digit' Turnera367a102013-12-17 11:36:33 +0100127 nvram/fw_cfg.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100128
129# The following sources must be compiled with the final executables
130# because they contain device_init() or machine_init() statements.
131HW_OBJ_SOURCES := \
David 'Digit' Turner08405982013-12-17 11:35:00 +0100132 hw/net/ne2000.c \
David 'Digit' Turnerbb228542013-12-17 13:53:59 +0100133 hw/i386/pc.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100134
135HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
136
137endif
138
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700139ifeq ($(EMULATOR_TARGET_ARCH),mips)
140HW_SOURCES += \
141 android_mips.c \
142 mips_pic.c \
David 'Digit' Turnerf0665422013-12-17 10:47:09 +0100143 android/goldfish/interrupt.c \
144 android/goldfish/switch.c \
145 android/goldfish/timer.c \
146 android/goldfish/trace.c \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700147 mips_timer.c \
148 mips_int.c
149
150# The following sources must be compiled with the final executables
151# because they contain device_init() or machine_init() statements.
152HW_OBJ_SOURCES := hw/smc91c111.c
153HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
154
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100155common_LOCAL_SRC_FILES += disas/mips.c
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700156
157# smc91c111.c requires <zlib.h>
158LOCAL_CFLAGS += $(ZLIB_CFLAGS)
159ifeq ($(ARCH_HAS_BIGENDIAN),true)
160 LOCAL_CFLAGS += -DTARGET_WORDS_BIGENDIAN
161endif
162
163endif
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700164common_LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100165
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700166common_LOCAL_SRC_FILES += \
David 'Digit' Turner2a0488a2013-12-17 11:22:12 +0100167 backends/msmouse.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100168 cpu-exec.c \
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200169 exec.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100170 translate-all.c \
David 'Digit' Turnerd4e803c2013-12-14 23:45:50 +0100171 android/trace.c \
David 'Digit' Turner13209b92013-12-17 09:54:09 +0100172 android/varint.c \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700173 softmmu_outside_jit.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100174
175##############################################################################
176# CPU-specific emulation.
177#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700178common_LOCAL_CFLAGS += -fno-PIC -fomit-frame-pointer -Wno-sign-compare
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100179
180ifeq ($(HOST_ARCH),ppc)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700181 common_LOCAL_CFLAGS += -D__powerpc__
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100182endif
183
184ifeq ($(EMULATOR_TARGET_ARCH),arm)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700185common_LOCAL_SRC_FILES += \
David 'Digit' Turner82a591c2013-12-17 09:10:58 +0100186 target-arm/arm-semi.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100187 target-arm/op_helper.c \
188 target-arm/iwmmxt_helper.c \
189 target-arm/neon_helper.c \
190 target-arm/helper.c \
David 'Digit' Turner288208c2011-05-11 19:37:35 +0200191 target-arm/helper-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100192 target-arm/translate.c \
193 target-arm/machine.c \
David 'Digit' Turnercd0c34b2013-12-17 10:19:44 +0100194 hw/arm/armv7m.c \
195 hw/arm/armv7m_nvic.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100196
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700197common_LOCAL_SRC_FILES += fpu/softfloat.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100198endif
199
200ifeq ($(EMULATOR_TARGET_ARCH), x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700201common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100202 target-i386/op_helper.c \
203 target-i386/helper.c \
204 target-i386/translate.c \
205 target-i386/machine.c \
206
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800207ifeq ($(HOST_OS),darwin)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700208common_LOCAL_SRC_FILES += \
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800209 target-i386/hax-all.c \
210 target-i386/hax-darwin.c
211endif
212
213ifeq ($(HOST_OS),windows)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700214common_LOCAL_SRC_FILES += \
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800215 target-i386/hax-all.c \
216 target-i386/hax-windows.c
217endif
218
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700219common_LOCAL_SRC_FILES += fpu/softfloat-native.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100220endif
221
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700222ifeq ($(EMULATOR_TARGET_ARCH), mips)
223common_LOCAL_SRC_FILES += \
224 target-mips/op_helper.c \
225 target-mips/helper.c \
226 target-mips/translate.c \
227 target-mips/machine.c
228
229common_LOCAL_SRC_FILES += fpu/softfloat.c
230endif
231
Jun Nakajima1321c762011-03-04 17:17:45 -0800232# compile KVM only if target is x86 on x86 Linux
David 'Digit' Turner36597752011-05-20 01:18:01 +0200233QEMU_KVM_TAG := $(QEMU_HOST_TAG)-$(EMULATOR_TARGET_ARCH)
234QEMU_DO_KVM := $(if $(filter linux-x86-x86 linux-x86_64-x86,$(QEMU_KVM_TAG)),true,false)
235ifeq ($(QEMU_DO_KVM),true)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700236 common_LOCAL_SRC_FILES += \
David 'Digit' Turner36597752011-05-20 01:18:01 +0200237 target-i386/kvm.c \
Jun Nakajimabb0140b2011-05-27 18:24:21 -0700238 target-i386/kvm-gs-restore.c \
David 'Digit' Turner36597752011-05-20 01:18:01 +0200239 kvm-all.c \
240 kvm-android.c
Jun Nakajima1321c762011-03-04 17:17:45 -0800241endif
242
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100243##############################################################################
244# Memory-access checking support.
245# Memory access checker uses information collected by instrumented code in
246# libc.so in order to keep track of memory blocks allocated from heap. Memory
247# checker then uses this information to make sure that every access to allocated
248# memory is within allocated block. This information also allows detecting
249# memory leaks and attempts to free/realloc invalid pointers.
250#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700251common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100252 -I$(LOCAL_PATH)/memcheck \
253 -I$(LOCAL_PATH)/elff
254
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
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700262common_LOCAL_SRC_FILES += $(MCHK_SOURCES:%=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
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700285## another for 64-bit, see note in file Makefile.common emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700286ifneq ($(filter linux darwin,$(HOST_OS)),)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700287 ifneq ($(BUILD_STANDALONE_EMULATOR),true)
288 $(call start-emulator-library, emulator64-target-$(EMULATOR_TARGET_CPU))
289 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
290 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
291 $(call gen-hw-config-defs)
292 $(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c)
293 $(call end-emulator-library)
294 endif # BUILD_STANDALONE_EMULATOR == nil
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700295endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700296
297
298
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100299##############################################################################
300##############################################################################
301###
302### qemu-android-$CPU: headless emulator core program
303###
304###
305$(call start-emulator-program, qemu-android-$(EMULATOR_TARGET_ARCH))
306
307LOCAL_CFLAGS += \
308 $(EMULATOR_COMMON_CFLAGS) \
309 $(ELFF_CFLAGS) \
310 $(EMULATOR_LIBQEMU_CFLAGS) \
311 $(EMULATOR_TARGET_CFLAGS) \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700312 -DCONFIG_STANDALONE_CORE
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100313
Jesse Hall183e9272012-04-26 15:13:27 -0700314ifneq ($(QEMU_OPENGLES_INCLUDE),)
315 LOCAL_CFLAGS += -I$(QEMU_OPENGLES_INCLUDE)
316endif
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100317
Raphael Moll9e319a92012-11-28 13:48:25 -0800318LOCAL_CFLAGS += $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100319
320LOCAL_STATIC_LIBRARIES := \
321 emulator-libqemu \
322 emulator-target-$(EMULATOR_TARGET_CPU) \
Lars Poeschel33da99a2012-08-22 09:42:42 +0200323 emulator-libjpeg \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100324 emulator-libelff \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700325 emulator-common
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100326
327LOCAL_LDLIBS += \
328 $(EMULATOR_COMMON_LDLIBS) \
329 $(EMULATOR_LIBQEMU_LDLIBS) \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700330 $(ELFF_LDLIBS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100331
332LOCAL_SRC_FILES := \
333 audio/audio.c \
334 disas.c \
335 dma-helpers.c \
336 gdbstub.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100337 monitor.c \
338 qemu-timer.c \
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200339 qemu-timer-common.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100340 vl-android.c \
341 android/console.c \
David 'Digit' Turnercb88e792011-08-26 01:35:14 +0200342 android/opengles.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100343 android/display-core.c \
344 android/protocol/attach-ui-proxy.c \
345 android/protocol/fb-updates-proxy.c \
346 android/protocol/user-events-impl.c \
347 android/protocol/ui-commands-proxy.c \
348 android/protocol/core-commands-impl.c \
David 'Digit' Turner852088c2013-12-14 23:04:12 +0100349 android/protocol/core-commands-qemu.c \
David 'Digit' Turnerd4e803c2013-12-14 23:45:50 +0100350 android/user-events-qemu.c \
David 'Digit' Turner70a98202013-12-17 09:30:04 +0100351 hw/core/loader.c \
David 'Digit' Turner852088c2013-12-14 23:04:12 +0100352 ui/keymaps.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100353
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200354$(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200355$(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200356$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100357
358ifeq ($(HOST_OS),darwin)
359 FRAMEWORKS := OpenGL Cocoa QuickTime ApplicationServices Carbon IOKit
360 LOCAL_LDLIBS += $(FRAMEWORKS:%=-Wl,-framework,%)
361endif
362
363# Generate a completely static executable if needed.
364# Note that this means no sound and graphics on Linux.
365#
Andrew Hsieh632a0e12012-04-28 00:48:53 +0800366ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),)
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100367 LOCAL_SRC_FILES += android/dynlink-static.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100368 LOCAL_LDLIBS += -static
369endif
370
371# The following files cannot be in static libraries because they contain
372# constructor functions that are otherwise stripped by the final linker
373LOCAL_SRC_FILES += $(HW_OBJ_SOURCES)
374LOCAL_CFLAGS += $(HW_OBJ_CFLAGS)
375
376LOCAL_SRC_FILES += $(BLOCK_SOURCES)
377LOCAL_CFLAGS += $(BLOCK_CFLAGS)
378
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100379$(call end-emulator-program)
380
381##############################################################################
382##############################################################################
383###
384### emulator-$ARCH: Standalone emulator program
385###
386###
387
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700388common_LOCAL_LDLIBS =
389common_LOCAL_CFLAGS =
390common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100391
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700392
393common_LOCAL_STATIC_LIBRARIES := \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100394 emulator-libui \
395 emulator-libqemu \
396 emulator-target-$(EMULATOR_TARGET_CPU) \
397 emulator-libelff \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700398 emulator-common
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100399
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700400common_LOCAL_LDLIBS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100401 $(EMULATOR_COMMON_LDLIBS) \
402 $(EMULATOR_LIBQEMU_LDLIBS) \
403 $(EMULATOR_LIBUI_LDLIBS) \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700404 $(ELFF_LDLIBS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100405
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700406common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100407 $(EMULATOR_TARGET_CFLAGS) \
408 $(EMULATOR_COMMON_CFLAGS) \
409 $(EMULATOR_LIBQEMU_CFLAGS) \
410 $(EMULATOR_LIBUI_CFLAGS)
411
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700412common_LOCAL_SRC_FILES := \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100413 audio/audio.c \
414 disas.c \
415 dma-helpers.c \
416 gdbstub.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100417 monitor.c \
418 qemu-timer.c \
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200419 qemu-timer-common.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100420 vl-android.c \
421 android/cmdline-option.c \
422 android/console.c \
423 android/display.c \
424 android/display-core.c \
425 android/help.c \
426 android/main-common.c \
427 android/main.c \
David 'Digit' Turnercb88e792011-08-26 01:35:14 +0200428 android/opengles.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100429 android/protocol/core-commands-qemu.c \
430 android/protocol/ui-commands-qemu.c \
David 'Digit' Turnerd4e803c2013-12-14 23:45:50 +0100431 android/user-events-qemu.c \
David 'Digit' Turner70a98202013-12-17 09:30:04 +0100432 hw/core/loader.c \
David 'Digit' Turner852088c2013-12-14 23:04:12 +0100433 ui/keymaps.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100434
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100435
436# The following files cannot be in static libraries because they contain
437# constructor functions that are otherwise stripped by the final linker
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700438common_LOCAL_SRC_FILES += $(HW_OBJ_SOURCES)
439common_LOCAL_CFLAGS += $(HW_OBJ_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100440
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700441common_LOCAL_SRC_FILES += $(BLOCK_SOURCES)
442common_LOCAL_CFLAGS += $(BLOCK_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100443
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700444common_LOCAL_SRC_FILES += $(SDLMAIN_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100445
446# Generate a completely static executable if needed.
447# Note that this means no sound and graphics on Linux.
448#
Andrew Hsieh632a0e12012-04-28 00:48:53 +0800449ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),)
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100450 common_LOCAL_SRC_FILES += android/dynlink-static.c
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700451 common_LOCAL_LDLIBS += -static
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100452endif
453
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700454## one for 32-bit
455$(call start-emulator-program, emulator-$(EMULATOR_TARGET_ARCH))
456LOCAL_STATIC_LIBRARIES += \
457 emulator-libui \
458 emulator-libqemu \
459 emulator-target-$(EMULATOR_TARGET_CPU) \
Lars Poeschel33da99a2012-08-22 09:42:42 +0200460 emulator-libjpeg \
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700461 emulator-libelff \
462 emulator-common \
463 $(SDL_STATIC_LIBRARIES)
464LOCAL_LDLIBS += $(common_LOCAL_LDLIBS)
465LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
466LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
467$(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c)
468$(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
469$(call gen-hw-config-defs)
Raphael Mollcdbea232012-05-04 15:04:27 -0700470
471ifeq ($(HOST_OS),windows)
472$(eval $(call insert-windows-icon))
473endif
474
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100475$(call end-emulator-program)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700476
477
478## another for 64-bit, see note in file Makefile.common emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700479ifneq ($(filter linux darwin,$(HOST_OS)),)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700480 ifneq ($(BUILD_STANDALONE_EMULATOR),true)
481 $(call start-emulator-program, emulator64-$(EMULATOR_TARGET_ARCH))
482 LOCAL_STATIC_LIBRARIES += \
483 emulator64-libui \
484 emulator64-libqemu \
485 emulator64-target-$(EMULATOR_TARGET_CPU) \
Lars Poeschel33da99a2012-08-22 09:42:42 +0200486 emulator64-libjpeg \
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700487 emulator64-libelff \
488 emulator64-common \
489 $(SDL_STATIC_LIBRARIES_64)
490 LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) -m64
491 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
492 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
493 $(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c)
494 $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
495 $(call gen-hw-config-defs)
496 $(call end-emulator-program)
497 endif # BUILD_STANDALONE_EMULATOR == nil
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700498endif # HOST_OS == linux || darwin
Raphael Mollcdbea232012-05-04 15:04:27 -0700499