Share more SPR instanciations between all PowerPC 401 incarnations.
[qemu/qemu_0_9_1_stable.git] / Makefile.target
blob9b0459ec1841d2e79287a1f52739a4f2da4925fd
1 include config.mak
3 TARGET_BASE_ARCH:=$(TARGET_ARCH)
4 ifeq ($(TARGET_ARCH), x86_64)
5 TARGET_BASE_ARCH:=i386
6 endif
7 ifeq ($(TARGET_ARCH), mipsn32)
8 TARGET_BASE_ARCH:=mips
9 endif
10 ifeq ($(TARGET_ARCH), mips64)
11 TARGET_BASE_ARCH:=mips
12 endif
13 ifeq ($(TARGET_ARCH), ppc64)
14 TARGET_BASE_ARCH:=ppc
15 endif
16 ifeq ($(TARGET_ARCH), ppcemb)
17 TARGET_BASE_ARCH:=ppc
18 endif
19 ifeq ($(TARGET_ARCH), sparc64)
20 TARGET_BASE_ARCH:=sparc
21 endif
22 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
23 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
24 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
25 ifdef CONFIG_DARWIN_USER
26 VPATH+=:$(SRC_PATH)/darwin-user
27 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
28 endif
29 ifdef CONFIG_LINUX_USER
30 VPATH+=:$(SRC_PATH)/linux-user
31 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
32 endif
33 BASE_CFLAGS=
34 BASE_LDFLAGS=
35 #CFLAGS+=-Werror
36 LIBS=
37 HELPER_CFLAGS=$(CFLAGS)
38 DYNGEN=../dyngen$(EXESUF)
39 # user emulator name
40 TARGET_ARCH2=$(TARGET_ARCH)
41 ifeq ($(TARGET_ARCH),arm)
42   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
43     TARGET_ARCH2=armeb
44   endif
45 endif
46 ifeq ($(TARGET_ARCH),sh4)
47   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
48     TARGET_ARCH2=sh4eb
49   endif
50 endif
51 ifeq ($(TARGET_ARCH),mips)
52   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
53     TARGET_ARCH2=mipsel
54   endif
55 endif
56 ifeq ($(TARGET_ARCH),mipsn32)
57   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
58     TARGET_ARCH2=mipsn32el
59   endif
60 endif
61 ifeq ($(TARGET_ARCH),mips64)
62   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
63     TARGET_ARCH2=mips64el
64   endif
65 endif
66 QEMU_USER=qemu-$(TARGET_ARCH2)
67 # system emulator name
68 ifdef CONFIG_SOFTMMU
69 ifeq ($(TARGET_ARCH), i386)
70 QEMU_SYSTEM=qemu$(EXESUF)
71 else
72 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
73 endif
74 else
75 QEMU_SYSTEM=qemu-fast
76 endif
78 ifdef CONFIG_USER_ONLY
79 PROGS=$(QEMU_USER)
80 else
81 PROGS+=$(QEMU_SYSTEM)
82 ifndef CONFIG_SOFTMMU
83 CONFIG_STATIC=y
84 endif
85 endif # !CONFIG_USER_ONLY
87 ifdef CONFIG_STATIC
88 BASE_LDFLAGS+=-static
89 endif
91 # We require -O2 to avoid the stack setup prologue in EXIT_TB
92 OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
94 # cc-option
95 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
97 cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
98               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
100 OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
101 OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
102 OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
103 OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
104 OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
105 OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
106 OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
107 OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
108 OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
110 ifeq ($(ARCH),i386)
111 HELPER_CFLAGS+=-fomit-frame-pointer
112 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
113 ifdef TARGET_GPROF
114 USE_I386_LD=y
115 endif
116 ifdef CONFIG_STATIC
117 USE_I386_LD=y
118 endif
119 ifdef USE_I386_LD
120 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
121 else
122 ifdef CONFIG_LINUX_USER
123 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
124 # that the kernel ELF loader considers as an executable. I think this
125 # is the simplest way to make it self virtualizable!
126 BASE_LDFLAGS+=-Wl,-shared
127 endif
128 endif
129 endif
131 ifeq ($(ARCH),x86_64)
132 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
133 endif
135 ifeq ($(ARCH),ppc)
136 CPPFLAGS+= -D__powerpc__
137 ifdef CONFIG_LINUX_USER
138 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
139 endif
140 endif
142 ifeq ($(ARCH),s390)
143 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
144 endif
146 ifeq ($(ARCH),sparc)
147   BASE_CFLAGS+=-ffixed-g2 -ffixed-g3
148   OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
149   ifeq ($(CONFIG_SOLARIS),yes)
150     OP_CFLAGS+=-fno-omit-frame-pointer
151   else
152     BASE_CFLAGS+=-ffixed-g1 -ffixed-g6
153     HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
154     # -static is used to avoid g1/g3 usage by the dynamic linker
155     BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
156   endif
157 endif
159 ifeq ($(ARCH),sparc64)
160   BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
161   OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
162   ifneq ($(CONFIG_SOLARIS),yes)
163     BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
164     OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
165   endif
166 endif
168 ifeq ($(ARCH),alpha)
169 # -msmall-data is not used for OP_CFLAGS because we want two-instruction
170 # relocations for the constant constructions
171 # Ensure there's only a single GP
172 BASE_CFLAGS+=-msmall-data
173 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
174 endif
176 ifeq ($(ARCH),ia64)
177 BASE_CFLAGS+=-mno-sdata
178 OP_CFLAGS+=-mno-sdata
179 BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
180 endif
182 ifeq ($(ARCH),arm)
183 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
184 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
185 endif
187 ifeq ($(ARCH),m68k)
188 OP_CFLAGS+=-fomit-frame-pointer
189 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
190 endif
192 ifeq ($(ARCH),mips)
193 OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
194 ifeq ($(WORDS_BIGENDIAN),yes)
195 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
196 else
197 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
198 endif
199 endif
201 ifeq ($(ARCH),mips64)
202 OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
203 ifeq ($(WORDS_BIGENDIAN),yes)
204 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
205 else
206 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
207 endif
208 endif
210 ifeq ($(CONFIG_DARWIN),yes)
211 LIBS+=-lmx
212 endif
214 ifdef CONFIG_DARWIN_USER
215 # Leave some space for the regular program loading zone
216 BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
217 endif
219 BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
220 BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
221 OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
222 OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
224 #########################################################
226 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
227 LIBS+=-lm
228 ifndef CONFIG_USER_ONLY
229 LIBS+=-lz
230 endif
231 ifdef CONFIG_WIN32
232 LIBS+=-lwinmm -lws2_32 -liphlpapi
233 endif
234 ifdef CONFIG_SOLARIS
235 LIBS+=-lsocket -lnsl -lresolv
236 ifdef NEEDS_LIBSUNMATH
237 LIBS+=-lsunmath
238 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
239 OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
240 BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
241 endif
242 endif
244 # profiling code
245 ifdef TARGET_GPROF
246 BASE_LDFLAGS+=-p
247 main.o: BASE_CFLAGS+=-p
248 endif
250 ifdef CONFIG_LINUX_USER
251 OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
252       elfload.o linuxload.o
253 LIBS+= $(AIOLIBS)
254 ifdef TARGET_HAS_BFLT
255 OBJS+= flatload.o
256 endif
258 ifeq ($(TARGET_ARCH), i386)
259 OBJS+= vm86.o
260 endif
261 ifeq ($(TARGET_ARCH), arm)
262 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
263 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
264  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
265 endif
266 ifeq ($(TARGET_ARCH), m68k)
267 OBJS+= m68k-sim.o m68k-semi.o
268 endif
269 endif #CONFIG_LINUX_USER
271 ifdef CONFIG_DARWIN_USER
272 OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
273 endif
275 SRCS:= $(OBJS:.o=.c)
276 OBJS+= libqemu.a
278 # cpu emulator library
279 LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
280         translate.o op.o host-utils.o
281 ifdef CONFIG_SOFTFLOAT
282 LIBOBJS+=fpu/softfloat.o
283 else
284 LIBOBJS+=fpu/softfloat-native.o
285 endif
286 CPPFLAGS+=-I$(SRC_PATH)/fpu
288 ifeq ($(TARGET_ARCH), i386)
289 LIBOBJS+=helper.o helper2.o
290 ifeq ($(ARCH), i386)
291 LIBOBJS+=translate-copy.o
292 endif
293 endif
295 ifeq ($(TARGET_ARCH), x86_64)
296 LIBOBJS+=helper.o helper2.o
297 endif
299 ifeq ($(TARGET_BASE_ARCH), ppc)
300 LIBOBJS+= op_helper.o helper.o
301 endif
303 ifeq ($(TARGET_BASE_ARCH), mips)
304 LIBOBJS+= op_helper.o helper.o
305 endif
307 ifeq ($(TARGET_BASE_ARCH), sparc)
308 LIBOBJS+= op_helper.o helper.o
309 endif
311 ifeq ($(TARGET_BASE_ARCH), arm)
312 LIBOBJS+= op_helper.o helper.o
313 endif
315 ifeq ($(TARGET_BASE_ARCH), sh4)
316 LIBOBJS+= op_helper.o helper.o
317 endif
319 ifeq ($(TARGET_BASE_ARCH), m68k)
320 LIBOBJS+= op_helper.o helper.o
321 endif
323 ifeq ($(TARGET_BASE_ARCH), alpha)
324 LIBOBJS+= op_helper.o helper.o alpha_palcode.o
325 endif
327 # NOTE: the disassembler code is only needed for debugging
328 LIBOBJS+=disas.o
329 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
330 USE_I386_DIS=y
331 endif
332 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
333 USE_I386_DIS=y
334 endif
335 ifdef USE_I386_DIS
336 LIBOBJS+=i386-dis.o
337 endif
338 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
339 LIBOBJS+=alpha-dis.o
340 endif
341 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
342 LIBOBJS+=ppc-dis.o
343 endif
344 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
345 LIBOBJS+=mips-dis.o
346 endif
347 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
348 LIBOBJS+=sparc-dis.o
349 endif
350 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
351 LIBOBJS+=arm-dis.o
352 endif
353 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
354 LIBOBJS+=m68k-dis.o
355 endif
356 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
357 LIBOBJS+=sh4-dis.o
358 endif
359 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
360 LIBOBJS+=s390-dis.o
361 endif
363 ifdef CONFIG_GDBSTUB
364 OBJS+=gdbstub.o
365 endif
367 all: $(PROGS)
369 $(QEMU_USER): $(OBJS)
370         $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
371 ifeq ($(ARCH),alpha)
372 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
373 # the address space (31 bit so sign extending doesn't matter)
374         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
375 endif
377 # must use static linking to avoid leaving stuff in virtual address space
378 VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o loader.o isa_mmio.o
379 VL_OBJS+=cutils.o
380 VL_OBJS+=block.o block-raw.o
381 VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o block-bochs.o block-vpc.o block-vvfat.o block-qcow2.o block-parallels.o
382 VL_OBJS+=irq.o
383 ifdef CONFIG_WIN32
384 VL_OBJS+=tap-win32.o
385 endif
387 SOUND_HW = sb16.o es1370.o
388 AUDIODRV = audio.o noaudio.o wavaudio.o mixeng.o
389 ifdef CONFIG_SDL
390 AUDIODRV += sdlaudio.o
391 endif
392 ifdef CONFIG_OSS
393 AUDIODRV += ossaudio.o
394 endif
395 ifdef CONFIG_COREAUDIO
396 AUDIODRV += coreaudio.o
397 endif
398 ifdef CONFIG_ALSA
399 AUDIODRV += alsaaudio.o
400 LIBS += -lasound
401 endif
402 ifdef CONFIG_DSOUND
403 AUDIODRV += dsoundaudio.o
404 LIBS += -lole32 -ldxguid
405 endif
406 ifdef CONFIG_FMOD
407 AUDIODRV += fmodaudio.o
408 audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
409 LIBS += $(CONFIG_FMOD_LIB)
410 endif
411 ifdef CONFIG_ADLIB
412 SOUND_HW += fmopl.o adlib.o
413 endif
414 AUDIODRV+= wavcapture.o
416 ifdef CONFIG_VNC_TLS
417 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
418 LIBS += $(CONFIG_VNC_TLS_LIBS)
419 endif
421 VL_OBJS += i2c.o smbus.o
423 # SCSI layer
424 VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
426 # USB layer
427 VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
428 VL_OBJS+= usb-wacom.o
430 # EEPROM emulation
431 VL_OBJS += eeprom93xx.o
433 # PCI network cards
434 VL_OBJS += eepro100.o
435 VL_OBJS += ne2000.o
436 VL_OBJS += pcnet.o
437 VL_OBJS += rtl8139.o
439 ifeq ($(TARGET_BASE_ARCH), i386)
440 # Hardware support
441 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
442 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
443 VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
444 VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmport.o vmware_vga.o
445 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
446 endif
447 ifeq ($(TARGET_BASE_ARCH), ppc)
448 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
449 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o pflash_cfi02.o
450 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o
451 VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o ppc405_uc.o ppc405_boards.o
452 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
453 endif
454 ifeq ($(TARGET_BASE_ARCH), mips)
455 VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o
456 VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
457 VL_OBJS+= jazz_led.o
458 VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
459 VL_OBJS+= piix_pci.o smbus_eeprom.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
460 CPPFLAGS += -DHAS_AUDIO
461 endif
462 ifeq ($(TARGET_BASE_ARCH), sparc)
463 ifeq ($(TARGET_ARCH), sparc64)
464 VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
465 VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
466 VL_OBJS+= cirrus_vga.o parallel.o ptimer.o
467 else
468 VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
469 VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
470 VL_OBJS+= cs4231.o ptimer.o
471 endif
472 endif
473 ifeq ($(TARGET_BASE_ARCH), arm)
474 VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
475 VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
476 VL_OBJS+= versatile_pci.o sd.o ptimer.o
477 VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
478 VL_OBJS+= arm-semi.o
479 VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
480 VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o max111x.o max7310.o
481 VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o $(AUDIODRV) wm8750.o
482 VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o palm.o ecc.o
483 CPPFLAGS += -DHAS_AUDIO
484 endif
485 ifeq ($(TARGET_BASE_ARCH), sh4)
486 VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
487 VL_OBJS+= sh_timer.o ptimer.o sh_serial.o
488 endif
489 ifeq ($(TARGET_BASE_ARCH), m68k)
490 VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
491 VL_OBJS+= m68k-semi.o
492 endif
493 ifdef CONFIG_GDBSTUB
494 VL_OBJS+=gdbstub.o
495 endif
496 ifdef CONFIG_SDL
497 VL_OBJS+=sdl.o x_keymap.o
498 endif
499 VL_OBJS+=vnc.o d3des.o
500 ifdef CONFIG_COCOA
501 VL_OBJS+=cocoa.o
502 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
503 ifdef CONFIG_COREAUDIO
504 COCOA_LIBS+=-framework CoreAudio
505 endif
506 endif
507 ifdef CONFIG_SLIRP
508 CPPFLAGS+=-I$(SRC_PATH)/slirp
509 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
510 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
511 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
512 VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
513 endif
515 VL_LDFLAGS=$(VL_OS_LDFLAGS)
516 VL_LIBS=$(AIOLIBS)
517 # specific flags are needed for non soft mmu emulator
518 ifdef CONFIG_STATIC
519 VL_LDFLAGS+=-static
520 endif
521 ifndef CONFIG_SOFTMMU
522 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
523 endif
524 ifndef CONFIG_DARWIN
525 ifndef CONFIG_WIN32
526 ifndef CONFIG_SOLARIS
527 VL_LIBS+=-lutil
528 endif
529 endif
530 endif
531 ifdef TARGET_GPROF
532 vl.o: BASE_CFLAGS+=-p
533 VL_LDFLAGS+=-p
534 endif
536 ifeq ($(ARCH),ia64)
537 VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
538 endif
540 ifeq ($(ARCH),sparc64)
541   VL_LDFLAGS+=-m64
542   ifneq ($(CONFIG_SOLARIS),yes)
543     VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
544   endif
545 endif
547 ifdef CONFIG_WIN32
548 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
549 endif
551 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
552         $(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
554 cocoa.o: cocoa.m
555         $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
557 sdl.o: sdl.c keymaps.c sdl_keysym.h
558         $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
560 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
561         $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
563 sdlaudio.o: sdlaudio.c
564         $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
566 depend: $(SRCS)
567         $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
569 vldepend: $(VL_OBJS:.o=.c)
570         $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
572 # libqemu
574 libqemu.a: $(LIBOBJS)
575         rm -f $@
576         $(AR) rcs $@ $(LIBOBJS)
578 translate.o: translate.c gen-op.h opc.h cpu.h
580 translate-all.o: translate-all.c opc.h cpu.h
582 translate-op.o: translate-all.c op.h opc.h cpu.h
584 op.h: op.o $(DYNGEN)
585         $(DYNGEN) -o $@ $<
587 opc.h: op.o $(DYNGEN)
588         $(DYNGEN) -c -o $@ $<
590 gen-op.h: op.o $(DYNGEN)
591         $(DYNGEN) -g -o $@ $<
593 op.o: op.c
594         $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
596 # HELPER_CFLAGS is used for all the code compiled with static register
597 # variables
598 ifeq ($(TARGET_BASE_ARCH), i386)
599 # XXX: rename helper.c to op_helper.c
600 helper.o: helper.c
601         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
602 else
603 op_helper.o: op_helper.c
604         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
605 endif
607 cpu-exec.o: cpu-exec.c
608         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
610 # Note: this is a workaround. The real fix is to avoid compiling
611 # cpu_signal_handler() in cpu-exec.c.
612 signal.o: signal.c
613         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
615 vga.o: pixel_ops.h
617 tcx.o: pixel_ops.h
619 ifeq ($(TARGET_BASE_ARCH), i386)
620 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
621 endif
623 ifeq ($(TARGET_ARCH), arm)
624 op.o: op.c op_template.h
625 pl110.o: pl110_template.h
626 endif
628 ifeq ($(TARGET_BASE_ARCH), sparc)
629 helper.o: cpu.h exec-all.h
630 op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h exec.h cpu.h
631 op_helper.o: exec.h softmmu_template.h cpu.h
632 translate.o: cpu.h exec-all.h disas.h
633 endif
635 ifeq ($(TARGET_BASE_ARCH), ppc)
636 op.o: op.c op_template.h op_mem.h op_helper.h
637 op_helper.o: op_helper.c mfrom_table.c op_helper_mem.h op_helper.h
638 translate.o: translate.c translate_init.c
639 endif
641 ifeq ($(TARGET_BASE_ARCH), mips)
642 helper.o: cpu.h exec-all.h
643 op.o: op_template.c fop_template.c op_mem.c exec.h cpu.h
644 op_helper.o: op_helper_mem.c exec.h softmmu_template.h cpu.h
645 translate.o: translate_init.c exec-all.h disas.h
646 endif
648 loader.o: loader.c elf_ops.h
650 ifeq ($(TARGET_ARCH), sh4)
651 op.o: op.c op_mem.c cpu.h
652 op_helper.o: op_helper.c exec.h cpu.h
653 helper.o: helper.c exec.h cpu.h
654 sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
655 shix.o: shix.c sh7750_regs.h sh7750_regnames.h
656 sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
657 tc58128.o: tc58128.c
658 endif
660 ifeq ($(TARGET_BASE_ARCH), alpha)
661 op.o: op.c op_template.h op_mem.h
662 op_helper.o: op_helper_mem.h
663 endif
665 $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
667 %.o: %.c
668         $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
670 %.o: %.S
671         $(CC) $(CPPFLAGS) -c -o $@ $<
673 clean:
674         rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
676 install: all
677 ifneq ($(PROGS),)
678         $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
679 endif
681 ifneq ($(wildcard .depend),)
682 include .depend
683 endif
685 ifeq (1, 0)
686 audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
687 fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
688 CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
689 endif