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