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