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