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