Statistics
| Branch: | Revision:

root / Makefile.target @ 4e9f8537

History | View | Annotate | Download (17.9 kB)

1
include config.mak
2

    
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
77

    
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
86

    
87
ifdef CONFIG_STATIC
88
BASE_LDFLAGS+=-static
89
endif
90

    
91
# We require -O2 to avoid the stack setup prologue in EXIT_TB
92
OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
93

    
94
# cc-option
95
# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
96

    
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 ;)
99

    
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, "")
109

    
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
130

    
131
ifeq ($(ARCH),x86_64)
132
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
133
endif
134

    
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
141

    
142
ifeq ($(ARCH),s390)
143
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
144
endif
145

    
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
158

    
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
167

    
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
175

    
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
181

    
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
186

    
187
ifeq ($(ARCH),m68k)
188
OP_CFLAGS+=-fomit-frame-pointer
189
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
190
endif
191

    
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
200

    
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
209

    
210
ifeq ($(CONFIG_DARWIN),yes)
211
LIBS+=-lmx
212
endif
213

    
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
218

    
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)
223

    
224
#########################################################
225

    
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
243

    
244
# profiling code
245
ifdef TARGET_GPROF
246
BASE_LDFLAGS+=-p
247
main.o: BASE_CFLAGS+=-p
248
endif
249

    
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
257

    
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
270

    
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
274

    
275
SRCS:= $(OBJS:.o=.c)
276
OBJS+= libqemu.a
277

    
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
287

    
288
ifeq ($(TARGET_ARCH), i386)
289
LIBOBJS+=helper.o helper2.o
290
ifeq ($(ARCH), i386)
291
LIBOBJS+=translate-copy.o
292
endif
293
endif
294

    
295
ifeq ($(TARGET_ARCH), x86_64)
296
LIBOBJS+=helper.o helper2.o
297
endif
298

    
299
ifeq ($(TARGET_BASE_ARCH), ppc)
300
LIBOBJS+= op_helper.o helper.o
301
endif
302

    
303
ifeq ($(TARGET_BASE_ARCH), mips)
304
LIBOBJS+= op_helper.o helper.o
305
endif
306

    
307
ifeq ($(TARGET_BASE_ARCH), sparc)
308
LIBOBJS+= op_helper.o helper.o
309
endif
310

    
311
ifeq ($(TARGET_BASE_ARCH), arm)
312
LIBOBJS+= op_helper.o helper.o
313
endif
314

    
315
ifeq ($(TARGET_BASE_ARCH), sh4)
316
LIBOBJS+= op_helper.o helper.o
317
endif
318

    
319
ifeq ($(TARGET_BASE_ARCH), m68k)
320
LIBOBJS+= op_helper.o helper.o
321
endif
322

    
323
ifeq ($(TARGET_BASE_ARCH), alpha)
324
LIBOBJS+= op_helper.o helper.o alpha_palcode.o
325
endif
326

    
327
ifeq ($(TARGET_BASE_ARCH), cris)
328
LIBOBJS+= op_helper.o helper.o
329
LIBOBJS+= cris-dis.o
330

    
331
ifndef CONFIG_USER_ONLY
332
LIBOBJS+= mmu.o
333
endif
334
endif
335

    
336
# NOTE: the disassembler code is only needed for debugging
337
LIBOBJS+=disas.o
338
ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
339
USE_I386_DIS=y
340
endif
341
ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
342
USE_I386_DIS=y
343
endif
344
ifdef USE_I386_DIS
345
LIBOBJS+=i386-dis.o
346
endif
347
ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
348
LIBOBJS+=alpha-dis.o
349
endif
350
ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
351
LIBOBJS+=ppc-dis.o
352
endif
353
ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
354
LIBOBJS+=mips-dis.o
355
endif
356
ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
357
LIBOBJS+=sparc-dis.o
358
endif
359
ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
360
LIBOBJS+=arm-dis.o
361
endif
362
ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
363
LIBOBJS+=m68k-dis.o
364
endif
365
ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
366
LIBOBJS+=sh4-dis.o
367
endif
368
ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
369
LIBOBJS+=s390-dis.o
370
endif
371

    
372
ifdef CONFIG_GDBSTUB
373
OBJS+=gdbstub.o
374
endif
375

    
376
all: $(PROGS)
377

    
378
$(QEMU_USER): $(OBJS)
379
	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
380
ifeq ($(ARCH),alpha)
381
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
382
# the address space (31 bit so sign extending doesn't matter)
383
	echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
