]> git.proxmox.com Git - qemu.git/blame - Makefile.target
Generate double and triple faults, by Bernhard Kauer.
[qemu.git] / Makefile.target
CommitLineData
626df76a
FB
1include config.mak
2
0b0babc6
FB
3TARGET_BASE_ARCH:=$(TARGET_ARCH)
4ifeq ($(TARGET_ARCH), x86_64)
5TARGET_BASE_ARCH:=i386
6endif
a2458627
FB
7ifeq ($(TARGET_ARCH), ppc64)
8TARGET_BASE_ARCH:=ppc
9endif
64b3ab24
FB
10ifeq ($(TARGET_ARCH), sparc64)
11TARGET_BASE_ARCH:=sparc
12endif
0b0babc6 13TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
85571bc7 14VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
6f30fa85 15CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
831b7825
TS
16ifdef CONFIG_DARWIN_USER
17VPATH+=:$(SRC_PATH)/darwin-user
18CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
19endif
20ifdef CONFIG_LINUX_USER
3035f7ff 21VPATH+=:$(SRC_PATH)/linux-user
6f30fa85 22CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
3035f7ff 23endif
6f30fa85
TS
24BASE_CFLAGS=
25BASE_LDFLAGS=
0b0babc6 26#CFLAGS+=-Werror
626df76a 27LIBS=
626df76a 28HELPER_CFLAGS=$(CFLAGS)
67b915a5 29DYNGEN=../dyngen$(EXESUF)
1e43adfc 30# user emulator name
c91fde65 31TARGET_ARCH2=$(TARGET_ARCH)
808c4954
FB
32ifeq ($(TARGET_ARCH),arm)
33 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
c91fde65 34 TARGET_ARCH2=armeb
808c4954 35 endif
c91fde65 36endif
908f52b0
PB
37ifeq ($(TARGET_ARCH),sh4)
38 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
39 TARGET_ARCH2=sh4eb
40 endif
41endif
01f5e596 42ifeq ($(TARGET_ARCH),mips)
c91fde65
FB
43 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
44 TARGET_ARCH2=mipsel
01f5e596 45 endif
01f5e596 46endif
c91fde65 47QEMU_USER=qemu-$(TARGET_ARCH2)
1e43adfc
FB
48# system emulator name
49ifdef CONFIG_SOFTMMU
a541f297 50ifeq ($(TARGET_ARCH), i386)
67b915a5 51QEMU_SYSTEM=qemu$(EXESUF)
0db63474 52else
c91fde65 53QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
a541f297
FB
54endif
55else
0db63474 56QEMU_SYSTEM=qemu-fast
1e43adfc
FB
57endif
58
16e9b7de 59ifdef CONFIG_USER_ONLY
1e43adfc 60PROGS=$(QEMU_USER)
16e9b7de 61else
c321f673 62PROGS+=$(QEMU_SYSTEM)
de5eaa64
FB
63ifndef CONFIG_SOFTMMU
64CONFIG_STATIC=y
65endif
728c9fd5 66endif # !CONFIG_USER_ONLY
626df76a
FB
67
68ifdef CONFIG_STATIC
6f30fa85 69BASE_LDFLAGS+=-static
626df76a
FB
70endif
71
6f30fa85 72# We require -O2 to avoid the stack setup prologue in EXIT_TB
6c041c54
TS
73OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
74
75# cc-option
76# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
77
78cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
79 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
80
81OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
82OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
83OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
84OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
85OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
86OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
87OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
88OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
6f30fa85 89
626df76a 90ifeq ($(ARCH),i386)
6f30fa85
TS
91HELPER_CFLAGS+=-fomit-frame-pointer
92OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
626df76a 93ifdef TARGET_GPROF
3a4739d6
FB
94USE_I386_LD=y
95endif
96ifdef CONFIG_STATIC
97USE_I386_LD=y
98endif
99ifdef USE_I386_LD
6f30fa85 100BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a 101else
831b7825 102ifdef CONFIG_LINUX_USER
626df76a
FB
103# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
104# that the kernel ELF loader considers as an executable. I think this
105# is the simplest way to make it self virtualizable!
6f30fa85 106BASE_LDFLAGS+=-Wl,-shared
626df76a 107endif
626df76a 108endif
831b7825 109endif
626df76a 110
0b0babc6 111ifeq ($(ARCH),x86_64)
6f30fa85 112BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
bc51c5c9
FB
113endif
114
626df76a 115ifeq ($(ARCH),ppc)
6f30fa85 116CPPFLAGS+= -D__powerpc__
831b7825 117ifdef CONFIG_LINUX_USER
6f30fa85 118BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a 119endif
831b7825 120endif
626df76a
FB
121
122ifeq ($(ARCH),s390)
6f30fa85 123BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a
FB
124endif
125
126ifeq ($(ARCH),sparc)
fdbb4691 127ifeq ($(CONFIG_SOLARIS),yes)
6f30fa85
TS
128BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
129BASE_LDFLAGS+=-m32
130OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
fdbb4691 131else
6f30fa85
TS
132BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
133BASE_LDFLAGS+=-m32
134OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
626df76a
FB
135HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
136# -static is used to avoid g1/g3 usage by the dynamic linker
6f30fa85 137BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
626df76a 138endif
fdbb4691 139endif
626df76a
FB
140
141ifeq ($(ARCH),sparc64)
6f30fa85
TS
142BASE_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
143BASE_LDFLAGS+=-m64
144BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
145OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
626df76a
FB
146endif
147
148ifeq ($(ARCH),alpha)
6f30fa85
TS
149# -msmall-data is not used for OP_CFLAGS because we want two-instruction
150# relocations for the constant constructions
626df76a 151# Ensure there's only a single GP
6f30fa85
TS
152BASE_CFLAGS+=-msmall-data
153BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a
FB
154endif
155
156ifeq ($(ARCH),ia64)
6f30fa85
TS
157BASE_CFLAGS+=-mno-sdata
158OP_CFLAGS+=-mno-sdata
159BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a
FB
160endif
161
162ifeq ($(ARCH),arm)
6f30fa85
TS
163OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
164BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a
FB
165endif
166
38e584a0 167ifeq ($(ARCH),m68k)
6f30fa85
TS
168OP_CFLAGS+=-fomit-frame-pointer
169BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
170endif
171
172ifeq ($(ARCH),mips)
173BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
38e584a0
FB
174endif
175
83fb7adf 176ifeq ($(CONFIG_DARWIN),yes)
e80cfcfc 177LIBS+=-lmx
83fb7adf
FB
178endif
179
01feaa05
TS
180ifdef CONFIG_DARWIN_USER
181# Leave some space for the regular program loading zone
182BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
183endif
184
ea785922 185BASE_CFLAGS+=$(OS_CFLAGS)
6f30fa85
TS
186OP_CFLAGS+=$(OS_CFLAGS)
187
626df76a
FB
188#########################################################
189
6f30fa85 190CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
626df76a 191LIBS+=-lm
b932caba
FB
192ifndef CONFIG_USER_ONLY
193LIBS+=-lz
194endif
67b915a5 195ifdef CONFIG_WIN32
3db38e87 196LIBS+=-lwinmm -lws2_32 -liphlpapi
67b915a5 197endif
ec530c81
FB
198ifdef CONFIG_SOLARIS
199LIBS+=-lsocket -lnsl -lresolv
200endif
626df76a
FB
201
202# profiling code
203ifdef TARGET_GPROF
6f30fa85
TS
204BASE_LDFLAGS+=-p
205main.o: BASE_CFLAGS+=-p
626df76a
FB
206endif
207
831b7825 208ifdef CONFIG_LINUX_USER
e5fe0c52
PB
209OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
210 elfload.o linuxload.o
b5906f95 211LIBS+= $(AIOLIBS)
e5fe0c52
PB
212ifdef TARGET_HAS_BFLT
213OBJS+= flatload.o
214endif
215
626df76a
FB
216ifeq ($(TARGET_ARCH), i386)
217OBJS+= vm86.o
218endif
f72b519c 219ifeq ($(TARGET_ARCH), arm)
158142c2 220OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
f72b519c 221nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
a4f81979 222 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
f72b519c 223endif
e6e5906b
PB
224ifeq ($(TARGET_ARCH), m68k)
225OBJS+= m68k-sim.o m68k-semi.o
226endif
831b7825
TS
227endif #CONFIG_LINUX_USER
228
229ifdef CONFIG_DARWIN_USER
230OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
231endif
232
626df76a
FB
233SRCS:= $(OBJS:.o=.c)
234OBJS+= libqemu.a
235
236# cpu emulator library
158142c2 237LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
e3086fbf 238 translate.o op.o
158142c2
FB
239ifdef CONFIG_SOFTFLOAT
240LIBOBJS+=fpu/softfloat.o
241else
242LIBOBJS+=fpu/softfloat-native.o
243endif
6f30fa85 244CPPFLAGS+=-I$(SRC_PATH)/fpu
626df76a
FB
245
246ifeq ($(TARGET_ARCH), i386)
1e43adfc 247LIBOBJS+=helper.o helper2.o
f72b519c
FB
248ifeq ($(ARCH), i386)
249LIBOBJS+=translate-copy.o
250endif
626df76a
FB
251endif
252
0b0babc6
FB
253ifeq ($(TARGET_ARCH), x86_64)
254LIBOBJS+=helper.o helper2.o
255endif
256
a2458627 257ifeq ($(TARGET_BASE_ARCH), ppc)
728c9fd5 258LIBOBJS+= op_helper.o helper.o
67867308
FB
259endif
260
6af0bf9c
FB
261ifeq ($(TARGET_ARCH), mips)
262LIBOBJS+= op_helper.o helper.o
263endif
264
64b3ab24 265ifeq ($(TARGET_BASE_ARCH), sparc)
e95c8d51
FB
266LIBOBJS+= op_helper.o helper.o
267endif
268
b7bcbe95 269ifeq ($(TARGET_BASE_ARCH), arm)
b5ff1b31 270LIBOBJS+= op_helper.o helper.o
b7bcbe95
FB
271endif
272
fdf9b3e8
FB
273ifeq ($(TARGET_BASE_ARCH), sh4)
274LIBOBJS+= op_helper.o helper.o
275endif
276
e6e5906b
PB
277ifeq ($(TARGET_BASE_ARCH), m68k)
278LIBOBJS+= helper.o
279endif
280
626df76a
FB
281# NOTE: the disassembler code is only needed for debugging
282LIBOBJS+=disas.o
283ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bc51c5c9
FB
284USE_I386_DIS=y
285endif
0b0babc6 286ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
bc51c5c9
FB
287USE_I386_DIS=y
288endif
289ifdef USE_I386_DIS
626df76a
FB
290LIBOBJS+=i386-dis.o
291endif
292ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
293LIBOBJS+=alpha-dis.o
294endif
a2458627 295ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
626df76a
FB
296LIBOBJS+=ppc-dis.o
297endif
6af0bf9c
FB
298ifeq ($(findstring mips, $(TARGET_ARCH) $(ARCH)),mips)
299LIBOBJS+=mips-dis.o
300endif
64b3ab24 301ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
626df76a
FB
302LIBOBJS+=sparc-dis.o
303endif
304ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
305LIBOBJS+=arm-dis.o
306endif
48024e4a
FB
307ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
308LIBOBJS+=m68k-dis.o
309endif
fdf9b3e8
FB
310ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
311LIBOBJS+=sh4-dis.o
312endif
626df76a 313
1fddef4b
FB
314ifdef CONFIG_GDBSTUB
315OBJS+=gdbstub.o
316endif
626df76a 317
1e43adfc 318all: $(PROGS)
626df76a 319
1e43adfc 320$(QEMU_USER): $(OBJS)
6f30fa85 321 $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ $(LIBS)
626df76a
FB
322ifeq ($(ARCH),alpha)
323# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
324# the address space (31 bit so sign extending doesn't matter)
325 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
326endif
327
328# must use static linking to avoid leaving stuff in virtual address space
aef445bd 329VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o loader.o isa_mmio.o
18607dcb 330VL_OBJS+=cutils.o
83f64091 331VL_OBJS+=block.o block-raw.o
42ca6388 332VL_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
7fb843f8
FB
333ifdef CONFIG_WIN32
334VL_OBJS+=tap-win32.o
335endif
a541f297 336
1d14ffa9 337SOUND_HW = sb16.o es1370.o
7372f88d 338AUDIODRV = audio.o noaudio.o wavaudio.o
fb065187
FB
339ifdef CONFIG_SDL
340AUDIODRV += sdlaudio.o
341endif
342ifdef CONFIG_OSS
343AUDIODRV += ossaudio.o
344endif
1d14ffa9
FB
345ifdef CONFIG_COREAUDIO
346AUDIODRV += coreaudio.o
347endif
348ifdef CONFIG_ALSA
349AUDIODRV += alsaaudio.o
350LIBS += -lasound
351endif
352ifdef CONFIG_DSOUND
353AUDIODRV += dsoundaudio.o
354LIBS += -lole32 -ldxguid
85571bc7 355endif
102a52e4 356ifdef CONFIG_FMOD
85571bc7 357AUDIODRV += fmodaudio.o
6f30fa85 358audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
102a52e4 359LIBS += $(CONFIG_FMOD_LIB)
85571bc7 360endif
1d14ffa9
FB
361ifdef CONFIG_ADLIB
362SOUND_HW += fmopl.o adlib.o
363endif
ec36b695 364AUDIODRV+= wavcapture.o
85571bc7 365
2e5d83bb 366# SCSI layer
7d8406be 367VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
2e5d83bb 368
a594cfbf 369# USB layer
2e5d83bb 370VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
a594cfbf 371
a41b2ff2 372# PCI network cards
e3c2613f 373VL_OBJS+= ne2000.o rtl8139.o pcnet.o
a41b2ff2 374
0b0babc6 375ifeq ($(TARGET_BASE_ARCH), i386)
a541f297 376# Hardware support
a41b2ff2 377VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
fd06c375 378VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
502a5395 379VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
548df2ac 380VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o
6f30fa85 381CPPFLAGS += -DHAS_AUDIO
67b915a5 382endif
a2458627 383ifeq ($(TARGET_BASE_ARCH), ppc)
a41b2ff2 384VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
64201201 385VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
e68b9b2b 386VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
502a5395 387VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
6f30fa85 388CPPFLAGS += -DHAS_AUDIO
a541f297 389endif
6af0bf9c 390ifeq ($(TARGET_ARCH), mips)
4de9b249 391VL_OBJS+= mips_r4k.o mips_malta.o mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
9542611a 392VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
5856de80
TS
393VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
394DEFINES += -DHAS_AUDIO
6af0bf9c 395endif
64b3ab24 396ifeq ($(TARGET_BASE_ARCH), sparc)
3475187d 397ifeq ($(TARGET_ARCH), sparc64)
502a5395 398VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
83469015
FB
399VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
400VL_OBJS+= cirrus_vga.o parallel.o
3475187d 401else
67e999be
FB
402VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
403VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
b8174937 404VL_OBJS+= cs4231.o
3475187d 405endif
e95c8d51 406endif
b5ff1b31 407ifeq ($(TARGET_BASE_ARCH), arm)
cdbdb648 408VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
16406950 409VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl190.o
502a5395 410VL_OBJS+= versatile_pci.o
e69954b9 411VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
8e71621f 412VL_OBJS+= arm-semi.o
b5ff1b31 413endif
fdf9b3e8
FB
414ifeq ($(TARGET_BASE_ARCH), sh4)
415VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
416endif
a541f297
FB
417ifdef CONFIG_GDBSTUB
418VL_OBJS+=gdbstub.o
728c9fd5 419endif
626df76a 420ifdef CONFIG_SDL
6070dd07 421VL_OBJS+=sdl.o x_keymap.o
de5eaa64 422endif
24236869 423VL_OBJS+=vnc.o
5b0753e0
FB
424ifdef CONFIG_COCOA
425VL_OBJS+=cocoa.o
1d14ffa9
FB
426COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
427ifdef CONFIG_COREAUDIO
428COCOA_LIBS+=-framework CoreAudio
429endif
5b0753e0 430endif
7c1f25b4 431ifdef CONFIG_SLIRP
6f30fa85 432CPPFLAGS+=-I$(SRC_PATH)/slirp
7c1f25b4
FB
433SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
434slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
c7f74643 435tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
7c1f25b4 436VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
626df76a
FB
437endif
438
c321f673 439VL_LDFLAGS=
70956b77 440VL_LIBS=$(AIOLIBS)
c321f673 441# specific flags are needed for non soft mmu emulator
c321f673
FB
442ifdef CONFIG_STATIC
443VL_LDFLAGS+=-static
444endif
de5eaa64
FB
445ifndef CONFIG_SOFTMMU
446VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
447endif
83fb7adf 448ifndef CONFIG_DARWIN
11d9f695 449ifndef CONFIG_WIN32
ec530c81 450ifndef CONFIG_SOLARIS
70956b77 451VL_LIBS+=-lutil
11d9f695 452endif
83fb7adf 453endif
ec530c81 454endif
e3086fbf 455ifdef TARGET_GPROF
6f30fa85 456vl.o: BASE_CFLAGS+=-p
e3086fbf
FB
457VL_LDFLAGS+=-p
458endif
c321f673 459
b8076a74
FB
460ifeq ($(ARCH),ia64)
461VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
462endif
463
74ccb34e
FB
464ifeq ($(ARCH),sparc64)
465VL_LDFLAGS+=-m64
466VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
467endif
468
1d14ffa9
FB
469ifdef CONFIG_WIN32
470SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
471endif
472
1e43adfc 473$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
3a11702b 474 $(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
5b0753e0
FB
475
476cocoa.o: cocoa.m
6f30fa85 477 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626df76a 478
3d11d0eb 479sdl.o: sdl.c keymaps.c sdl_keysym.h
6f30fa85 480 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626df76a 481
24236869 482vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
6f30fa85 483 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
24236869 484
9f059eca 485sdlaudio.o: sdlaudio.c
6f30fa85 486 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
9f059eca 487
626df76a 488depend: $(SRCS)
6f30fa85 489 $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
626df76a 490
1d14ffa9 491vldepend: $(VL_OBJS:.o=.c)
6f30fa85 492 $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
1d14ffa9 493
626df76a
FB
494# libqemu
495
496libqemu.a: $(LIBOBJS)
497 rm -f $@
498 $(AR) rcs $@ $(LIBOBJS)
499
1e43adfc 500translate.o: translate.c gen-op.h opc.h cpu.h
626df76a 501
158142c2
FB
502translate-all.o: translate-all.c opc.h cpu.h
503
504translate-op.o: translate-all.c op.h opc.h cpu.h
626df76a 505
1e43adfc 506op.h: op.o $(DYNGEN)
626df76a
FB
507 $(DYNGEN) -o $@ $<
508
1e43adfc 509opc.h: op.o $(DYNGEN)
626df76a
FB
510 $(DYNGEN) -c -o $@ $<
511
1e43adfc 512gen-op.h: op.o $(DYNGEN)
626df76a
FB
513 $(DYNGEN) -g -o $@ $<
514
1e43adfc 515op.o: op.c
6f30fa85 516 $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
626df76a 517
6e1b3e4d
FB
518# HELPER_CFLAGS is used for all the code compiled with static register
519# variables
520ifeq ($(TARGET_BASE_ARCH), i386)
521# XXX: rename helper.c to op_helper.c
1e43adfc 522helper.o: helper.c
6f30fa85 523 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
6e1b3e4d
FB
524else
525op_helper.o: op_helper.c
6f30fa85 526 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
6e1b3e4d
FB
527endif
528
529cpu-exec.o: cpu-exec.c
6f30fa85 530 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626df76a 531
00a67ba1
FB
532# Note: this is a workaround. The real fix is to avoid compiling
533# cpu_signal_handler() in cpu-exec.c.
534signal.o: signal.c
6f30fa85 535 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
00a67ba1 536
0b0babc6 537ifeq ($(TARGET_BASE_ARCH), i386)
664e0f19 538op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
1e43adfc
FB
539endif
540
541ifeq ($(TARGET_ARCH), arm)
542op.o: op.c op_template.h
bdd5003a 543pl110.o: pl110_template.h
1e43adfc 544endif
626df76a 545
64b3ab24 546ifeq ($(TARGET_BASE_ARCH), sparc)
3475187d
FB
547op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
548magic_load.o: elf_op.h
1e43adfc 549endif
626df76a 550
a2458627 551ifeq ($(TARGET_BASE_ARCH), ppc)
728c9fd5
FB
552op.o: op.c op_template.h op_mem.h
553op_helper.o: op_helper_mem.h
3fc6c082 554translate.o: translate.c translate_init.c
728c9fd5
FB
555endif
556
6af0bf9c 557ifeq ($(TARGET_ARCH), mips)
c281868e 558op.o: op.c op_template.c fop_template.c op_mem.c
6af0bf9c 559op_helper.o: op_helper_mem.c
33d68b5f 560translate.o: translate.c translate_init.c
6af0bf9c
FB
561endif
562
5fe141fd
FB
563loader.o: loader.c elf_ops.h
564
fdf9b3e8
FB
565ifeq ($(TARGET_ARCH), sh4)
566op.o: op.c op_mem.c cpu.h
567op_helper.o: op_helper.c exec.h cpu.h
568helper.o: helper.c exec.h cpu.h
27c7ca7e
FB
569sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
570shix.o: shix.c sh7750_regs.h sh7750_regnames.h
fdf9b3e8 571sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
27c7ca7e 572tc58128.o: tc58128.c
fdf9b3e8
FB
573endif
574
214feb51
PB
575$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
576
626df76a 577%.o: %.c
6f30fa85 578 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626df76a 579
f72b519c 580%.o: %.S
6f30fa85 581 $(CC) $(CPPFLAGS) -c -o $@ $<
f72b519c 582
626df76a 583clean:
e362b55a 584 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
1e43adfc
FB
585
586install: all
9b14bb04 587ifneq ($(PROGS),)
6a882643 588 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
9b14bb04 589endif
626df76a
FB
590
591ifneq ($(wildcard .depend),)
592include .depend
593endif
1d14ffa9 594
c0fe3827 595ifeq (1, 0)
1d14ffa9 596audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
c0fe3827 597fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
1d14ffa9
FB
598CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
599endif