blob: fce253b196938c8f4139d774c257e217a4b2af66 [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 := \
61 bt.c \
62 bt-hci.c \
63 bt-hid.c \
64 bt-l2cap.c \
65 bt-sdp.c \
66 cdrom.c \
67 dma.c \
68 irq.c \
Jun Nakajima6f198362011-02-24 13:16:01 -080069 goldfish_audio.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010070 goldfish_device.c \
71 goldfish_events_device.c \
72 goldfish_fb.c \
73 goldfish_battery.c \
74 goldfish_mmc.c \
75 goldfish_memlog.c \
76 goldfish_nand.c \
David 'Digit' Turner89217f52011-03-21 17:51:03 +010077 goldfish_pipe.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010078 goldfish_tty.c \
Tom Knych08c72282013-01-02 18:05:24 -080079 goldfish_vmem.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010080 msmouse.c \
81 pci.c \
82 qdev.c \
83 scsi-disk.c \
84 sysbus.c \
85 usb-hid.c \
86 usb-hub.c \
87 usb-msd.c \
88 usb-ohci.c \
89 usb.c \
90 watchdog.c
91
David 'Digit' Turner42fc4492011-06-29 13:16:16 +020092
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010093ifeq ($(EMULATOR_TARGET_ARCH),arm)
94HW_SOURCES += android_arm.c \
95 arm_pic.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010096 goldfish_interrupt.c \
97 goldfish_switch.c \
98 goldfish_timer.c \
99 goldfish_trace.c \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700100 arm_boot.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 += \
118 apic.c \
119 i8259.c \
120 mc146818rtc.c \
121 piix_pci.c \
122 i8254.c \
123 pckbd.c \
124 ioapic.c \
125 ps2.c \
126 smbios.c \
127 fw_cfg.c
128
129# The following sources must be compiled with the final executables
130# because they contain device_init() or machine_init() statements.
131HW_OBJ_SOURCES := \
132 hw/ne2000.c \
133 hw/pc.c
134
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 \
143 goldfish_interrupt.c \
144 goldfish_switch.c \
145 goldfish_timer.c \
146 goldfish_trace.c \
147 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' Turneraff94b82011-02-07 18:10:54 +0100167 cpu-exec.c \
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200168 exec.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100169 translate-all.c \
David 'Digit' Turnerd4e803c2013-12-14 23:45:50 +0100170 android/trace.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100171 varint.c \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700172 softmmu_outside_jit.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100173
174##############################################################################
175# CPU-specific emulation.
176#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700177common_LOCAL_CFLAGS += -fno-PIC -fomit-frame-pointer -Wno-sign-compare
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100178
179ifeq ($(HOST_ARCH),ppc)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700180 common_LOCAL_CFLAGS += -D__powerpc__
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100181endif
182
183ifeq ($(EMULATOR_TARGET_ARCH),arm)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700184common_LOCAL_SRC_FILES += \
David 'Digit' Turner82a591c2013-12-17 09:10:58 +0100185 target-arm/arm-semi.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100186 target-arm/op_helper.c \
187 target-arm/iwmmxt_helper.c \
188 target-arm/neon_helper.c \
189 target-arm/helper.c \
David 'Digit' Turner288208c2011-05-11 19:37:35 +0200190 target-arm/helper-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100191 target-arm/translate.c \
192 target-arm/machine.c \
193 hw/armv7m.c \
David 'Digit' Turner82a591c2013-12-17 09:10:58 +0100194 hw/armv7m_nvic.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100195
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700196common_LOCAL_SRC_FILES += fpu/softfloat.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100197endif
198
199ifeq ($(EMULATOR_TARGET_ARCH), x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700200common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100201 target-i386/op_helper.c \
202 target-i386/helper.c \
203 target-i386/translate.c \
204 target-i386/machine.c \
205
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800206ifeq ($(HOST_OS),darwin)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700207common_LOCAL_SRC_FILES += \
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800208 target-i386/hax-all.c \
209 target-i386/hax-darwin.c
210endif
211
212ifeq ($(HOST_OS),windows)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700213common_LOCAL_SRC_FILES += \
Jun Nakajimae4a3c782011-12-17 19:22:12 -0800214 target-i386/hax-all.c \
215 target-i386/hax-windows.c
216endif
217
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700218common_LOCAL_SRC_FILES += fpu/softfloat-native.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100219endif
220
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700221ifeq ($(EMULATOR_TARGET_ARCH), mips)
222common_LOCAL_SRC_FILES += \
223 target-mips/op_helper.c \
224 target-mips/helper.c \
225 target-mips/translate.c \
226 target-mips/machine.c
227
228common_LOCAL_SRC_FILES += fpu/softfloat.c
229endif
230
Jun Nakajima1321c762011-03-04 17:17:45 -0800231# compile KVM only if target is x86 on x86 Linux
David 'Digit' Turner36597752011-05-20 01:18:01 +0200232QEMU_KVM_TAG := $(QEMU_HOST_TAG)-$(EMULATOR_TARGET_ARCH)
233QEMU_DO_KVM := $(if $(filter linux-x86-x86 linux-x86_64-x86,$(QEMU_KVM_TAG)),true,false)
234ifeq ($(QEMU_DO_KVM),true)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700235 common_LOCAL_SRC_FILES += \
David 'Digit' Turner36597752011-05-20 01:18:01 +0200236 target-i386/kvm.c \
Jun Nakajimabb0140b2011-05-27 18:24:21 -0700237 target-i386/kvm-gs-restore.c \
David 'Digit' Turner36597752011-05-20 01:18:01 +0200238 kvm-all.c \
239 kvm-android.c
Jun Nakajima1321c762011-03-04 17:17:45 -0800240endif
241
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100242##############################################################################
243# Memory-access checking support.
244# Memory access checker uses information collected by instrumented code in
245# libc.so in order to keep track of memory blocks allocated from heap. Memory
246# checker then uses this information to make sure that every access to allocated
247# memory is within allocated block. This information also allows detecting
248# memory leaks and attempts to free/realloc invalid pointers.
249#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700250common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100251 -I$(LOCAL_PATH)/memcheck \
252 -I$(LOCAL_PATH)/elff
253
254MCHK_SOURCES := \
255 memcheck.c \
256 memcheck_proc_management.c \
257 memcheck_malloc_map.c \
258 memcheck_mmrange_map.c \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700259 memcheck_util.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100260
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700261common_LOCAL_SRC_FILES += $(MCHK_SOURCES:%=memcheck/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100262
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700263common_LOCAL_SRC_FILES += \
David 'Digit' Turnerae3098a2011-05-11 16:01:57 +0200264 cpus.c \
265 arch_init.c
266
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200267# What a mess, os-posix.c depends on the exact values of options
268# which are target specific.
269ifeq ($(HOST_OS),windows)
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100270 common_LOCAL_SRC_FILES += os-win32.c util/oslib-win32.c
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200271else
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100272 common_LOCAL_SRC_FILES += os-posix.c util/oslib-posix.c
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200273endif
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100274
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700275
276## one for 32-bit
277$(call start-emulator-library, emulator-target-$(EMULATOR_TARGET_CPU))
278LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
279LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
280$(call gen-hw-config-defs)
281$(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100282$(call end-emulator-library)
283
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700284## another for 64-bit, see note in file Makefile.common emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700285ifneq ($(filter linux darwin,$(HOST_OS)),)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700286 ifneq ($(BUILD_STANDALONE_EMULATOR),true)
287 $(call start-emulator-library, emulator64-target-$(EMULATOR_TARGET_CPU))
288 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
289 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
290 $(call gen-hw-config-defs)
291 $(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c)
292 $(call end-emulator-library)
293 endif # BUILD_STANDALONE_EMULATOR == nil
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700294endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700295
296
297
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100298##############################################################################
299##############################################################################
300###
301### qemu-android-$CPU: headless emulator core program
302###
303###
304$(call start-emulator-program, qemu-android-$(EMULATOR_TARGET_ARCH))
305
306LOCAL_CFLAGS += \
307 $(EMULATOR_COMMON_CFLAGS) \
308 $(ELFF_CFLAGS) \
309 $(EMULATOR_LIBQEMU_CFLAGS) \
310 $(EMULATOR_TARGET_CFLAGS) \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700311 -DCONFIG_STANDALONE_CORE
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100312
Jesse Hall183e9272012-04-26 15:13:27 -0700313ifneq ($(QEMU_OPENGLES_INCLUDE),)
314 LOCAL_CFLAGS += -I$(QEMU_OPENGLES_INCLUDE)
315endif
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100316
Raphael Moll9e319a92012-11-28 13:48:25 -0800317LOCAL_CFLAGS += $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100318
319LOCAL_STATIC_LIBRARIES := \
320 emulator-libqemu \
321 emulator-target-$(EMULATOR_TARGET_CPU) \
Lars Poeschel33da99a2012-08-22 09:42:42 +0200322 emulator-libjpeg \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100323 emulator-libelff \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700324 emulator-common
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100325
326LOCAL_LDLIBS += \
327 $(EMULATOR_COMMON_LDLIBS) \
328 $(EMULATOR_LIBQEMU_LDLIBS) \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700329 $(ELFF_LDLIBS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100330
331LOCAL_SRC_FILES := \
332 audio/audio.c \
333 disas.c \
334 dma-helpers.c \
335 gdbstub.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100336 loader.c \
337 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' Turner852088c2013-12-14 23:04:12 +0100351 ui/keymaps.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100352
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200353$(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200354$(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200355$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100356
357ifeq ($(HOST_OS),darwin)
358 FRAMEWORKS := OpenGL Cocoa QuickTime ApplicationServices Carbon IOKit
359 LOCAL_LDLIBS += $(FRAMEWORKS:%=-Wl,-framework,%)
360endif
361
362# Generate a completely static executable if needed.
363# Note that this means no sound and graphics on Linux.
364#
Andrew Hsieh632a0e12012-04-28 00:48:53 +0800365ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),)
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100366 LOCAL_SRC_FILES += android/dynlink-static.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100367 LOCAL_LDLIBS += -static
368endif
369
370# The following files cannot be in static libraries because they contain
371# constructor functions that are otherwise stripped by the final linker
372LOCAL_SRC_FILES += $(HW_OBJ_SOURCES)
373LOCAL_CFLAGS += $(HW_OBJ_CFLAGS)
374
375LOCAL_SRC_FILES += $(BLOCK_SOURCES)
376LOCAL_CFLAGS += $(BLOCK_CFLAGS)
377
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100378$(call end-emulator-program)
379
380##############################################################################
381##############################################################################
382###
383### emulator-$ARCH: Standalone emulator program
384###
385###
386
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700387common_LOCAL_LDLIBS =
388common_LOCAL_CFLAGS =
389common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100390
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700391
392common_LOCAL_STATIC_LIBRARIES := \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100393 emulator-libui \
394 emulator-libqemu \
395 emulator-target-$(EMULATOR_TARGET_CPU) \
396 emulator-libelff \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700397 emulator-common
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100398
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700399common_LOCAL_LDLIBS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100400 $(EMULATOR_COMMON_LDLIBS) \
401 $(EMULATOR_LIBQEMU_LDLIBS) \
402 $(EMULATOR_LIBUI_LDLIBS) \
Bhanu Chetlapalli741dc132012-05-08 17:16:03 -0700403 $(ELFF_LDLIBS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100404
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700405common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100406 $(EMULATOR_TARGET_CFLAGS) \
407 $(EMULATOR_COMMON_CFLAGS) \
408 $(EMULATOR_LIBQEMU_CFLAGS) \
409 $(EMULATOR_LIBUI_CFLAGS)
410
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700411common_LOCAL_SRC_FILES := \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100412 audio/audio.c \
413 disas.c \
414 dma-helpers.c \
415 gdbstub.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100416 loader.c \
417 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' Turner852088c2013-12-14 23:04:12 +0100432 ui/keymaps.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100433
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100434
435# The following files cannot be in static libraries because they contain
436# constructor functions that are otherwise stripped by the final linker
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700437common_LOCAL_SRC_FILES += $(HW_OBJ_SOURCES)
438common_LOCAL_CFLAGS += $(HW_OBJ_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100439
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700440common_LOCAL_SRC_FILES += $(BLOCK_SOURCES)
441common_LOCAL_CFLAGS += $(BLOCK_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100442
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700443common_LOCAL_SRC_FILES += $(SDLMAIN_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100444
445# Generate a completely static executable if needed.
446# Note that this means no sound and graphics on Linux.
447#
Andrew Hsieh632a0e12012-04-28 00:48:53 +0800448ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),)
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100449 common_LOCAL_SRC_FILES += android/dynlink-static.c
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700450 common_LOCAL_LDLIBS += -static
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100451endif
452
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700453## one for 32-bit
454$(call start-emulator-program, emulator-$(EMULATOR_TARGET_ARCH))
455LOCAL_STATIC_LIBRARIES += \
456 emulator-libui \
457 emulator-libqemu \
458 emulator-target-$(EMULATOR_TARGET_CPU) \
Lars Poeschel33da99a2012-08-22 09:42:42 +0200459 emulator-libjpeg \
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700460 emulator-libelff \
461 emulator-common \
462 $(SDL_STATIC_LIBRARIES)
463LOCAL_LDLIBS += $(common_LOCAL_LDLIBS)
464LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
465LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
466$(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c)
467$(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
468$(call gen-hw-config-defs)
Raphael Mollcdbea232012-05-04 15:04:27 -0700469
470ifeq ($(HOST_OS),windows)
471$(eval $(call insert-windows-icon))
472endif
473
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100474$(call end-emulator-program)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700475
476
477## another for 64-bit, see note in file Makefile.common emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700478ifneq ($(filter linux darwin,$(HOST_OS)),)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700479 ifneq ($(BUILD_STANDALONE_EMULATOR),true)
480 $(call start-emulator-program, emulator64-$(EMULATOR_TARGET_ARCH))
481 LOCAL_STATIC_LIBRARIES += \
482 emulator64-libui \
483 emulator64-libqemu \
484 emulator64-target-$(EMULATOR_TARGET_CPU) \
Lars Poeschel33da99a2012-08-22 09:42:42 +0200485 emulator64-libjpeg \
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700486 emulator64-libelff \
487 emulator64-common \
488 $(SDL_STATIC_LIBRARIES_64)
489 LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) -m64
490 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
491 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
492 $(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c)
493 $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
494 $(call gen-hw-config-defs)
495 $(call end-emulator-program)
496 endif # BUILD_STANDALONE_EMULATOR == nil
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700497endif # HOST_OS == linux || darwin
Raphael Mollcdbea232012-05-04 15:04:27 -0700498