Statistics
| Branch: | Revision:

root / Makefile.target @ 19221bda

History | View | Annotate | Download (16 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), mips64)
8
TARGET_BASE_ARCH:=mips
9
endif
10
ifeq ($(TARGET_ARCH), ppc64)
11
TARGET_BASE_ARCH:=ppc
12
endif
13
ifeq ($(TARGET_ARCH), sparc64)
14
TARGET_BASE_ARCH:=sparc
15
endif
16
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
17
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
18
CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
19
ifdef CONFIG_DARWIN_USER
20
VPATH+=:$(SRC_PATH)/darwin-user
21
CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
22
endif
23
ifdef CONFIG_LINUX_USER
24
VPATH+=:$(SRC_PATH)/linux-user
25
CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
26
endif
27
BASE_CFLAGS=
28
BASE_LDFLAGS=
29
#CFLAGS+=-Werror
30
LIBS=
31
HELPER_CFLAGS=$(CFLAGS)
32
DYNGEN=../dyngen$(EXESUF)
33
# user emulator name
34
TARGET_ARCH2=$(TARGET_ARCH)
35
ifeq ($(TARGET_ARCH),arm)
36
  ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
37
    TARGET_ARCH2=armeb
38
  endif
39
endif
40
ifeq ($(TARGET_ARCH),sh4)
41
  ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
42
    TARGET_ARCH2=sh4eb
43
  endif
44
endif
45
ifeq ($(TARGET_ARCH),mips)
46
  ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
47
    TARGET_ARCH2=mipsel
48
  endif
49
endif
50
ifeq ($(TARGET_ARCH),mips64)
51
  ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
52
    TARGET_ARCH2=mips64el
53
  endif
54
endif
55
QEMU_USER=qemu-$(TARGET_ARCH2)
56
# system emulator name
57
ifdef CONFIG_SOFTMMU
58
ifeq ($(TARGET_ARCH), i386)
59
QEMU_SYSTEM=qemu$(EXESUF)
60
else
61
QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
62
endif
63
else
64
QEMU_SYSTEM=qemu-fast
65
endif
66

    
67
ifdef CONFIG_USER_ONLY
68
PROGS=$(QEMU_USER)
69
else
70
PROGS+=$(QEMU_SYSTEM)
71
ifndef CONFIG_SOFTMMU
72
CONFIG_STATIC=y
73
endif
74
endif # !CONFIG_USER_ONLY
75

    
76
ifdef CONFIG_STATIC
77
BASE_LDFLAGS+=-static
78
endif
79

    
80
# We require -O2 to avoid the stack setup prologue in EXIT_TB
81
OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
82

    
83
# cc-option
84
# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
85

    
86
cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
87
              > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
88

    
89
OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
90
OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
91
OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
92
OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
93
OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
94
OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
95
OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
96
OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
97

    
98
ifeq ($(ARCH),i386)
99
HELPER_CFLAGS+=-fomit-frame-pointer
100
OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
101
ifdef TARGET_GPROF
102
USE_I386_LD=y
103
endif
104
ifdef CONFIG_STATIC
105
USE_I386_LD=y
106
endif
107
ifdef USE_I386_LD
108
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
109
else
110
ifdef CONFIG_LINUX_USER
111
# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
112
# that the kernel ELF loader considers as an executable. I think this
113
# is the simplest way to make it self virtualizable!
114
BASE_LDFLAGS+=-Wl,-shared
115
endif
116
endif
117
endif
118

    
119
ifeq ($(ARCH),x86_64)
120
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
121
endif
122

    
123
ifeq ($(ARCH),ppc)
124
CPPFLAGS+= -D__powerpc__
125
ifdef CONFIG_LINUX_USER
126
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
127
endif
128
endif
129

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

    
134
ifeq ($(ARCH),sparc)
135
  BASE_CFLAGS+=-ffixed-g2 -ffixed-g3
136
  OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
137
  ifeq ($(CONFIG_SOLARIS),yes)
138
    OP_CFLAGS+=-fno-omit-frame-pointer
139
  else
140
    BASE_CFLAGS+=-ffixed-g1 -ffixed-g6
141
    HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
142
    # -static is used to avoid g1/g3 usage by the dynamic linker
143
    BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
144
  endif
145
endif
146

    
147
ifeq ($(ARCH),sparc64)
148
  BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
149
  OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
150
  ifneq ($(CONFIG_SOLARIS),yes)
151
    BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
152
    OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
153
  endif
