Add new block driver for the VDI format (only aio supported)
[qemu] / Makefile.target
1 include config.mak
2 include $(SRC_PATH)/rules.mak
3
4 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
5 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
6 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
7 #CFLAGS+=-Werror
8 LIBS=
9
10 ifdef CONFIG_USER_ONLY
11 # user emulator name
12 QEMU_PROG=qemu-$(TARGET_ARCH2)
13 else
14 # system emulator name
15 ifeq ($(TARGET_ARCH), i386)
16 QEMU_PROG=qemu$(EXESUF)
17 else
18 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
19 endif
20 endif
21
22 PROGS=$(QEMU_PROG)
23
24 HELPER_CFLAGS=
25
26 ifeq ($(ARCH),i386)
27 HELPER_CFLAGS+=-fomit-frame-pointer
28 endif
29
30 ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
31 translate.o: CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-unit-at-a-time,)
32 endif
33
34 ifeq ($(ARCH),sparc)
35   ifneq ($(CONFIG_SOLARIS),y)
36     HELPER_CFLAGS+=-ffixed-i0
37   endif
38 endif
39
40 ifeq ($(ARCH),alpha)
41 # Ensure there's only a single GP
42 CFLAGS+=-msmall-data
43 endif
44
45 ifeq ($(ARCH),ia64)
46 CFLAGS+=-mno-sdata
47 endif
48
49 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
50 CPPFLAGS+=-U_FORTIFY_SOURCE
51 LIBS+=-lm
52 ifdef CONFIG_WIN32
53 LIBS+=-lwinmm -lws2_32 -liphlpapi
54 endif
55 ifdef CONFIG_SOLARIS
56 LIBS+=-lsocket -lnsl -lresolv
57 ifdef CONFIG_NEEDS_LIBSUNMATH
58 LIBS+=-lsunmath
59 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
60 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
61 endif
62 endif
63
64 kvm.o: CFLAGS+=$(KVM_CFLAGS)
65 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
66
67 all: $(PROGS)
68 # Dummy command so that make thinks it has done something
69         @true
70
71 #########################################################
72 # cpu emulator library
73 libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o
74 libobj-$(CONFIG_KQEMU) += kqemu.o
75 # TCG code generator
76 libobj-y += tcg/tcg.o tcg/tcg-runtime.o
77 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
78 ifeq ($(ARCH),sparc64)
79 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
80 endif
81 ifdef CONFIG_SOFTFLOAT
82 libobj-y += fpu/softfloat.o
83 else
84 libobj-y += fpu/softfloat-native.o
85 endif
86 CPPFLAGS+=-I$(SRC_PATH)/fpu
87 libobj-y += op_helper.o helper.o
88
89 ifeq ($(TARGET_BASE_ARCH), arm)
90 libobj-y += neon_helper.o iwmmxt_helper.o
91 endif
92
93 ifeq ($(TARGET_BASE_ARCH), alpha)
94 libobj-y += alpha_palcode.o
95 endif
96
97 ifeq ($(TARGET_BASE_ARCH), cris)
98 libobj-y += cris-dis.o
99
100 ifndef CONFIG_USER_ONLY
101 libobj-y += mmu.o
102 endif
103 endif
104
105 # NOTE: the disassembler code is only needed for debugging
106 libobj-y += disas.o
107 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
108 USE_I386_DIS=y
109 endif
110 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
111 USE_I386_DIS=y
112 endif
113 libobj-$(USE_I386_DIS) += i386-dis.o
114 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
115 libobj-y += alpha-dis.o
116 endif
117 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
118 libobj-y += ppc-dis.o
119 endif
120 ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze)
121 libobj-y += microblaze-dis.o
122 ifndef CONFIG_USER_ONLY
123 libobj-y += mmu.o
124 endif
125 endif
126 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
127 libobj-y += mips-dis.o
128 endif
129 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
130 libobj-y += sparc-dis.o
131 endif
132 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
133 libobj-y += arm-dis.o
134 endif
135 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
136 libobj-y += m68k-dis.o
137 endif
138 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
139 libobj-y += sh4-dis.o
140 endif
141 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
142 libobj-y += hppa-dis.o
143 endif
144 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
145 libobj-y += s390-dis.o
146 endif
147
148 # libqemu
149
150 libqemu.a: $(libobj-y)
151
152 translate.o: translate.c cpu.h
153
154 translate-all.o: translate-all.c cpu.h
155
156 tcg/tcg.o: cpu.h
157
158 # HELPER_CFLAGS is used for all the code compiled with static register
159 # variables
160 op_helper.o: CFLAGS += $(HELPER_CFLAGS)
161
162 cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
163
164 #########################################################
165 # Linux user emulator target
166
167 ifdef CONFIG_LINUX_USER
168
169 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
170 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
171
172 # profiling code
173 ifdef TARGET_GPROF
174 LDFLAGS+=-p
175 CFLAGS+=-p
176 endif
177
178 obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
179       elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o \
180       ioport-user.o
181 obj-$(TARGET_HAS_BFLT) += flatload.o
182
183 ifdef TARGET_HAS_ELFLOAD32
184 elfload32.o: elfload.c
185 endif
186 obj-$(TARGET_HAS_ELFLOAD32) += elfload32.o
187
188 ifeq ($(TARGET_ARCH), i386)
189 obj-y += vm86.o
190 endif
191
192 nwfpe-obj-y := fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o
193 nwfpe-obj-y += single_cpdo.o double_cpdo.o extended_cpdo.o
194 obj-arm-y +=  $(addprefix nwfpe/, $(nwfpe-obj-y))
195 obj-arm-y += arm-semi.o
196
197 obj-m68k-y += m68k-sim.o m68k-semi.o
198
199 # Note: this is a workaround. The real fix is to avoid compiling
200 # cpu_signal_handler() in cpu-exec.c.
201 signal.o: CFLAGS += $(HELPER_CFLAGS)
202
203 ARLIBS=../libqemu_user.a libqemu.a
204 endif #CONFIG_LINUX_USER
205
206 LIBS+= $(PTHREADLIBS)
207 LIBS+= $(CLOCKLIBS)
208
209 #########################################################
210 # Darwin user emulator target
211
212 ifdef CONFIG_DARWIN_USER
213
214 VPATH+=:$(SRC_PATH)/darwin-user
215 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
216
217 # Leave some space for the regular program loading zone
218 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
219
220 LIBS+=-lmx
221
222 obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
223         gdbstub.o gdbstub-xml.o ioport-user.o
224
225 # Note: this is a workaround. The real fix is to avoid compiling
226 # cpu_signal_handler() in cpu-exec.c.
227 signal.o: CFLAGS += $(HELPER_CFLAGS)
228
229 ARLIBS=libqemu.a
230
231 endif #CONFIG_DARWIN_USER
232
233 #########################################################
234 # BSD user emulator target
235
236 ifdef CONFIG_BSD_USER
237
238 VPATH+=:$(SRC_PATH)/bsd-user
239 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
240
241 obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
242         gdbstub.o gdbstub-xml.o ioport-user.o
243 obj-y += uaccess.o
244
245 # Note: this is a workaround. The real fix is to avoid compiling
246 # cpu_signal_handler() in cpu-exec.c.
247 signal.o: CFLAGS += $(HELPER_CFLAGS)
248
249 ARLIBS=libqemu.a ../libqemu_user.a
250
251 endif #CONFIG_BSD_USER
252
253 #########################################################
254 # System emulator target
255 ifndef CONFIG_USER_ONLY
256
257 obj-y = vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
258         gdbstub.o gdbstub-xml.o msix.o ioport.o qemu-config.o
259 # virtio has to be here due to weird dependency between PCI and virtio-net.
260 # need to fix this properly
261 obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
262 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
263
264 LIBS+=-lz
265 ifdef CONFIG_ALSA
266 LIBS += -lasound
267 endif
268 ifdef CONFIG_ESD
269 LIBS += -lesd
270 endif
271 ifdef CONFIG_PA
272 LIBS += -lpulse-simple
273 endif
274 ifdef CONFIG_DSOUND
275 LIBS += -lole32 -ldxguid
276 endif
277 ifdef CONFIG_FMOD
278 LIBS += $(FMOD_LIBS)
279 endif
280 ifdef CONFIG_OSS
281 LIBS += $(OSS_LIBS)
282 endif
283
284 sound-obj-y =
285 sound-obj-$(CONFIG_SB16) += sb16.o
286 sound-obj-$(CONFIG_ES1370) += es1370.o
287 sound-obj-$(CONFIG_AC97) += ac97.o
288 sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
289 sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
290 sound-obj-$(CONFIG_CS4231A) += cs4231a.o
291
292 ifdef CONFIG_ADLIB
293 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
294 endif
295
296 ifdef CONFIG_VNC_TLS
297 CPPFLAGS += $(VNC_TLS_CFLAGS)
298 LIBS += $(VNC_TLS_LIBS)
299 endif
300
301 ifdef CONFIG_VNC_SASL
302 CPPFLAGS += $(VNC_SASL_CFLAGS)
303 LIBS += $(VNC_SASL_LIBS)
304 endif
305
306 ifdef CONFIG_BLUEZ
307 LIBS += $(BLUEZ_LIBS)
308 endif
309
310 # xen backend driver support
311 obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
312 ifeq ($(CONFIG_XEN), y)
313   LIBS += $(XEN_LIBS)
314 endif
315
316 # USB layer
317 obj-y += usb-ohci.o
318
319 # PCI network cards
320 obj-y += eepro100.o
321 obj-y += ne2000.o
322 obj-y += pcnet.o
323 obj-y += rtl8139.o
324 obj-y += e1000.o
325
326 # Generic watchdog support and some watchdog devices
327 obj-y += wdt_ib700.o wdt_i6300esb.o
328
329 # Hardware support
330 obj-i386-y = ide.o pckbd.o vga.o $(sound-obj-y) dma.o isa-bus.o
331 obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
332 obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
333 obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
334 obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o
335
336 ifeq ($(TARGET_BASE_ARCH), i386)
337 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
338 endif
339
340 # shared objects
341 obj-ppc-y = ppc.o ide.o vga.o $(sound-obj-y) dma.o isa-bus.o openpic.o
342 # PREP target
343 obj-ppc-y += pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o
344 obj-ppc-y += prep_pci.o ppc_prep.o
345 # Mac shared devices
346 obj-ppc-y += macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
347 # OldWorld PowerMac
348 obj-ppc-y += heathrow_pic.o grackle_pci.o ppc_oldworld.o
349 # NewWorld PowerMac
350 obj-ppc-y += unin_pci.o ppc_newworld.o
351 # PowerPC 4xx boards
352 obj-ppc-y += pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
353 obj-ppc-y += ppc440.o ppc440_bamboo.o
354 # PowerPC E500 boards
355 obj-ppc-y += ppce500_pci.o ppce500_mpc8544ds.o
356 obj-ppc-$(CONFIG_KVM) += kvm_ppc.o
357
358 ifeq ($(TARGET_BASE_ARCH), ppc)
359 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
360 endif
361
362 obj-ppc-$(CONFIG_FDT) += device_tree.o
363 LIBS+= $(FDT_LIBS)
364
365 obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
366 obj-mips-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
367 obj-mips-y += g364fb.o jazz_led.o dp8393x.o
368 obj-mips-y += ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
369 obj-mips-y += piix_pci.o parallel.o cirrus_vga.o isa-bus.o pcspk.o $(sound-obj-y)
370 obj-mips-y += mipsnet.o
371 obj-mips-y += pflash_cfi01.o
372 obj-mips-y += vmware_vga.o
373
374 ifeq ($(TARGET_BASE_ARCH), mips)
375 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
376 endif
377
378 obj-microblaze-y = petalogix_s3adsp1800_mmu.o
379
380 obj-microblaze-y += microblaze_pic_cpu.o
381 obj-microblaze-y += xilinx_intc.o
382 obj-microblaze-y += xilinx_timer.o
383 obj-microblaze-y += xilinx_uartlite.o
384 obj-microblaze-y += xilinx_ethlite.o
385
386 obj-microblaze-y += pflash_cfi02.o
387
388 obj-microblaze-$(CONFIG_FDT) += device_tree.o
389 LIBS+= $(FDT_LIBS)
390
391 # Boards
392 obj-cris-y = cris_pic_cpu.o etraxfs.o axis_dev88.o
393
394 # IO blocks
395 obj-cris-y += etraxfs_dma.o
396 obj-cris-y += etraxfs_pic.o
397 obj-cris-y += etraxfs_eth.o
398 obj-cris-y += etraxfs_timer.o
399 obj-cris-y += etraxfs_ser.o
400
401 obj-cris-y += pflash_cfi02.o
402
403 ifeq ($(TARGET_ARCH), sparc64)
404 obj-sparc-y = sun4u.o ide.o isa-bus.o pckbd.o vga.o apb_pci.o
405 obj-sparc-y += fdc.o mc146818rtc.o serial.o
406 obj-sparc-y += cirrus_vga.o parallel.o
407 else
408 obj-sparc-y = sun4m.o tcx.o iommu.o slavio_intctl.o
409 obj-sparc-y += slavio_timer.o slavio_misc.o fdc.o isa-bus.o sparc32_dma.o
410 obj-sparc-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o
411 endif
412
413 obj-arm-y = integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
414 obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
415 obj-arm-y += versatile_pci.o
416 obj-arm-y += realview_gic.o realview.o arm_sysctl.o mpcore.o
417 obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
418 obj-arm-y += pl061.o
419 obj-arm-y += arm-semi.o
420 obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
421 obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
422 obj-arm-y += pflash_cfi01.o gumstix.o
423 obj-arm-y += zaurus.o ide.o serial.o spitz.o tosa.o tc6393xb.o
424 obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
425 obj-arm-y += omap2.o omap_dss.o soc_dma.o
426 obj-arm-y += omap_sx1.o palm.o tsc210x.o
427 obj-arm-y += nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
428 obj-arm-y += mst_fpga.o mainstone.o
429 obj-arm-y += musicpal.o pflash_cfi02.o
430 obj-arm-y += framebuffer.o
431 obj-arm-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
432 obj-arm-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
433 obj-arm-y += syborg_virtio.o
434
435 ifeq ($(TARGET_BASE_ARCH), arm)
436 CPPFLAGS += -DHAS_AUDIO
437 endif
438
439 obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
440 obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
441 obj-sh4-y += ide.o
442
443 obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
444 obj-m68k-y += m68k-semi.o dummy_m68k.o
445
446 ifdef CONFIG_COCOA
447 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
448 ifdef CONFIG_COREAUDIO
449 COCOA_LIBS+=-framework CoreAudio
450 endif
451 endif
452 ifdef CONFIG_SLIRP
453 CPPFLAGS+=-I$(SRC_PATH)/slirp
454 endif
455
456 # specific flags are needed for non soft mmu emulator
457 ifndef CONFIG_DARWIN
458 ifndef CONFIG_WIN32
459 ifndef CONFIG_SOLARIS
460 ifndef CONFIG_AIX
461 LIBS+=-lutil
462 endif
463 endif
464 endif
465 endif
466 ifdef TARGET_GPROF
467 vl.o: CFLAGS+=-p
468 LDFLAGS+=-p
469 endif
470
471 ifeq ($(ARCH),ia64)
472 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
473 endif
474
475 ifdef CONFIG_WIN32
476 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
477 endif
478
479 # profiling code
480 ifdef TARGET_GPROF
481 LDFLAGS+=-p
482 main.o: CFLAGS+=-p
483 endif
484
485 vl.o: CFLAGS+=$(SDL_CFLAGS)
486
487 vl.o: qemu-options.h
488
489 monitor.o: qemu-monitor.h
490
491 LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
492 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
493
494 endif # !CONFIG_USER_ONLY
495
496 $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS)
497         $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
498
499
500 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
501 ifeq ($(TARGET_XML_FILES),)
502         $(call quiet-command,rm -f $@ && echo > $@,"  GEN   $(TARGET_DIR)$@")
503 else
504         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
505 endif
506
507 qemu-options.h: $(SRC_PATH)/qemu-options.hx
508         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
509
510 qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx
511         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
512
513 clean:
514         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
515         rm -f *.d */*.d tcg/*.o
516         rm -f qemu-options.h qemu-monitor.h gdbstub-xml.c
517
518 install: all
519 ifneq ($(PROGS),)
520         $(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)"
521 endif
522
523 # Include automatically generated dependency files
524 -include $(wildcard *.d */*.d)