SD card emulation (initial implementation by Andrzei Zaborowski).
[qemu/mini2440.git] / Makefile.target
blob16adfc7e424ad2236a6ef7858d5a01117197f4e0
1 include config.mak
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
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
76 ifdef CONFIG_STATIC
77 BASE_LDFLAGS+=-static
78 endif
80 # We require -O2 to avoid the stack setup prologue in EXIT_TB
81 OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
83 # cc-option
84 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
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 ;)
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, ""))
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
119 ifeq ($(ARCH),x86_64)
120 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
121 endif
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
130 ifeq ($(ARCH),s390)
131 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
132 endif
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
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
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
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
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
175 ifeq ($(ARCH),m68k)
176 OP_CFLAGS+=-fomit-frame-pointer
177 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
178 endif
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
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
196 ifeq ($(CONFIG_DARWIN),yes)
197 LIBS+=-lmx
198 endif
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
205 BASE_CFLAGS+=$(OS_CFLAGS)
206 OP_CFLAGS+=$(OS_CFLAGS)
208 #########################################################
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
228 # profiling code
229 ifdef TARGET_GPROF
230 BASE_LDFLAGS+=-p
231 main.o: BASE_CFLAGS+=-p
232 endif
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
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
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
259 SRCS:= $(OBJS:.o=.c)
260 OBJS+= libqemu.a
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
272 ifeq ($(TARGET_ARCH), i386)
273 LIBOBJS+=helper.o helper2.o
274 ifeq ($(ARCH), i386)
275 LIBOBJS+=translate-copy.o
276 endif
277 endif
279 ifeq ($(TARGET_ARCH), x86_64)
280 LIBOBJS+=helper.o helper2.o
281 endif
283 ifeq ($(TARGET_BASE_ARCH), ppc)
284 LIBOBJS+= op_helper.o helper.o
285 endif
287 ifeq ($(TARGET_BASE_ARCH), mips)
288 LIBOBJS+= op_helper.o helper.o
289 endif
291 ifeq ($(TARGET_BASE_ARCH), sparc)
292 LIBOBJS+= op_helper.o helper.o
293 endif
295 ifeq ($(TARGET_BASE_ARCH), arm)
296 LIBOBJS+= op_helper.o helper.o
297 endif
299 ifeq ($(TARGET_BASE_ARCH), sh4)
300 LIBOBJS+= op_helper.o helper.o
301 endif
303 ifeq ($(TARGET_BASE_ARCH), m68k)
304 LIBOBJS+= helper.o
305 endif
307 ifeq ($(TARGET_BASE_ARCH), alpha)
308 LIBOBJS+= op_helper.o helper.o alpha_palcode.o
309 endif
311 # NOTE: the disassembler code is only needed for debugging
312 LIBOBJS+=disas.o 
313 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
314 USE_I386_DIS=y
315 endif
316 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
317 USE_I386_DIS=y
318 endif
319 ifdef USE_I386_DIS
320 LIBOBJS+=i386-dis.o
321 endif
322 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
323 LIBOBJS+=alpha-dis.o
324 endif
325 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
326 LIBOBJS+=ppc-dis.o
327 endif
328 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
329 LIBOBJS+=mips-dis.o
330 endif
331 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
332 LIBOBJS+=sparc-dis.o
333 endif
334 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
335 LIBOBJS+=arm-dis.o
336 endif
337 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
338 LIBOBJS+=m68k-dis.o
339 endif
340 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
341 LIBOBJS+=sh4-dis.o
342 endif
344 ifdef CONFIG_GDBSTUB
345 OBJS+=gdbstub.o
346 endif
348 all: $(PROGS)
350 $(QEMU_USER): $(OBJS)
351         $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
352 ifeq ($(ARCH),alpha)
353 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
354 # the address space (31 bit so sign extending doesn't matter)
355         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
356 endif
358 # must use static linking to avoid leaving stuff in virtual address space
359 VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o loader.o isa_mmio.o
360 VL_OBJS+=cutils.o
361 VL_OBJS+=block.o block-raw.o
362 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
363 ifdef CONFIG_WIN32
364 VL_OBJS+=tap-win32.o
365 endif
367 SOUND_HW = sb16.o es1370.o
368 AUDIODRV = audio.o noaudio.o wavaudio.o
369 ifdef CONFIG_SDL
370 AUDIODRV += sdlaudio.o
371 endif
372 ifdef CONFIG_OSS
373 AUDIODRV += ossaudio.o
374 endif
375 ifdef CONFIG_COREAUDIO
376 AUDIODRV += coreaudio.o
377 endif
378 ifdef CONFIG_ALSA
379 AUDIODRV += alsaaudio.o
380 LIBS += -lasound
381 endif
382 ifdef CONFIG_DSOUND
383 AUDIODRV += dsoundaudio.o
384 LIBS += -lole32 -ldxguid
385 endif
386 ifdef CONFIG_FMOD
387 AUDIODRV += fmodaudio.o
388 audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
389 LIBS += $(CONFIG_FMOD_LIB)
390 endif
391 ifdef CONFIG_ADLIB
392 SOUND_HW += fmopl.o adlib.o
393 endif
394 AUDIODRV+= wavcapture.o
396 # SCSI layer
397 VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
399 # USB layer
400 VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
402 # EEPROM emulation
403 VL_OBJS += eeprom93xx.o
405 # PCI network cards
406 VL_OBJS += eepro100.o
407 VL_OBJS += ne2000.o
408 VL_OBJS += pcnet.o
409 VL_OBJS += rtl8139.o
411 ifeq ($(TARGET_BASE_ARCH), i386)
412 # Hardware support
413 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
414 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
415 VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
416 VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmware_vga.o
417 CPPFLAGS += -DHAS_AUDIO
418 endif
419 ifeq ($(TARGET_BASE_ARCH), ppc)
420 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
421 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
422 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
423 VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
424 CPPFLAGS += -DHAS_AUDIO
425 endif
426 ifeq ($(TARGET_BASE_ARCH), mips)
427 VL_OBJS+= mips_r4k.o mips_malta.o mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
428 VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
429 VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
430 DEFINES += -DHAS_AUDIO
431 endif
432 ifeq ($(TARGET_BASE_ARCH), sparc)
433 ifeq ($(TARGET_ARCH), sparc64)
434 VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
435 VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
436 VL_OBJS+= cirrus_vga.o parallel.o
437 else
438 VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
439 VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
440 VL_OBJS+= cs4231.o
441 endif
442 endif
443 ifeq ($(TARGET_BASE_ARCH), arm)
444 VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
445 VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl181.o pl190.o
446 VL_OBJS+= versatile_pci.o sd.o
447 VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
448 VL_OBJS+= arm-semi.o
449 endif
450 ifeq ($(TARGET_BASE_ARCH), sh4)
451 VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
452 endif
453 ifdef CONFIG_GDBSTUB
454 VL_OBJS+=gdbstub.o 
455 endif
456 ifdef CONFIG_SDL
457 VL_OBJS+=sdl.o x_keymap.o
458 endif
459 VL_OBJS+=vnc.o
460 ifdef CONFIG_COCOA
461 VL_OBJS+=cocoa.o
462 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
463 ifdef CONFIG_COREAUDIO
464 COCOA_LIBS+=-framework CoreAudio
465 endif
466 endif
467 ifdef CONFIG_SLIRP
468 CPPFLAGS+=-I$(SRC_PATH)/slirp
469 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
470 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
471 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
472 VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
473 endif
475 VL_LDFLAGS=
476 VL_LIBS=$(AIOLIBS)
477 # specific flags are needed for non soft mmu emulator
478 ifdef CONFIG_STATIC
479 VL_LDFLAGS+=-static
480 endif
481 ifndef CONFIG_SOFTMMU
482 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld 
483 endif
484 ifndef CONFIG_DARWIN
485 ifndef CONFIG_WIN32
486 ifndef CONFIG_SOLARIS
487 VL_LIBS+=-lutil
488 endif
489 endif
490 endif
491 ifdef TARGET_GPROF
492 vl.o: BASE_CFLAGS+=-p
493 VL_LDFLAGS+=-p
494 endif
496 ifeq ($(ARCH),ia64)
497 VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
498 endif
500 ifeq ($(ARCH),sparc64)
501 VL_LDFLAGS+=-m64
502 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
503 endif
505 ifdef CONFIG_WIN32
506 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
507 endif
509 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
510         $(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
512 cocoa.o: cocoa.m
513         $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
515 sdl.o: sdl.c keymaps.c sdl_keysym.h
516         $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
518 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
519         $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
521 sdlaudio.o: sdlaudio.c
522         $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
524 depend: $(SRCS)
525         $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
527 vldepend: $(VL_OBJS:.o=.c)
528         $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
530 # libqemu 
532 libqemu.a: $(LIBOBJS)
533         rm -f $@
534         $(AR) rcs $@ $(LIBOBJS)
536 translate.o: translate.c gen-op.h opc.h cpu.h
538 translate-all.o: translate-all.c opc.h cpu.h
540 translate-op.o: translate-all.c op.h opc.h cpu.h
542 op.h: op.o $(DYNGEN)
543         $(DYNGEN) -o $@ $<
545 opc.h: op.o $(DYNGEN)
546         $(DYNGEN) -c -o $@ $<
548 gen-op.h: op.o $(DYNGEN)
549         $(DYNGEN) -g -o $@ $<
551 op.o: op.c
552         $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
554 # HELPER_CFLAGS is used for all the code compiled with static register
555 # variables
556 ifeq ($(TARGET_BASE_ARCH), i386)
557 # XXX: rename helper.c to op_helper.c
558 helper.o: helper.c
559         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
560 else
561 op_helper.o: op_helper.c
562         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
563 endif
565 cpu-exec.o: cpu-exec.c
566         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
568 # Note: this is a workaround. The real fix is to avoid compiling
569 # cpu_signal_handler() in cpu-exec.c.
570 signal.o: signal.c
571         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
573 ifeq ($(TARGET_BASE_ARCH), i386)
574 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
575 endif
577 ifeq ($(TARGET_ARCH), arm)
578 op.o: op.c op_template.h
579 pl110.o: pl110_template.h
580 endif
582 ifeq ($(TARGET_BASE_ARCH), sparc)
583 op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
584 magic_load.o: elf_op.h
585 endif
587 ifeq ($(TARGET_BASE_ARCH), ppc)
588 op.o: op.c op_template.h op_mem.h
589 op_helper.o: op_helper_mem.h
590 translate.o: translate.c translate_init.c
591 endif
593 ifeq ($(TARGET_BASE_ARCH), mips)
594 helper.o: cpu.h exec-all.h
595 op.o: op_template.c fop_template.c op_mem.c exec.h
596 op_helper.o: op_helper_mem.c exec.h softmmu_template.h
597 translate.o: translate_init.c exec-all.h disas.h
598 endif
600 loader.o: loader.c elf_ops.h
602 ifeq ($(TARGET_ARCH), sh4)
603 op.o: op.c op_mem.c cpu.h
604 op_helper.o: op_helper.c exec.h cpu.h
605 helper.o: helper.c exec.h cpu.h
606 sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
607 shix.o: shix.c sh7750_regs.h sh7750_regnames.h
608 sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
609 tc58128.o: tc58128.c
610 endif
612 ifeq ($(TARGET_BASE_ARCH), alpha)
613 op.o: op.c op_template.h op_mem.h
614 op_helper.o: op_helper_mem.h
615 endif
617 $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
619 %.o: %.c
620         $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
622 %.o: %.S
623         $(CC) $(CPPFLAGS) -c -o $@ $<
625 clean:
626         rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
628 install: all 
629 ifneq ($(PROGS),)
630         $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
631 endif
633 ifneq ($(wildcard .depend),)
634 include .depend
635 endif
637 ifeq (1, 0)
638 audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
639 fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
640 CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
641 endif