154
endif
155

    
156
ifeq ($(ARCH),alpha)
157
# -msmall-data is not used for OP_CFLAGS because we want two-instruction
158
# relocations for the constant constructions
159
# Ensure there's only a single GP
160
BASE_CFLAGS+=-msmall-data
161
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
162
endif
163

    
164
ifeq ($(ARCH),ia64)
165
BASE_CFLAGS+=-mno-sdata
166
OP_CFLAGS+=-mno-sdata
167
BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
168
endif
169

    
170
ifeq ($(ARCH),arm)
171
OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
172
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
173
endif
174

    
175
ifeq ($(ARCH),m68k)
176
OP_CFLAGS+=-fomit-frame-pointer
177
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
178
endif
179

    
180
ifeq ($(ARCH),mips)
181
ifeq ($(WORDS_BIGENDIAN),yes)
182
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
183
else
184
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
185
endif
186
endif
187

    
188
ifeq ($(ARCH),mips64)
189
ifeq ($(WORDS_BIGENDIAN),yes)
190
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
191
else
192
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
193
endif
194
endif
195

    
196
ifeq ($(CONFIG_DARWIN),yes)
197
LIBS+=-lmx
198
endif
199

    
200
ifdef CONFIG_DARWIN_USER
201
# Leave some space for the regular program loading zone
202
BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
203
endif
204

    
205
BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
206
BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
207
OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
208
OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
209

    
210
#########################################################
211

    
212
CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
213
LIBS+=-lm
214
ifndef CONFIG_USER_ONLY
215
LIBS+=-lz
216
endif
217
ifdef CONFIG_WIN32
218
LIBS+=-lwinmm -lws2_32 -liphlpapi
219
endif
220
ifdef CONFIG_SOLARIS
221
LIBS+=-lsocket -lnsl -lresolv
222
ifdef NEEDS_LIBSUNMATH
223
LIBS+=-lsunmath
224
LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
225
OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
226
BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
227
endif
228
endif
229

    
230
# profiling code
231
ifdef TARGET_GPROF
232
BASE_LDFLAGS+=-p
233
main.o: BASE_CFLAGS+=-p
234
endif
235

    
236
ifdef CONFIG_LINUX_USER
237
OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
238
      elfload.o linuxload.o
239
LIBS+= $(AIOLIBS)
240
ifdef TARGET_HAS_BFLT
241
OBJS+= flatload.o
242
endif
243

    
244
ifeq ($(TARGET_ARCH), i386)
245
OBJS+= vm86.o
246
endif
247
ifeq ($(TARGET_ARCH), arm)
248
OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
249
nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
250
 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
251
endif
252
ifeq ($(TARGET_ARCH), m68k)
253
OBJS+= m68k-sim.o m68k-semi.o
254
endif
255
endif #CONFIG_LINUX_USER
256

    
257
ifdef CONFIG_DARWIN_USER
258
OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
259
endif
260

    
261
SRCS:= $(OBJS:.o=.c)
262
OBJS+= libqemu.a
263

    
264
# cpu emulator library
265
LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
266
        translate.o op.o 
267
ifdef CONFIG_SOFTFLOAT
268
LIBOBJS+=fpu/softfloat.o
269
else
270
LIBOBJS+=fpu/softfloat-native.o
271
endif
272
CPPFLAGS+=-I$(SRC_PATH)/fpu
273

    
274
ifeq ($(TARGET_ARCH), i386)
275
LIBOBJS+=helper.o helper2.o
276
ifeq ($(ARCH), i386)
277
LIBOBJS+=translate-copy.o
278
endif
279
endif
280

    
281
ifeq ($(TARGET_ARCH), x86_64)
282
LIBOBJS+=helper.o helper2.o
283
endif
284

    
285
ifeq ($(TARGET_BASE_ARCH), ppc)
286
LIBOBJS+= op_helper.o helper.o
287
endif
288

    
289
ifeq ($(TARGET_BASE_ARCH), mips)
290
LIBOBJS+= op_helper.o helper.o
291
endif
292

    
293
ifeq ($(TARGET_BASE_ARCH), sparc)
294
LIBOBJS+= op_helper.o helper.o
295
endif
296

    
297
ifeq ($(TARGET_BASE_ARCH), arm)
298
LIBOBJS+= op_helper.o helper.o
299
endif
300

    
301
ifeq ($(TARGET_BASE_ARCH), sh4)
302
LIBOBJS+= op_helper.o helper.o
303
endif
304

    
305
ifeq ($(TARGET_BASE_ARCH), m68k)
306
LIBOBJS+= helper.o
307
endif
308

    
309
ifeq ($(TARGET_BASE_ARCH), alpha)
310
LIBOBJS+= op_helper.o helper.o alpha_palcode.o
311
endif
312

    
313
# NOTE: the disassembler code is only needed for debugging
314
LIBOBJS+=disas.o 
315
ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
316
USE_I386_DIS=y
317
endif
318
ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
319
USE_I386_DIS=y
320
endif
321
ifdef USE_I386_DIS
322
LIBOBJS+=i386-dis.o
323
endif
324
ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
325
LIBOBJS+=alpha-dis.o
326
endif
327
ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
328
LIBOBJS+=ppc-dis.o
329
endif
330
ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
331
LIBOBJS+=mips-dis.o
332
endif
333
ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
334
LIBOBJS+=sparc-dis.o
335
endif
336
ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
337
LIBOBJS+=arm-dis.o
338
endif
339
ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
340
LIBOBJS+=m68k-dis.o
341
endif
342
ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
343
LIBOBJS+=sh4-dis.o
344
endif
345

    
346
ifdef CONFIG_GDBSTUB
347
OBJS+=gdbstub.o
348
endif
349

    
350
all: $(PROGS)
351

    
352
$(QEMU_USER): $(OBJS)
353
	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
