fixed ppc64abi32 executable name
[qemu/qemu_0_9_1_stable.git] / Makefile.target
blobacd6cda4ad1989e21f84c81db6ba89b311a8097b
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), ppc64h)
17 TARGET_BASE_ARCH:=ppc
18 endif
19 ifeq ($(TARGET_ARCH), ppcemb)
20 TARGET_BASE_ARCH:=ppc
21 endif
22 ifeq ($(TARGET_ARCH), sparc64)
23 TARGET_BASE_ARCH:=sparc
24 endif
25 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
26 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
27 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MP -DNEED_CPU_H
28 ifdef CONFIG_DARWIN_USER
29 VPATH+=:$(SRC_PATH)/darwin-user
30 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
31 endif
32 ifdef CONFIG_LINUX_USER
33 VPATH+=:$(SRC_PATH)/linux-user
34 ifndef TARGET_ABI_DIR
35   TARGET_ABI_DIR=$(TARGET_ARCH)
36 endif
37 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
38 endif
39 BASE_CFLAGS=
40 BASE_LDFLAGS=
41 #CFLAGS+=-Werror
42 LIBS=
43 HELPER_CFLAGS=$(CFLAGS)
44 DYNGEN=../dyngen$(EXESUF)
45 # user emulator name
46 ifndef TARGET_ARCH2
47 TARGET_ARCH2=$(TARGET_ARCH)
48 endif
49 ifeq ($(TARGET_ARCH),arm)
50   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
51     TARGET_ARCH2=armeb
52   endif
53 endif
54 ifeq ($(TARGET_ARCH),sh4)
55   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
56     TARGET_ARCH2=sh4eb
57   endif
58 endif
59 ifeq ($(TARGET_ARCH),mips)
60   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
61     TARGET_ARCH2=mipsel
62   endif
63 endif
64 ifeq ($(TARGET_ARCH),mipsn32)
65   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
66     TARGET_ARCH2=mipsn32el
67   endif
68 endif
69 ifeq ($(TARGET_ARCH),mips64)
70   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
71     TARGET_ARCH2=mips64el
72   endif
73 endif
74 QEMU_USER=qemu-$(TARGET_ARCH2)
75 # system emulator name
76 ifdef CONFIG_SOFTMMU
77 ifeq ($(TARGET_ARCH), i386)
78 QEMU_SYSTEM=qemu$(EXESUF)
79 else
80 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
81 endif
82 else
83 QEMU_SYSTEM=qemu-fast
84 endif
86 ifdef CONFIG_USER_ONLY
87 PROGS=$(QEMU_USER)
88 else
89 PROGS+=$(QEMU_SYSTEM)
90 ifndef CONFIG_SOFTMMU
91 CONFIG_STATIC=y
92 endif
93 endif # !CONFIG_USER_ONLY
95 ifdef CONFIG_STATIC
96 BASE_LDFLAGS+=-static
97 endif
99 # We require -O2 to avoid the stack setup prologue in EXIT_TB
100 OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
102 # cc-option
103 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
105 cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
106               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
108 OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
109 OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
110 OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
111 OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
112 OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
113 OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
114 OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
115 OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
116 OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
118 ifeq ($(ARCH),i386)
119 HELPER_CFLAGS+=-fomit-frame-pointer
120 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
121 ifdef TARGET_GPROF
122 USE_I386_LD=y
123 endif
124 ifdef CONFIG_STATIC
125 USE_I386_LD=y
126 endif
127 ifdef USE_I386_LD
128 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
129 else
130 ifdef CONFIG_LINUX_USER
131 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
132 # that the kernel ELF loader considers as an executable. I think this
133 # is the simplest way to make it self virtualizable!
134 BASE_LDFLAGS+=-Wl,-shared
135 endif
136 endif
137 endif
139 ifeq ($(ARCH),x86_64)
140   ifneq ($(CONFIG_SOLARIS),yes)
141     BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
142   endif
143 endif
145 ifeq ($(ARCH),ppc)
146 CPPFLAGS+= -D__powerpc__
147 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
148 endif
150 ifeq ($(ARCH),s390)
151 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
152 endif
154 ifeq ($(ARCH),sparc)
155   BASE_CFLAGS+=-ffixed-g2 -ffixed-g3
156   OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
157   ifeq ($(CONFIG_SOLARIS),yes)
158     OP_CFLAGS+=-fno-omit-frame-pointer
159   else
160     BASE_CFLAGS+=-ffixed-g1 -ffixed-g6
161     HELPER_CFLAGS=$(CFLAGS) -ffixed-i0
162     # -static is used to avoid g1/g3 usage by the dynamic linker
163     BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
164   endif
165 endif
167 ifeq ($(ARCH),sparc64)
168   BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
169   OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
170   ifneq ($(CONFIG_SOLARIS),yes)
171     BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
172     OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
173   endif
174 endif
176 ifeq ($(ARCH),alpha)
177 # -msmall-data is not used for OP_CFLAGS because we want two-instruction
178 # relocations for the constant constructions
179 # Ensure there's only a single GP
180 BASE_CFLAGS+=-msmall-data
181 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
182 endif
184 ifeq ($(ARCH),ia64)
185 BASE_CFLAGS+=-mno-sdata
186 OP_CFLAGS+=-mno-sdata
187 BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
188 endif
190 ifeq ($(ARCH),arm)
191 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
192 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
193 endif
195 ifeq ($(ARCH),m68k)
196 OP_CFLAGS+=-fomit-frame-pointer
197 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
198 endif
200 ifeq ($(ARCH),mips)
201 OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
202 ifeq ($(WORDS_BIGENDIAN),yes)
203 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
204 else
205 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
206 endif
207 endif
209 ifeq ($(ARCH),mips64)
210 OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
211 ifeq ($(WORDS_BIGENDIAN),yes)
212 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
213 else
214 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
215 endif
216 endif
218 ifeq ($(CONFIG_DARWIN),yes)
219 LIBS+=-lmx
220 endif
222 ifdef CONFIG_DARWIN_USER
223 # Leave some space for the regular program loading zone
224 BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
225 endif
227 BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
228 BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
229 OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
230 OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
232 #########################################################
234 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
235 LIBS+=-lm
236 ifndef CONFIG_USER_ONLY
237 LIBS+=-lz
238 endif
239 ifdef CONFIG_WIN32
240 LIBS+=-lwinmm -lws2_32 -liphlpapi
241 endif
242 ifdef CONFIG_SOLARIS
243 LIBS+=-lsocket -lnsl -lresolv
244 ifdef NEEDS_LIBSUNMATH
245 LIBS+=-lsunmath
246 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
247 OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
248 BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
249 endif
250 endif
252 # profiling code
253 ifdef TARGET_GPROF
254 BASE_LDFLAGS+=-p
255 main.o: BASE_CFLAGS+=-p
256 endif
258 ifdef CONFIG_LINUX_USER
259 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o osdep.o thunk.o \
260       elfload.o linuxload.o uaccess.o
261 LIBS+= $(AIOLIBS)
262 ifdef TARGET_HAS_BFLT
263 OBJS+= flatload.o
264 endif
265 ifdef TARGET_HAS_ELFLOAD32
266 OBJS+= elfload32.o
267 elfload32.o: elfload.c
268 endif
270 ifeq ($(TARGET_ARCH), i386)
271 OBJS+= vm86.o
272 endif
273 ifeq ($(TARGET_ARCH), arm)
274 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
275 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
276  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
277 endif
278 ifeq ($(TARGET_ARCH), m68k)
279 OBJS+= m68k-sim.o m68k-semi.o
280 endif
281 endif #CONFIG_LINUX_USER
283 ifdef CONFIG_DARWIN_USER
284 OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
285 endif
287 SRCS:= $(OBJS:.o=.c)
288 OBJS+= libqemu.a
290 # cpu emulator library
291 LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
292         translate.o op.o host-utils.o
293 ifdef CONFIG_SOFTFLOAT
294 LIBOBJS+=fpu/softfloat.o
295 else
296 LIBOBJS+=fpu/softfloat-native.o
297 endif
298 CPPFLAGS+=-I$(SRC_PATH)/fpu
300 ifeq ($(TARGET_ARCH), i386)
301 LIBOBJS+=helper.o helper2.o
302 endif
304 ifeq ($(TARGET_ARCH), x86_64)
305 LIBOBJS+=helper.o helper2.o
306 endif
308 ifeq ($(TARGET_BASE_ARCH), ppc)
309 LIBOBJS+= op_helper.o helper.o
310 endif
312 ifeq ($(TARGET_BASE_ARCH), mips)
313 LIBOBJS+= op_helper.o helper.o
314 endif
316 ifeq ($(TARGET_BASE_ARCH), sparc)
317 LIBOBJS+= op_helper.o helper.o
318 endif
320 ifeq ($(TARGET_BASE_ARCH), arm)
321 LIBOBJS+= op_helper.o helper.o
322 endif
324 ifeq ($(TARGET_BASE_ARCH), sh4)
325 LIBOBJS+= op_helper.o helper.o
326 endif
328 ifeq ($(TARGET_BASE_ARCH), m68k)
329 LIBOBJS+= op_helper.o helper.o
330 endif
332 ifeq ($(TARGET_BASE_ARCH), alpha)
333 LIBOBJS+= op_helper.o helper.o alpha_palcode.o
334 endif
336 ifeq ($(TARGET_BASE_ARCH), cris)
337 LIBOBJS+= op_helper.o helper.o
338 LIBOBJS+= cris-dis.o
340 ifndef CONFIG_USER_ONLY
341 LIBOBJS+= mmu.o
342 endif
343 endif
345 # NOTE: the disassembler code is only needed for debugging
346 LIBOBJS+=disas.o
347 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
348 USE_I386_DIS=y
349 endif
350 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
351 USE_I386_DIS=y
352 endif
353 ifdef USE_I386_DIS
354 LIBOBJS+=i386-dis.o
355 endif
356 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
357 LIBOBJS+=alpha-dis.o
358 endif
359 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
360 LIBOBJS+=ppc-dis.o
361 endif
362 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
363 LIBOBJS+=mips-dis.o
364 endif
365 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
366 LIBOBJS+=sparc-dis.o
367 endif
368 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
369 LIBOBJS+=arm-dis.o
370 endif
371 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
372 LIBOBJS+=m68k-dis.o
373 endif
374 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
375 LIBOBJS+=sh4-dis.o
376 endif
377 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
378 LIBOBJS+=s390-dis.o
379 endif
381 ifdef CONFIG_GDBSTUB
382 OBJS+=gdbstub.o
383 endif
385 all: $(PROGS)
387 $(QEMU_USER): $(OBJS)
388         $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
389 ifeq ($(ARCH),alpha)
390 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
391 # the address space (31 bit so sign extending doesn't matter)
392         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
393 endif
395 # must use static linking to avoid leaving stuff in virtual address space
396 VL_OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o
397 # XXX: suppress QEMU_TOOL tests
398 ifdef CONFIG_WIN32
399 VL_OBJS+=block-raw-win32.o
400 else
401 VL_OBJS+=block-raw-posix.o
402 endif
404 ifdef CONFIG_ALSA
405 LIBS += -lasound
406 endif
407 ifdef CONFIG_DSOUND
408 LIBS += -lole32 -ldxguid
409 endif
410 ifdef CONFIG_FMOD
411 LIBS += $(CONFIG_FMOD_LIB)
412 endif
414 SOUND_HW = sb16.o es1370.o
415 ifdef CONFIG_ADLIB
416 SOUND_HW += fmopl.o adlib.o
417 endif
419 ifdef CONFIG_VNC_TLS
420 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
421 LIBS += $(CONFIG_VNC_TLS_LIBS)
422 endif
424 # SCSI layer
425 VL_OBJS+= lsi53c895a.o
427 # USB layer
428 VL_OBJS+= usb-ohci.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
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 vmmouse.o vmport.o vmware_vga.o
445 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
446 endif
447 ifeq ($(TARGET_BASE_ARCH), ppc)
448 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
449 # shared objects
450 VL_OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
451 # PREP target
452 VL_OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
453 VL_OBJS+= prep_pci.o ppc_prep.o
454 # Mac shared devices
455 VL_OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
456 # OldWorld PowerMac
457 VL_OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
458 # NewWorld PowerMac
459 VL_OBJS+= unin_pci.o ppc_chrp.o
460 # PowerPC 4xx boards
461 VL_OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
462 endif
463 ifeq ($(TARGET_BASE_ARCH), mips)
464 VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o
465 VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
466 VL_OBJS+= jazz_led.o
467 VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
468 VL_OBJS+= piix_pci.o parallel.o cirrus_vga.o $(SOUND_HW)
469 VL_OBJS+= mipsnet.o
470 VL_OBJS+= pflash_cfi01.o
471 CPPFLAGS += -DHAS_AUDIO
472 endif
473 ifeq ($(TARGET_BASE_ARCH), cris)
474 VL_OBJS+= etraxfs.o
475 VL_OBJS+= ptimer.o
476 VL_OBJS+= etraxfs_timer.o
477 VL_OBJS+= etraxfs_ser.o
478 endif
479 ifeq ($(TARGET_BASE_ARCH), sparc)
480 ifeq ($(TARGET_ARCH), sparc64)
481 VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
482 VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
483 VL_OBJS+= cirrus_vga.o parallel.o ptimer.o
484 else
485 VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
486 VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
487 VL_OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
488 endif
489 endif
490 ifeq ($(TARGET_BASE_ARCH), arm)
491 VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
492 VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
493 VL_OBJS+= versatile_pci.o ptimer.o
494 VL_OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
495 VL_OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
496 VL_OBJS+= pl061.o
497 VL_OBJS+= arm-semi.o
498 VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
499 VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
500 VL_OBJS+= pflash_cfi01.o gumstix.o
501 VL_OBJS+= spitz.o ide.o serial.o nand.o ecc.o
502 VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o
503 VL_OBJS+= palm.o tsc210x.o
504 VL_OBJS+= mst_fpga.o mainstone.o
505 CPPFLAGS += -DHAS_AUDIO
506 endif
507 ifeq ($(TARGET_BASE_ARCH), sh4)
508 VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
509 VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
510 endif
511 ifeq ($(TARGET_BASE_ARCH), m68k)
512 VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
513 VL_OBJS+= m68k-semi.o dummy_m68k.o
514 endif
515 ifdef CONFIG_GDBSTUB
516 VL_OBJS+=gdbstub.o
517 endif
518 ifdef CONFIG_COCOA
519 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
520 ifdef CONFIG_COREAUDIO
521 COCOA_LIBS+=-framework CoreAudio
522 endif
523 endif
524 ifdef CONFIG_SLIRP
525 CPPFLAGS+=-I$(SRC_PATH)/slirp
526 endif
528 VL_LDFLAGS=$(VL_OS_LDFLAGS)
529 VL_LIBS=$(AIOLIBS)
530 # specific flags are needed for non soft mmu emulator
531 ifdef CONFIG_STATIC
532 VL_LDFLAGS+=-static
533 endif
534 ifndef CONFIG_SOFTMMU
535 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
536 endif
537 ifndef CONFIG_DARWIN
538 ifndef CONFIG_WIN32
539 ifndef CONFIG_SOLARIS
540 VL_LIBS+=-lutil
541 endif
542 endif
543 endif
544 ifdef TARGET_GPROF
545 vl.o: BASE_CFLAGS+=-p
546 VL_LDFLAGS+=-p
547 endif
549 ifeq ($(ARCH),ia64)
550 VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
551 endif
553 ifeq ($(ARCH),sparc64)
554   VL_LDFLAGS+=-m64
555   ifneq ($(CONFIG_SOLARIS),yes)
556     VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
557   endif
558 endif
560 ifeq ($(ARCH),x86_64)
561   VL_LDFLAGS+=-m64
562   ifneq ($(CONFIG_SOLARIS),yes)
563     VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
564   endif
565 endif
567 ifdef CONFIG_WIN32
568 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
569 endif
571 $(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a
572         $(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
574 depend: $(SRCS)
575         $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
577 vldepend: $(VL_OBJS:.o=.c)
578         $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
580 # libqemu
582 libqemu.a: $(LIBOBJS)
583         rm -f $@
584         $(AR) rcs $@ $(LIBOBJS)
586 translate.o: translate.c gen-op.h opc.h cpu.h
588 translate-all.o: translate-all.c opc.h cpu.h
590 translate-op.o: translate-all.c op.h opc.h cpu.h
592 op.h: op.o $(DYNGEN)
593         $(DYNGEN) -o $@ $<
595 opc.h: op.o $(DYNGEN)
596         $(DYNGEN) -c -o $@ $<
598 gen-op.h: op.o $(DYNGEN)
599         $(DYNGEN) -g -o $@ $<
601 op.o: op.c
602         $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
604 # HELPER_CFLAGS is used for all the code compiled with static register
605 # variables
606 ifeq ($(TARGET_BASE_ARCH), i386)
607 # XXX: rename helper.c to op_helper.c
608 helper.o: helper.c
609         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
610 else
611 op_helper.o: op_helper.c
612         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
613 endif
615 cpu-exec.o: cpu-exec.c
616         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
618 # Note: this is a workaround. The real fix is to avoid compiling
619 # cpu_signal_handler() in cpu-exec.c.
620 signal.o: signal.c
621         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
623 %.o: %.c
624         $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626 %.o: %.S
627         $(CC) $(CPPFLAGS) -c -o $@ $<
629 clean:
630         rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o fpu/*.o
631         rm -f *.d */*.d
633 install: all
634 ifneq ($(PROGS),)
635         $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
636 endif
638 ifneq ($(wildcard .depend),)
639 include .depend
640 endif
642 ifeq (1, 0)
643 audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
644 fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
645 CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
646 endif
648 # Include automatically generated dependency files
649 -include $(wildcard *.d */*.d)