384
endif
385

    
386
# must use static linking to avoid leaving stuff in virtual address space
387
VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o loader.o isa_mmio.o
388
VL_OBJS+=cutils.o
389
VL_OBJS+=block.o block-raw.o
390
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
391
VL_OBJS+=irq.o
392
ifdef CONFIG_WIN32
393
VL_OBJS+=tap-win32.o
394
endif
395

    
396
SOUND_HW = sb16.o es1370.o
397
AUDIODRV = audio.o noaudio.o wavaudio.o mixeng.o
398
ifdef CONFIG_SDL
399
AUDIODRV += sdlaudio.o
400
endif
401
ifdef CONFIG_OSS
402
AUDIODRV += ossaudio.o
403
endif
404
ifdef CONFIG_COREAUDIO
405
AUDIODRV += coreaudio.o
406
endif
407
ifdef CONFIG_ALSA
408
AUDIODRV += alsaaudio.o
409
LIBS += -lasound
410
endif
411
ifdef CONFIG_DSOUND
412
AUDIODRV += dsoundaudio.o
413
LIBS += -lole32 -ldxguid
414
endif
415
ifdef CONFIG_FMOD
416
AUDIODRV += fmodaudio.o
417
audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
418
LIBS += $(CONFIG_FMOD_LIB)
419
endif
420
ifdef CONFIG_ADLIB
421
SOUND_HW += fmopl.o adlib.o
422
endif
423
AUDIODRV+= wavcapture.o
424

    
425
ifdef CONFIG_VNC_TLS
426
CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
427
LIBS += $(CONFIG_VNC_TLS_LIBS)
428
endif
429

    
430
VL_OBJS += i2c.o smbus.o
431

    
432
# SCSI layer
433
VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
434

    
435
# USB layer
436
VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
437
VL_OBJS+= usb-wacom.o
438

    
439
# EEPROM emulation
440
VL_OBJS += eeprom93xx.o
441

    
442
# PCI network cards
443
VL_OBJS += eepro100.o
444
VL_OBJS += ne2000.o
445
VL_OBJS += pcnet.o
446
VL_OBJS += rtl8139.o
447

    
448
ifeq ($(TARGET_BASE_ARCH), i386)
449
# Hardware support
450
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
451
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
452
VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
453
VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmport.o vmware_vga.o
454
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
455
endif
456
ifeq ($(TARGET_BASE_ARCH), ppc)
457
VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
458
VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o pflash_cfi02.o
459
VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o
460
VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
461
# PowerPC 4xx boards
462
VL_OBJS+= ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
463
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
464
endif
465
ifeq ($(TARGET_BASE_ARCH), mips)
466
VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o
467
VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
468
VL_OBJS+= jazz_led.o
469
VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
470
VL_OBJS+= piix_pci.o smbus_eeprom.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
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
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 sd.o ptimer.o
494
VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
495
VL_OBJS+= arm-semi.o
496
VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
497
VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o max111x.o max7310.o
498
VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o $(AUDIODRV) wm8750.o
499
VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o palm.o ecc.o
500
CPPFLAGS += -DHAS_AUDIO
501
endif
502
ifeq ($(TARGET_BASE_ARCH), sh4)
503
VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
504
VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
505
endif
506
ifeq ($(TARGET_BASE_ARCH), m68k)
507
VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
508
VL_OBJS+= m68k-semi.o
509
endif
510
ifdef CONFIG_GDBSTUB
511
VL_OBJS+=gdbstub.o
512
endif
513
ifdef CONFIG_SDL
514
VL_OBJS+=sdl.o x_keymap.o
515
endif
516
VL_OBJS+=vnc.o d3des.o
517
ifdef CONFIG_COCOA
518
VL_OBJS+=cocoa.o
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
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
527
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
528
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
529
VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
530
endif
531

    
532
VL_LDFLAGS=$(VL_OS_LDFLAGS)
533
VL_LIBS=$(AIOLIBS)
534
# specific flags are needed for non soft mmu emulator
535
ifdef CONFIG_STATIC
536
VL_LDFLAGS+=-static
537
endif
538
ifndef CONFIG_SOFTMMU
539
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
540
endif
541
ifndef CONFIG_DARWIN
542
ifndef CONFIG_WIN32
543
ifndef CONFIG_SOLARIS
544
VL_LIBS+=-lutil
545
endif
546
endif
547
endif
548
ifdef TARGET_GPROF
549
vl.o: BASE_CFLAGS+=-p
550
VL_LDFLAGS+=-p
551
endif
552

    
553
ifeq ($(ARCH),ia64)
554
VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
555
endif
556

    
557
ifeq ($(ARCH),sparc64)
558
  VL_LDFLAGS+=-m64