354
ifeq ($(ARCH),alpha)
355
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
356
# the address space (31 bit so sign extending doesn't matter)
357
	echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
358
endif
359

    
360
# must use static linking to avoid leaving stuff in virtual address space
361
VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o loader.o isa_mmio.o
362
VL_OBJS+=cutils.o
363
VL_OBJS+=block.o block-raw.o
364
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
365
VL_OBJS+=irq.o
366
ifdef CONFIG_WIN32
367
VL_OBJS+=tap-win32.o
368
endif
369

    
370
SOUND_HW = sb16.o es1370.o
371
AUDIODRV = audio.o noaudio.o wavaudio.o
372
ifdef CONFIG_SDL
373
AUDIODRV += sdlaudio.o
374
endif
375
ifdef CONFIG_OSS
376
AUDIODRV += ossaudio.o
377
endif
378
ifdef CONFIG_COREAUDIO
379
AUDIODRV += coreaudio.o
380
endif
381
ifdef CONFIG_ALSA
382
AUDIODRV += alsaaudio.o
383
LIBS += -lasound
384
endif
385
ifdef CONFIG_DSOUND
386
AUDIODRV += dsoundaudio.o
387
LIBS += -lole32 -ldxguid
388
endif
389
ifdef CONFIG_FMOD
390
AUDIODRV += fmodaudio.o
391
audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
392
LIBS += $(CONFIG_FMOD_LIB)
393
endif
394
ifdef CONFIG_ADLIB
395
SOUND_HW += fmopl.o adlib.o
396
endif
397
AUDIODRV+= wavcapture.o
398

    
399
# SCSI layer
400
VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
401

    
402
# USB layer
403
VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
404

    
405
# EEPROM emulation
406
VL_OBJS += eeprom93xx.o
407

    
408
# PCI network cards
409
VL_OBJS += eepro100.o
410
VL_OBJS += ne2000.o
411
VL_OBJS += pcnet.o
412
VL_OBJS += rtl8139.o
413

    
414
ifeq ($(TARGET_BASE_ARCH), i386)
415
# Hardware support
416
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
417
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
418
VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
419
VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmware_vga.o
420
CPPFLAGS += -DHAS_AUDIO
421
endif
422
ifeq ($(TARGET_BASE_ARCH), ppc)
423
VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
424
VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o pflash_cfi02.o
425
VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
426
VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o ppc405_uc.o
427
CPPFLAGS += -DHAS_AUDIO
428
endif
429
ifeq ($(TARGET_BASE_ARCH), mips)
430
VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o
431
VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
432
VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
433
VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
434
CPPFLAGS += -DHAS_AUDIO
435
endif
436
ifeq ($(TARGET_BASE_ARCH), sparc)
437
ifeq ($(TARGET_ARCH), sparc64)
438
VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
439
VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
440
VL_OBJS+= cirrus_vga.o parallel.o
441
else
442
VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
443
VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
444
VL_OBJS+= cs4231.o
445
endif
446
endif
447
ifeq ($(TARGET_BASE_ARCH), arm)
448
VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
449
VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl181.o pl190.o
450
VL_OBJS+= versatile_pci.o sd.o
451
VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
452
VL_OBJS+= arm-semi.o
453
endif
454
ifeq ($(TARGET_BASE_ARCH), sh4)
455
VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
456
endif
457
ifdef CONFIG_GDBSTUB
458
VL_OBJS+=gdbstub.o 
459
endif
460
ifdef CONFIG_SDL
461
VL_OBJS+=sdl.o x_keymap.o
462
endif
463
VL_OBJS+=vnc.o
464
ifdef CONFIG_COCOA
465
VL_OBJS+=cocoa.o
466
COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
467
ifdef CONFIG_COREAUDIO
468
COCOA_LIBS+=-framework CoreAudio
469
endif
470
endif
471
ifdef CONFIG_SLIRP
472
CPPFLAGS+=-I$(SRC_PATH)/slirp
473
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
474
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
475
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
476
VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
477
endif
478

    
479
VL_LDFLAGS=
480
VL_LIBS=$(AIOLIBS)
481
# specific flags are needed for non soft mmu emulator
482
ifdef CONFIG_STATIC
483
VL_LDFLAGS+=-static
484
endif
485
ifndef CONFIG_SOFTMMU
486
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld 
487
endif
488
ifndef CONFIG_DARWIN
489
ifndef CONFIG_WIN32
490
ifndef CONFIG_SOLARIS
491
VL_LIBS+=-lutil
492
endif
493
endif
494
endif
495
ifdef TARGET_GPROF
496
vl.o: BASE_CFLAGS+=-p
497
VL_LDFLAGS+=-p
498
endif
499

    
500
ifeq ($(ARCH),ia64)
501
VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
502
endif
503

    
504
ifeq ($(ARCH),sparc64)
505
  VL_LDFLAGS+=-m64
