Statistics
| Branch: | Revision:

root / Makefile.target @ 86cc1ce0

History | View | Annotate | Download (15.7 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
ifeq ($(CONFIG_SOLARIS),yes)
136
BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
137
BASE_LDFLAGS+=-m32
138
OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
139
else
140
BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
141
BASE_LDFLAGS+=-m32
142
OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
143
HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
144
# -static is used to avoid g1/g3 usage by the dynamic linker
145
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
146
endif
147
endif
148

    
149
ifeq ($(ARCH),sparc64)
150
BASE_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
151
BASE_LDFLAGS+=-m64
152
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
153
OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
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)
206
OP_CFLAGS+=$(OS_CFLAGS)
207

    
208
#########################################################
209

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

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

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

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

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

    
259
SRCS:= $(OBJS:.o=.c)
260
OBJS+= libqemu.a
261

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

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

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

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

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

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

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

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

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

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

    
340
ifdef CONFIG_GDBSTUB
341
OBJS+=gdbstub.o
342
endif
343

    
344
all: $(PROGS)
345

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

    
354
# must use static linking to avoid leaving stuff in virtual address space
355
VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o loader.o isa_mmio.o
356
VL_OBJS+=cutils.o
357
VL_OBJS+=block.o block-raw.o
358
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
359
ifdef CONFIG_WIN32
360
VL_OBJS+=tap-win32.o
361
endif
362

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

    
392
# SCSI layer
393
VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
394

    
395
# USB layer
396
VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
397

    
398
# EEPROM emulation
399
VL_OBJS += eeprom93xx.o
400

    
401
# PCI network cards
402
VL_OBJS += eepro100.o
403
VL_OBJS += ne2000.o
404
VL_OBJS += pcnet.o
405
VL_OBJS += rtl8139.o
406

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

    
471
VL_LDFLAGS=
472
VL_LIBS=$(AIOLIBS)
473
# specific flags are needed for non soft mmu emulator
474
ifdef CONFIG_STATIC
475
VL_LDFLAGS+=-static
476
endif
477
ifndef CONFIG_SOFTMMU
478
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld 
479
endif
480
ifndef CONFIG_DARWIN
481
ifndef CONFIG_WIN32
482
ifndef CONFIG_SOLARIS
483
VL_LIBS+=-lutil
484
endif
485
endif
486
endif
487
ifdef TARGET_GPROF
488
vl.o: BASE_CFLAGS+=-p
489
VL_LDFLAGS+=-p
490
endif
491

    
492
ifeq ($(ARCH),ia64)
493
VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
494
endif
495

    
496
ifeq ($(ARCH),sparc64)
497
VL_LDFLAGS+=-m64
498
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
499
endif
500

    
501
ifdef CONFIG_WIN32
502
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
503
endif
504

    
505
$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
506
	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
507

    
508
cocoa.o: cocoa.m
509
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
510

    
511
sdl.o: sdl.c keymaps.c sdl_keysym.h
512
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
513

    
514
vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
515
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
516

    
517
sdlaudio.o: sdlaudio.c
518
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
519

    
520
depend: $(SRCS)
521
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
522

    
523
vldepend: $(VL_OBJS:.o=.c)
524
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
525

    
526
# libqemu 
527

    
528
libqemu.a: $(LIBOBJS)
529
	rm -f $@
530
	$(AR) rcs $@ $(LIBOBJS)
531

    
532
translate.o: translate.c gen-op.h opc.h cpu.h
533

    
534
translate-all.o: translate-all.c opc.h cpu.h
535

    
536
translate-op.o: translate-all.c op.h opc.h cpu.h
537

    
538
op.h: op.o $(DYNGEN)
539
	$(DYNGEN) -o $@ $<
540

    
541
opc.h: op.o $(DYNGEN)
542
	$(DYNGEN) -c -o $@ $<
543

    
544
gen-op.h: op.o $(DYNGEN)
545
	$(DYNGEN) -g -o $@ $<
546

    
547
op.o: op.c
548
	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
549

    
550
# HELPER_CFLAGS is used for all the code compiled with static register
551
# variables
552
ifeq ($(TARGET_BASE_ARCH), i386)
553
# XXX: rename helper.c to op_helper.c
554
helper.o: helper.c
555
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
556
else
557
op_helper.o: op_helper.c
558
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
559
endif
560

    
561
cpu-exec.o: cpu-exec.c
562
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
563

    
564
# Note: this is a workaround. The real fix is to avoid compiling
565
# cpu_signal_handler() in cpu-exec.c.
566
signal.o: signal.c
567
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
568

    
569
ifeq ($(TARGET_BASE_ARCH), i386)
570
op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
571
endif
572

    
573
ifeq ($(TARGET_ARCH), arm)
574
op.o: op.c op_template.h
575
pl110.o: pl110_template.h
576
endif
577

    
578
ifeq ($(TARGET_BASE_ARCH), sparc)
579
op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
580
magic_load.o: elf_op.h
581
endif
582

    
583
ifeq ($(TARGET_BASE_ARCH), ppc)
584
op.o: op.c op_template.h op_mem.h
585
op_helper.o: op_helper_mem.h
586
translate.o: translate.c translate_init.c
587
endif
588

    
589
ifeq ($(TARGET_BASE_ARCH), mips)
590
helper.o: cpu.h exec-all.h
591
op.o: op_template.c fop_template.c op_mem.c exec.h
592
op_helper.o: op_helper_mem.c exec.h softmmu_template.h
593
translate.o: translate_init.c exec-all.h disas.h
594
endif
595

    
596
loader.o: loader.c elf_ops.h
597

    
598
ifeq ($(TARGET_ARCH), sh4)
599
op.o: op.c op_mem.c cpu.h
600
op_helper.o: op_helper.c exec.h cpu.h
601
helper.o: helper.c exec.h cpu.h
602
sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
603
shix.o: shix.c sh7750_regs.h sh7750_regnames.h
604
sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
605
tc58128.o: tc58128.c
606
endif
607

    
608
$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
609

    
610
%.o: %.c
611
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
612

    
613
%.o: %.S
614
	$(CC) $(CPPFLAGS) -c -o $@ $<
615

    
616
clean:
617
	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
618

    
619
install: all 
620
ifneq ($(PROGS),)
621
	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
622
endif
623

    
624
ifneq ($(wildcard .depend),)
625
include .depend
626
endif
627

    
628
ifeq (1, 0)
629
audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
630
fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
631
CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
632
endif