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