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