559
  ifneq ($(CONFIG_SOLARIS),yes)
560
    VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
561
  endif
562
endif
563

    
564
ifdef CONFIG_WIN32
565
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
566
endif
567

    
568
$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
569
	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
570

    
571
cocoa.o: cocoa.m
572
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
573

    
574
sdl.o: sdl.c keymaps.c sdl_keysym.h
575
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
576

    
577
vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
578
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
579

    
580
sdlaudio.o: sdlaudio.c
581
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
582

    
583
depend: $(SRCS)
584
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
585

    
586
vldepend: $(VL_OBJS:.o=.c)
587
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
588

    
589
# libqemu
590

    
591
libqemu.a: $(LIBOBJS)
592
	rm -f $@
593
	$(AR) rcs $@ $(LIBOBJS)
594

    
595
translate.o: translate.c gen-op.h opc.h cpu.h
596

    
597
translate-all.o: translate-all.c opc.h cpu.h
598

    
599
translate-op.o: translate-all.c op.h opc.h cpu.h
600

    
601
op.h: op.o $(DYNGEN)
602
	$(DYNGEN) -o $@ $<
603

    
604
opc.h: op.o $(DYNGEN)
605
	$(DYNGEN) -c -o $@ $<
606

    
607
gen-op.h: op.o $(DYNGEN)
608
	$(DYNGEN) -g -o $@ $<
609

    
610
op.o: op.c
611
	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
612

    
613
# HELPER_CFLAGS is used for all the code compiled with static register
614
# variables
615
ifeq ($(TARGET_BASE_ARCH), i386)
616
# XXX: rename helper.c to op_helper.c
617
helper.o: helper.c
618
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
619
else
620
op_helper.o: op_helper.c
621
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
622
endif
623

    
624
cpu-exec.o: cpu-exec.c
625
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626

    
627
# Note: this is a workaround. The real fix is to avoid compiling
628
# cpu_signal_handler() in cpu-exec.c.
629
signal.o: signal.c
630
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
631

    
632
vga.o: pixel_ops.h
633

    
634
tcx.o: pixel_ops.h
635

    
636
ifeq ($(TARGET_BASE_ARCH), i386)
637
op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
638
endif
639

    
640
ifeq ($(TARGET_ARCH), arm)
641
op.o: op.c op_template.h
642
pl110.o: pl110_template.h
643
endif
644

    
645
ifeq ($(TARGET_BASE_ARCH), sparc)
646
helper.o: cpu.h exec-all.h
647
op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h exec.h cpu.h
648
op_helper.o: exec.h softmmu_template.h cpu.h
649
translate.o: cpu.h exec-all.h disas.h
650
endif
651

    
652
ifeq ($(TARGET_BASE_ARCH), ppc)
653
op.o: op.c op_template.h op_mem.h op_helper.h
654
op_helper.o: op_helper.c mfrom_table.c op_helper_mem.h op_helper.h
655
translate.o: translate.c translate_init.c
656
endif
657

    
658
ifeq ($(TARGET_BASE_ARCH), mips)
659
helper.o: cpu.h exec-all.h
660
op.o: op_template.c fop_template.c op_mem.c exec.h cpu.h
661
op_helper.o: exec.h softmmu_template.h cpu.h
662
translate.o: translate_init.c exec-all.h disas.h
663
endif
664

    
665
loader.o: loader.c elf_ops.h
666

    
667
ifeq ($(TARGET_ARCH), sh4)
668
op.o: op.c op_mem.c cpu.h
669
op_helper.o: op_helper.c exec.h cpu.h
670
helper.o: helper.c exec.h cpu.h
671
sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
672
shix.o: shix.c sh7750_regs.h sh7750_regnames.h
673
sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
674
tc58128.o: tc58128.c
675
endif
676

    
677
ifeq ($(TARGET_BASE_ARCH), alpha)
678
op.o: op.c op_template.h op_mem.h
679
op_helper.o: op_helper_mem.h
680
endif
681

    
682
$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
683

    
684
%.o: %.c
685
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
686

    
687
%.o: %.S
688
	$(CC) $(CPPFLAGS) -c -o $@ $<
689

    
690
clean:
691
	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
692

    
693
install: all
694
ifneq ($(PROGS),)
695
	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
696
endif
697

    
698
ifneq ($(wildcard .depend),)
699
include .depend
700
endif
701

    
702
ifeq (1, 0)
703
audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
704
fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
705
CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
706
endif