Statistics
| Branch: | Revision:

root / Makefile.target @ cb33da57

History | View | Annotate | Download (18 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
ifdef TARGET_HAS_ELFLOAD32
258
OBJS+= elfload32.o
259
elfload32.o: elfload.c
260
endif
261

    
262
ifeq ($(TARGET_ARCH), i386)
263
OBJS+= vm86.o
264
endif
265
ifeq ($(TARGET_ARCH), arm)
266
OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
267
nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
268
 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
269
endif
270
ifeq ($(TARGET_ARCH), m68k)
271
OBJS+= m68k-sim.o m68k-semi.o
272
endif
273
endif #CONFIG_LINUX_USER
274

    
275
ifdef CONFIG_DARWIN_USER
276
OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
277
endif
278

    
279
SRCS:= $(OBJS:.o=.c)
280
OBJS+= libqemu.a
281

    
282
# cpu emulator library
283
LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
284
        translate.o op.o host-utils.o
285
ifdef CONFIG_SOFTFLOAT
286
LIBOBJS+=fpu/softfloat.o
287
else
288
LIBOBJS+=fpu/softfloat-native.o
289
endif
290
CPPFLAGS+=-I$(SRC_PATH)/fpu
291

    
292
ifeq ($(TARGET_ARCH), i386)
293
LIBOBJS+=helper.o helper2.o
294
ifeq ($(ARCH), i386)
295
LIBOBJS+=translate-copy.o
296
endif
297
endif
298

    
299
ifeq ($(TARGET_ARCH), x86_64)
300
LIBOBJS+=helper.o helper2.o
301
endif
302

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

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

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

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

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

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

    
327
ifeq ($(TARGET_BASE_ARCH), alpha)
328
LIBOBJS+= op_helper.o helper.o alpha_palcode.o
329
endif
330

    
331
ifeq ($(TARGET_BASE_ARCH), cris)
332
LIBOBJS+= op_helper.o helper.o
333
LIBOBJS+= cris-dis.o
334

    
335
ifndef CONFIG_USER_ONLY
336
LIBOBJS+= mmu.o
337
endif
338
endif
339

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

    
376
ifdef CONFIG_GDBSTUB
377
OBJS+=gdbstub.o
378
endif
379

    
380
all: $(PROGS)
381

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

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

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

    
429
ifdef CONFIG_VNC_TLS
430
CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
431
LIBS += $(CONFIG_VNC_TLS_LIBS)
432
endif
433

    
434
VL_OBJS += i2c.o smbus.o
435

    
436
# SCSI layer
437
VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
438

    
439
# USB layer
440
VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
441
VL_OBJS+= usb-wacom.o
442

    
443
# EEPROM emulation
444
VL_OBJS += eeprom93xx.o
445

    
446
# PCI network cards
447
VL_OBJS += eepro100.o
448
VL_OBJS += ne2000.o
449
VL_OBJS += pcnet.o
450
VL_OBJS += rtl8139.o
451

    
452
ifeq ($(TARGET_BASE_ARCH), i386)
453
# Hardware support
454
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
455
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
456
VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
457
VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmport.o vmware_vga.o
458
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
459
endif
460
ifeq ($(TARGET_BASE_ARCH), ppc)
461
VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
462
VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o pflash_cfi02.o
463
VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o
464
VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
465
# PowerPC 4xx boards
466
VL_OBJS+= ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
467
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
468
endif
469
ifeq ($(TARGET_BASE_ARCH), mips)
470
VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o
471
VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
472
VL_OBJS+= jazz_led.o
473
VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
474
VL_OBJS+= piix_pci.o smbus_eeprom.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
475
CPPFLAGS += -DHAS_AUDIO
476
endif
477
ifeq ($(TARGET_BASE_ARCH), cris)
478
VL_OBJS+= etraxfs.o
479
VL_OBJS+= ptimer.o
480
VL_OBJS+= etraxfs_timer.o
481
VL_OBJS+= etraxfs_ser.o
482
endif
483
ifeq ($(TARGET_BASE_ARCH), sparc)
484
ifeq ($(TARGET_ARCH), sparc64)
485
VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
486
VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
487
VL_OBJS+= cirrus_vga.o parallel.o ptimer.o
488
else
489
VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
490
VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
491
VL_OBJS+= cs4231.o ptimer.o
492
endif
493
endif
494
ifeq ($(TARGET_BASE_ARCH), arm)
495
VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
496
VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
497
VL_OBJS+= versatile_pci.o sd.o ptimer.o
498
VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
499
VL_OBJS+= arm-semi.o
500
VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
501
VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o max111x.o max7310.o
502
VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o $(AUDIODRV) wm8750.o
503
VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o palm.o ecc.o
504
CPPFLAGS += -DHAS_AUDIO
505
endif
506
ifeq ($(TARGET_BASE_ARCH), sh4)
507
VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
508
VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
509
endif
510
ifeq ($(TARGET_BASE_ARCH), m68k)
511
VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
512
VL_OBJS+= m68k-semi.o
513
endif
514
ifdef CONFIG_GDBSTUB
515
VL_OBJS+=gdbstub.o
516
endif
517
ifdef CONFIG_SDL
518
VL_OBJS+=sdl.o x_keymap.o
519
endif
520
VL_OBJS+=vnc.o d3des.o
521
ifdef CONFIG_COCOA
522
VL_OBJS+=cocoa.o
523
COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
524
ifdef CONFIG_COREAUDIO
525
COCOA_LIBS+=-framework CoreAudio
526
endif
527
endif
528
ifdef CONFIG_SLIRP
529
CPPFLAGS+=-I$(SRC_PATH)/slirp
530
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
531
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
532
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
533
VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
534
endif
535

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

    
557
ifeq ($(ARCH),ia64)
558
VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
559
endif
560

    
561
ifeq ($(ARCH),sparc64)
562
  VL_LDFLAGS+=-m64
563
  ifneq ($(CONFIG_SOLARIS),yes)
564
    VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
565
  endif
566
endif
567

    
568
ifdef CONFIG_WIN32
569
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
570
endif
571

    
572
$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
573
	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
574

    
575
cocoa.o: cocoa.m
576
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
577

    
578
sdl.o: sdl.c keymaps.c sdl_keysym.h
579
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
580

    
581
vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
582
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
583

    
584
sdlaudio.o: sdlaudio.c
585
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
586

    
587
depend: $(SRCS)
588
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
589

    
590
vldepend: $(VL_OBJS:.o=.c)
591
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
592

    
593
# libqemu
594

    
595
libqemu.a: $(LIBOBJS)
596
	rm -f $@
597
	$(AR) rcs $@ $(LIBOBJS)
598

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

    
601
translate-all.o: translate-all.c opc.h cpu.h
602

    
603
translate-op.o: translate-all.c op.h opc.h cpu.h
604

    
605
op.h: op.o $(DYNGEN)
606
	$(DYNGEN) -o $@ $<
607

    
608
opc.h: op.o $(DYNGEN)
609
	$(DYNGEN) -c -o $@ $<
610

    
611
gen-op.h: op.o $(DYNGEN)
612
	$(DYNGEN) -g -o $@ $<
613

    
614
op.o: op.c
615
	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
616

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

    
628
cpu-exec.o: cpu-exec.c
629
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
630

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

    
636
vga.o: pixel_ops.h
637

    
638
tcx.o: pixel_ops.h
639

    
640
ifeq ($(TARGET_BASE_ARCH), i386)
641
op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
642
endif
643

    
644
ifeq ($(TARGET_ARCH), arm)
645
op.o: op.c op_template.h
646
pl110.o: pl110_template.h
647
endif
648

    
649
ifeq ($(TARGET_BASE_ARCH), sparc)
650
helper.o: cpu.h exec-all.h
651
op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h exec.h cpu.h
652
op_helper.o: exec.h softmmu_template.h cpu.h
653
translate.o: cpu.h exec-all.h disas.h
654
endif
655

    
656
ifeq ($(TARGET_BASE_ARCH), ppc)
657
op.o: op.c op_template.h op_mem.h op_helper.h
658
op_helper.o: op_helper.c mfrom_table.c op_helper_mem.h op_helper.h
659
translate.o: translate.c translate_init.c
660
endif
661

    
662
ifeq ($(TARGET_BASE_ARCH), mips)
663
helper.o: cpu.h exec-all.h
664
op.o: op_template.c fop_template.c op_mem.c exec.h cpu.h
665
op_helper.o: exec.h softmmu_template.h cpu.h
666
translate.o: translate_init.c exec-all.h disas.h
667
endif
668

    
669
loader.o: loader.c elf_ops.h
670

    
671
ifeq ($(TARGET_ARCH), sh4)
672
op.o: op.c op_mem.c cpu.h
673
op_helper.o: op_helper.c exec.h cpu.h
674
helper.o: helper.c exec.h cpu.h
675
sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
676
shix.o: shix.c sh7750_regs.h sh7750_regnames.h
677
sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
678
tc58128.o: tc58128.c
679
endif
680

    
681
ifeq ($(TARGET_BASE_ARCH), alpha)
682
op.o: op.c op_template.h op_mem.h
683
op_helper.o: op_helper_mem.h
684
endif
685

    
686
$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
687

    
688
%.o: %.c
689
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
690

    
691
%.o: %.S
692
	$(CC) $(CPPFLAGS) -c -o $@ $<
693

    
694
clean:
695
	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
696

    
697
install: all
698
ifneq ($(PROGS),)
699
	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
700
endif
701

    
702
ifneq ($(wildcard .depend),)
703
include .depend
704
endif
705

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