506
  ifneq ($(CONFIG_SOLARIS),yes)
507
    VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
508
  endif
509
endif
510

    
511
ifdef CONFIG_WIN32
512
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
513
endif
514

    
515
$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
516
	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
517

    
518
cocoa.o: cocoa.m
519
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
520

    
521
sdl.o: sdl.c keymaps.c sdl_keysym.h
522
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
523

    
524
vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
525
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
526

    
527
sdlaudio.o: sdlaudio.c
528
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
529

    
530
depend: $(SRCS)
531
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
532

    
533
vldepend: $(VL_OBJS:.o=.c)
534
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
535

    
536
# libqemu 
537

    
538
libqemu.a: $(LIBOBJS)
539
	rm -f $@
540
	$(AR) rcs $@ $(LIBOBJS)
541

    
542
translate.o: translate.c gen-op.h opc.h cpu.h
543

    
544
translate-all.o: translate-all.c opc.h cpu.h
545

    
546
translate-op.o: translate-all.c op.h opc.h cpu.h
547

    
548
op.h: op.o $(DYNGEN)
549
	$(DYNGEN) -o $@ $<
550

    
551
opc.h: op.o $(DYNGEN)
552
	$(DYNGEN) -c -o $@ $<
553

    
554
gen-op.h: op.o $(DYNGEN)
555
	$(DYNGEN) -g -o $@ $<
556

    
557
op.o: op.c
558
	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
559

    
560
# HELPER_CFLAGS is used for all the code compiled with static register
561
# variables
562
ifeq ($(TARGET_BASE_ARCH), i386)
563
# XXX: rename helper.c to op_helper.c
564
helper.o: helper.c
565
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
566
else
567
op_helper.o: op_helper.c
568
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
569
endif
570

    
571
cpu-exec.o: cpu-exec.c
572
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
573

    
574
# Note: this is a workaround. The real fix is to avoid compiling
575
# cpu_signal_handler() in cpu-exec.c.
576
signal.o: signal.c
577
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
578

    
579
ifeq ($(TARGET_BASE_ARCH), i386)
580
op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
581
endif
582

    
583
ifeq ($(TARGET_ARCH), arm)
584
op.o: op.c op_template.h
585
pl110.o: pl110_template.h
586
endif
587

    
588
ifeq ($(TARGET_BASE_ARCH), sparc)
589
op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
590
magic_load.o: elf_op.h
591
endif
592

    
593
ifeq ($(TARGET_BASE_ARCH), ppc)
594
op.o: op.c op_template.h op_mem.h
595
op_helper.o: op_helper_mem.h
596
translate.o: translate.c translate_init.c
597
endif
598

    
599
ifeq ($(TARGET_BASE_ARCH), mips)
600
helper.o: cpu.h exec-all.h
601
op.o: op_template.c fop_template.c op_mem.c exec.h
602
op_helper.o: op_helper_mem.c exec.h softmmu_template.h
603
translate.o: translate_init.c exec-all.h disas.h
604
endif
605

    
606
loader.o: loader.c elf_ops.h
607

    
608
ifeq ($(TARGET_ARCH), sh4)
609
op.o: op.c op_mem.c cpu.h
610
op_helper.o: op_helper.c exec.h cpu.h
611
helper.o: helper.c exec.h cpu.h
612
sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
613
shix.o: shix.c sh7750_regs.h sh7750_regnames.h
614
sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
615
tc58128.o: tc58128.c
616
endif
617

    
618
ifeq ($(TARGET_BASE_ARCH), alpha)
619
op.o: op.c op_template.h op_mem.h
620
op_helper.o: op_helper_mem.h
621
endif
622

    
623
$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
624

    
625
%.o: %.c
626
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
627

    
628
%.o: %.S
629
	$(CC) $(CPPFLAGS) -c -o $@ $<
630

    
631
clean:
632
	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
633

    
634
install: all 
635
ifneq ($(PROGS),)
636
	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
637
endif
638

    
639
ifneq ($(wildcard .depend),)
640
include .depend
641
endif
642

    
643
ifeq (1, 0)
644
audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
645
fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
646
CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
647
endif