configure already knows what TARGET_BASE_ARCH we need, no need to put the logic in...
[qemu] / Makefile.target
1 include config.mak
2 include $(SRC_PATH)/rules.mak
3
4 ifndef TARGET_BASE_ARCH
5 TARGET_BASE_ARCH:=$(TARGET_ARCH)
6 endif
7
8 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
9 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
10 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
11 #CFLAGS+=-Werror
12 LIBS=
13 # user emulator name
14 ifndef TARGET_ARCH2
15 TARGET_ARCH2=$(TARGET_ARCH)
16 endif
17 ifeq ($(TARGET_ARCH),arm)
18   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
19     TARGET_ARCH2=armeb
20   endif
21 endif
22 ifeq ($(TARGET_ARCH),sh4)
23   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
24     TARGET_ARCH2=sh4eb
25   endif
26 endif
27 ifeq ($(TARGET_ARCH),mips)
28   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
29     TARGET_ARCH2=mipsel
30   endif
31 endif
32 ifeq ($(TARGET_ARCH),mipsn32)
33   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
34     TARGET_ARCH2=mipsn32el
35   endif
36 endif
37 ifeq ($(TARGET_ARCH),mips64)
38   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
39     TARGET_ARCH2=mips64el
40   endif
41 endif
42
43 ifdef CONFIG_USER_ONLY
44 # user emulator name
45 QEMU_PROG=qemu-$(TARGET_ARCH2)
46 else
47 # system emulator name
48 ifeq ($(TARGET_ARCH), i386)
49 QEMU_PROG=qemu$(EXESUF)
50 else
51 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
52 endif
53 endif
54
55 PROGS=$(QEMU_PROG)
56
57 # cc-option
58 # Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0)
59
60 cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \
61               > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;)
62
63 HELPER_CFLAGS=
64
65 ifeq ($(ARCH),i386)
66 HELPER_CFLAGS+=-fomit-frame-pointer
67 endif
68
69 ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
70 translate.o: CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-unit-at-a-time,)
71 endif
72
73 ifeq ($(ARCH),sparc)
74   ifneq ($(CONFIG_SOLARIS),y)
75     HELPER_CFLAGS+=-ffixed-i0
76   endif
77 endif
78
79 ifeq ($(ARCH),alpha)
80 # Ensure there's only a single GP
81 CFLAGS+=-msmall-data
82 endif
83
84 ifeq ($(ARCH),hppa)
85 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
86 endif
87
88 ifeq ($(ARCH),ia64)
89 CFLAGS+=-mno-sdata
90 endif
91
92 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
93 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
94
95 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
96 CPPFLAGS+=-U_FORTIFY_SOURCE
97 LIBS+=-lm
98 ifdef CONFIG_WIN32
99 LIBS+=-lwinmm -lws2_32 -liphlpapi
100 endif
101 ifdef CONFIG_SOLARIS
102 LIBS+=-lsocket -lnsl -lresolv
103 ifdef NEEDS_LIBSUNMATH
104 LIBS+=-lsunmath
105 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
106 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
107 endif
108 endif
109
110 kvm.o: CFLAGS+=$(KVM_CFLAGS)
111 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
112
113 all: $(PROGS)
114 # Dummy command so that make thinks it has done something
115         @true
116
117 #########################################################
118 # cpu emulator library
119 libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o
120 libobj-$(CONFIG_KQEMU) += kqemu.o
121 # TCG code generator
122 libobj-y += tcg/tcg.o tcg/tcg-runtime.o
123 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
124 ifeq ($(ARCH),sparc64)
125 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
126 endif
127 ifdef CONFIG_SOFTFLOAT
128 libobj-y += fpu/softfloat.o
129 else
130 libobj-y += fpu/softfloat-native.o
131 endif
132 CPPFLAGS+=-I$(SRC_PATH)/fpu
133 libobj-y += op_helper.o helper.o
134
135 ifeq ($(TARGET_BASE_ARCH), arm)
136 libobj-y += neon_helper.o iwmmxt_helper.o
137 endif
138
139 ifeq ($(TARGET_BASE_ARCH), alpha)
140 libobj-y += alpha_palcode.o
141 endif
142
143 ifeq ($(TARGET_BASE_ARCH), cris)
144 libobj-y += cris-dis.o
145
146 ifndef CONFIG_USER_ONLY
147 libobj-y += mmu.o
148 endif
149 endif
150
151 # NOTE: the disassembler code is only needed for debugging
152 libobj-y += disas.o
153 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
154 USE_I386_DIS=y
155 endif
156 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
157 USE_I386_DIS=y
158 endif
159 libobj-$(USE_I386_DIS) += i386-dis.o
160 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
161 libobj-y += alpha-dis.o
162 endif
163 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
164 libobj-y += ppc-dis.o
165 endif
166 ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze)
167 libobj-y += microblaze-dis.o
168 ifndef CONFIG_USER_ONLY
169 libobj-y += mmu.o
170 endif
171 endif
172 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
173 libobj-y += mips-dis.o
174 endif
175 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
176 libobj-y += sparc-dis.o
177 endif
178 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
179 libobj-y += arm-dis.o
180 endif
181 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
182 libobj-y += m68k-dis.o
183 endif
184 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
185 libobj-y += sh4-dis.o
186 endif
187 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
188 libobj-y += hppa-dis.o
189 endif
190 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
191 libobj-y += s390-dis.o
192 endif
193
194 # libqemu
195
196 libqemu.a: $(libobj-y)
197
198 translate.o: translate.c cpu.h
199
200 translate-all.o: translate-all.c cpu.h
201
202 tcg/tcg.o: cpu.h
203
204 # HELPER_CFLAGS is used for all the code compiled with static register
205 # variables
206 op_helper.o: CFLAGS += $(HELPER_CFLAGS)
207
208 cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
209
210 #########################################################
211 # Linux user emulator target
212
213 ifdef CONFIG_LINUX_USER
214
215 ifndef TARGET_ABI_DIR
216   TARGET_ABI_DIR=$(TARGET_ARCH)
217 endif
218 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
219 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
220
221 ifdef CONFIG_STATIC
222 LDFLAGS+=-static
223 endif
224
225 ifeq ($(ARCH),i386)
226 ifdef TARGET_GPROF
227 USE_I386_LD=y
228 endif
229 ifdef CONFIG_STATIC
230 USE_I386_LD=y
231 endif
232 ifdef USE_I386_LD
233 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
234 else
235 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
236 # that the kernel ELF loader considers as an executable. I think this
237 # is the simplest way to make it self virtualizable!
238 LDFLAGS+=-Wl,-shared
239 endif
240 endif
241
242 ifeq ($(ARCH),x86_64)
243 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
244 endif
245
246 ifeq ($(ARCH),ppc)
247 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
248 endif
249
250 ifeq ($(ARCH),ppc64)
251 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
252 endif
253
254 ifeq ($(ARCH),s390)
255 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
256 endif
257
258 ifeq ($(ARCH),sparc)
259 # -static is used to avoid g1/g3 usage by the dynamic linker    
260 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
261 endif
262
263 ifeq ($(ARCH),sparc64)
264 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
265 endif
266
267 ifeq ($(ARCH),alpha)
268 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
269 endif
270
271 ifeq ($(ARCH),ia64)
272 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
273 endif
274
275 ifeq ($(ARCH),arm)
276 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
277 endif
278
279 ifeq ($(ARCH),m68k)
280 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
281 endif
282
283 ifeq ($(ARCH),mips)
284 ifeq ($(WORDS_BIGENDIAN),yes)
285 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
286 else
287 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
288 endif
289 endif
290
291 ifeq ($(ARCH),mips64)
292 ifeq ($(WORDS_BIGENDIAN),yes)
293 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
294 else
295 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
296 endif
297 endif
298
299 # profiling code
300 ifdef TARGET_GPROF
301 LDFLAGS+=-p
302 CFLAGS+=-p
303 endif
304
305 obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
306       elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o \
307       ioport-user.o
308 LIBS+= $(PTHREADLIBS)
309 LIBS+= $(CLOCKLIBS)
310 obj-$(TARGET_HAS_BFLT) += flatload.o
311
312 ifdef TARGET_HAS_ELFLOAD32
313 elfload32.o: elfload.c
314 endif
315 obj-$(TARGET_HAS_ELFLOAD32) += elfload32.o
316
317 ifeq ($(TARGET_ARCH), i386)
318 obj-y += vm86.o
319 endif
320 ifeq ($(TARGET_ARCH), arm)
321 nwfpe-obj-y := fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o
322 nwfpe-obj-y += single_cpdo.o double_cpdo.o extended_cpdo.o
323 obj-y +=  $(addprefix nwfpe/, $(nwfpe-obj-y))
324 obj-y += arm-semi.o
325 endif
326 ifeq ($(TARGET_ARCH), m68k)
327 obj-y += m68k-sim.o m68k-semi.o
328 endif
329
330 # Note: this is a workaround. The real fix is to avoid compiling
331 # cpu_signal_handler() in cpu-exec.c.
332 signal.o: CFLAGS += $(HELPER_CFLAGS)
333
334 $(QEMU_PROG): ARLIBS=../libqemu_user.a libqemu.a
335 $(QEMU_PROG): $(obj-y) ../libqemu_user.a libqemu.a
336         $(call LINK,$(obj-y))
337 ifeq ($(ARCH),alpha)
338 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
339 # the address space (31 bit so sign extending doesn't matter)
340         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
341 endif
342
343 endif #CONFIG_LINUX_USER
344
345 #########################################################
346 # Darwin user emulator target
347
348 ifdef CONFIG_DARWIN_USER
349
350 VPATH+=:$(SRC_PATH)/darwin-user
351 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
352
353 # Leave some space for the regular program loading zone
354 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
355
356 LIBS+=-lmx
357
358 obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
359         gdbstub.o gdbstub-xml.o ioport-user.o
360
361 # Note: this is a workaround. The real fix is to avoid compiling
362 # cpu_signal_handler() in cpu-exec.c.
363 signal.o: CFLAGS += $(HELPER_CFLAGS)
364
365 $(QEMU_PROG): ARLIBS=libqemu.a
366 $(QEMU_PROG): $(obj-y) libqemu.a
367         $(call LINK,$(obj-y))
368
369 endif #CONFIG_DARWIN_USER
370
371 #########################################################
372 # BSD user emulator target
373
374 ifdef CONFIG_BSD_USER
375
376 VPATH+=:$(SRC_PATH)/bsd-user
377 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
378
379 ifdef CONFIG_STATIC
380 LDFLAGS+=-static
381 endif
382
383 ifeq ($(ARCH),i386)
384 ifdef TARGET_GPROF
385 USE_I386_LD=y
386 endif
387 ifdef CONFIG_STATIC
388 USE_I386_LD=y
389 endif
390 ifdef USE_I386_LD
391 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
392 else
393 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
394 # that the kernel ELF loader considers as an executable. I think this
395 # is the simplest way to make it self virtualizable!
396 LDFLAGS+=-Wl,-shared
397 endif
398 endif
399
400 ifeq ($(ARCH),x86_64)
401 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
402 endif
403
404 ifeq ($(ARCH),ppc)
405 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
406 endif
407
408 ifeq ($(ARCH),ppc64)
409 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
410 endif
411
412 ifeq ($(ARCH),s390)
413 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
414 endif
415
416 ifeq ($(ARCH),sparc)
417 # -static is used to avoid g1/g3 usage by the dynamic linker
418 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
419 endif
420
421 ifeq ($(ARCH),sparc64)
422 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
423 endif
424
425 ifeq ($(ARCH),alpha)
426 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
427 endif
428
429 ifeq ($(ARCH),ia64)
430 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
431 endif
432
433 ifeq ($(ARCH),arm)
434 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
435 endif
436
437 ifeq ($(ARCH),m68k)
438 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
439 endif
440
441 ifeq ($(ARCH),mips)
442 ifeq ($(WORDS_BIGENDIAN),yes)
443 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
444 else
445 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
446 endif
447 endif
448
449 ifeq ($(ARCH),mips64)
450 ifeq ($(WORDS_BIGENDIAN),yes)
451 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
452 else
453 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
454 endif
455 endif
456
457 obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
458         gdbstub.o gdbstub-xml.o ioport-user.o
459 obj-y += uaccess.o
460
461 # Note: this is a workaround. The real fix is to avoid compiling
462 # cpu_signal_handler() in cpu-exec.c.
463 signal.o: CFLAGS += $(HELPER_CFLAGS)
464
465 $(QEMU_PROG): ARLIBS=libqemu.a ../libqemu_user.a
466 $(QEMU_PROG): $(obj-y) libqemu.a ../libqemu_user.a
467         $(call LINK,$(obj-y))
468
469 endif #CONFIG_BSD_USER
470
471 #########################################################
472 # System emulator target
473 ifndef CONFIG_USER_ONLY
474
475 obj-y = vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
476         gdbstub.o gdbstub-xml.o msix.o ioport.o
477 # virtio has to be here due to weird dependency between PCI and virtio-net.
478 # need to fix this properly
479 obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
480 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
481
482 LIBS+=-lz
483 ifdef CONFIG_ALSA
484 LIBS += -lasound
485 endif
486 ifdef CONFIG_ESD
487 LIBS += -lesd
488 endif
489 ifdef CONFIG_PA
490 LIBS += -lpulse-simple
491 endif
492 ifdef CONFIG_DSOUND
493 LIBS += -lole32 -ldxguid
494 endif
495 ifdef CONFIG_FMOD
496 LIBS += $(CONFIG_FMOD_LIB)
497 endif
498 ifdef CONFIG_OSS
499 LIBS += $(CONFIG_OSS_LIB)
500 endif
501
502 sound-obj-y =
503 sound-obj-$(CONFIG_SB16) += sb16.o
504 sound-obj-$(CONFIG_ES1370) += es1370.o
505 sound-obj-$(CONFIG_AC97) += ac97.o
506 sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
507 sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
508 sound-obj-$(CONFIG_CS4231A) += cs4231a.o
509
510 ifdef CONFIG_ADLIB
511 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
512 endif
513
514 ifdef CONFIG_VNC_TLS
515 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
516 LIBS += $(CONFIG_VNC_TLS_LIBS)
517 endif
518
519 ifdef CONFIG_VNC_SASL
520 CPPFLAGS += $(CONFIG_VNC_SASL_CFLAGS)
521 LIBS += $(CONFIG_VNC_SASL_LIBS)
522 endif
523
524 ifdef CONFIG_BLUEZ
525 LIBS += $(CONFIG_BLUEZ_LIBS)
526 endif
527
528 # xen backend driver support
529 obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
530 ifeq ($(CONFIG_XEN), y)
531   LIBS += $(XEN_LIBS)
532 endif
533
534 # USB layer
535 obj-y += usb-ohci.o
536
537 # PCI network cards
538 obj-y += eepro100.o
539 obj-y += ne2000.o
540 obj-y += pcnet.o
541 obj-y += rtl8139.o
542 obj-y += e1000.o
543
544 # Generic watchdog support and some watchdog devices
545 obj-y += wdt_ib700.o wdt_i6300esb.o
546
547 ifeq ($(TARGET_BASE_ARCH), i386)
548 # Hardware support
549 obj-y += ide.o pckbd.o vga.o $(sound-obj-y) dma.o
550 obj-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
551 obj-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
552 obj-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
553 obj-y += device-hotplug.o pci-hotplug.o smbios.o
554 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
555 endif
556 ifeq ($(TARGET_BASE_ARCH), ppc)
557 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
558 # shared objects
559 obj-y += ppc.o ide.o vga.o $(sound-obj-y) dma.o openpic.o
560 # PREP target
561 obj-y += pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o
562 obj-y += prep_pci.o ppc_prep.o
563 # Mac shared devices
564 obj-y += macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
565 # OldWorld PowerMac
566 obj-y += heathrow_pic.o grackle_pci.o ppc_oldworld.o
567 # NewWorld PowerMac
568 obj-y += unin_pci.o ppc_newworld.o
569 # PowerPC 4xx boards
570 obj-y += pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
571 obj-y += ppc440.o ppc440_bamboo.o
572 # PowerPC E500 boards
573 obj-y += ppce500_pci.o ppce500_mpc8544ds.o
574 ifdef FDT_LIBS
575 obj-y += device_tree.o
576 LIBS+= $(FDT_LIBS)
577 endif
578 obj-$(CONFIG_KVM) += kvm_ppc.o
579 endif
580 ifeq ($(TARGET_BASE_ARCH), mips)
581 obj-y += mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
582 obj-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
583 obj-y += g364fb.o jazz_led.o dp8393x.o
584 obj-y += ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
585 obj-y += piix_pci.o parallel.o cirrus_vga.o pcspk.o $(sound-obj-y)
586 obj-y += mipsnet.o
587 obj-y += pflash_cfi01.o
588 obj-y += vmware_vga.o
589 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
590 endif
591 ifeq ($(TARGET_BASE_ARCH), microblaze)
592 obj-y += petalogix_s3adsp1800_mmu.o
593
594 obj-y += microblaze_pic_cpu.o
595 obj-y += xilinx_intc.o
596 obj-y += xilinx_timer.o
597 obj-y += xilinx_uartlite.o
598 obj-y += xilinx_ethlite.o
599
600 obj-y += pflash_cfi02.o
601 ifdef FDT_LIBS
602 obj-y += device_tree.o
603 LIBS+= $(FDT_LIBS)
604 endif
605 endif
606 ifeq ($(TARGET_BASE_ARCH), cris)
607 # Boards
608 obj-y += cris_pic_cpu.o etraxfs.o axis_dev88.o
609
610 # IO blocks
611 obj-y += etraxfs_dma.o
612 obj-y += etraxfs_pic.o
613 obj-y += etraxfs_eth.o
614 obj-y += etraxfs_timer.o
615 obj-y += etraxfs_ser.o
616
617 obj-y += pflash_cfi02.o
618 endif
619 ifeq ($(TARGET_BASE_ARCH), sparc)
620 ifeq ($(TARGET_ARCH), sparc64)
621 obj-y += sun4u.o ide.o pckbd.o vga.o apb_pci.o
622 obj-y += fdc.o mc146818rtc.o serial.o
623 obj-y += cirrus_vga.o parallel.o
624 else
625 obj-y += sun4m.o tcx.o iommu.o slavio_intctl.o
626 obj-y += slavio_timer.o slavio_misc.o fdc.o sparc32_dma.o
627 obj-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o
628 endif
629 endif
630 ifeq ($(TARGET_BASE_ARCH), arm)
631 obj-y += integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
632 obj-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
633 obj-y += versatile_pci.o
634 obj-y += realview_gic.o realview.o arm_sysctl.o mpcore.o
635 obj-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
636 obj-y += pl061.o
637 obj-y += arm-semi.o
638 obj-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
639 obj-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
640 obj-y += pflash_cfi01.o gumstix.o
641 obj-y += zaurus.o ide.o serial.o spitz.o tosa.o tc6393xb.o
642 obj-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
643 obj-y += omap2.o omap_dss.o soc_dma.o
644 obj-y += omap_sx1.o palm.o tsc210x.o
645 obj-y += nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
646 obj-y += mst_fpga.o mainstone.o
647 obj-y += musicpal.o pflash_cfi02.o
648 obj-y += framebuffer.o
649 obj-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
650 obj-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
651 obj-y += syborg_virtio.o
652 CPPFLAGS += -DHAS_AUDIO
653 endif
654 ifeq ($(TARGET_BASE_ARCH), sh4)
655 obj-y += shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
656 obj-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
657 obj-y += ide.o
658 endif
659 ifeq ($(TARGET_BASE_ARCH), m68k)
660 obj-y += an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
661 obj-y += m68k-semi.o dummy_m68k.o
662 endif
663 ifdef CONFIG_COCOA
664 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
665 ifdef CONFIG_COREAUDIO
666 COCOA_LIBS+=-framework CoreAudio
667 endif
668 endif
669 ifdef CONFIG_SLIRP
670 CPPFLAGS+=-I$(SRC_PATH)/slirp
671 endif
672
673 # specific flags are needed for non soft mmu emulator
674 ifdef CONFIG_STATIC
675 LDFLAGS+=-static
676 endif
677 ifndef CONFIG_DARWIN
678 ifndef CONFIG_WIN32
679 ifndef CONFIG_SOLARIS
680 ifndef CONFIG_AIX
681 LIBS+=-lutil
682 endif
683 endif
684 endif
685 endif
686 ifdef TARGET_GPROF
687 vl.o: CFLAGS+=-p
688 LDFLAGS+=-p
689 endif
690
691 ifeq ($(ARCH),ia64)
692 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
693 endif
694
695 ifdef CONFIG_WIN32
696 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
697 endif
698
699 # profiling code
700 ifdef TARGET_GPROF
701 LDFLAGS+=-p
702 main.o: CFLAGS+=-p
703 endif
704
705 vl.o: CFLAGS+=$(SDL_CFLAGS)
706
707 vl.o: qemu-options.h
708
709 monitor.o: qemu-monitor.h
710
711 $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
712 $(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
713 $(QEMU_PROG): $(obj-y) ../libqemu_common.a libqemu.a $(HWLIB)
714         $(call LINK,$(obj-y))
715
716 endif # !CONFIG_USER_ONLY
717
718 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
719 ifeq ($(TARGET_XML_FILES),)
720         $(call quiet-command,rm -f $@ && echo > $@,"  GEN   $(TARGET_DIR)$@")
721 else
722         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
723 endif
724
725 qemu-options.h: $(SRC_PATH)/qemu-options.hx
726         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
727
728 qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx
729         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
730
731 clean:
732         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
733         rm -f *.d */*.d tcg/*.o
734         rm -f qemu-options.h qemu-monitor.h gdbstub-xml.c
735
736 install: all
737 ifneq ($(PROGS),)
738         $(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)"
739 endif
740
741 # Include automatically generated dependency files
742 -include $(wildcard *.d */*.d)