Initialize
[sdk/emulator/qemu.git] / Makefile.target
1 # -*- Mode: makefile -*-
2
3 GENERATED_HEADERS = config-target.h
4 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
5 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
6
7 include ../config-host.mak
8 include config-devices.mak
9 include config-target.mak
10 include $(SRC_PATH)/rules.mak
11 ifneq ($(HWDIR),)
12 include $(HWDIR)/config.mak
13 endif
14
15 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
16 $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/tizen/src/hw)
17 QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -I$(SRC_PATH)/hw -DNEED_CPU_H
18
19 include $(SRC_PATH)/Makefile.objs
20
21 ifdef CONFIG_USER_ONLY
22 # user emulator name
23 QEMU_PROG=qemu-$(TARGET_ARCH2)
24 else
25 # system emulator name
26 ifeq ($(TARGET_ARCH), i386)
27 QEMU_PROG=qemu$(EXESUF)
28 GUEST_GL_LIB=$(TARGET_PATH)/libGL.so.1
29 else
30 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
31 GUEST_GL_LIB=
32 endif
33 endif
34
35 PROGS=$(QEMU_PROG)
36 STPFILES=
37
38 ifndef CONFIG_HAIKU
39 LIBS+=-lm
40 endif
41
42 kvm.o kvm-all.o vhost.o vhost_net.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
43
44 config-target.h: config-target.h-timestamp
45 config-target.h-timestamp: config-target.mak
46
47 ifdef CONFIG_SYSTEMTAP_TRACE
48 stap: $(QEMU_PROG).stp
49
50 ifdef CONFIG_USER_ONLY
51 TARGET_TYPE=user
52 else
53 TARGET_TYPE=system
54 endif
55
56 $(QEMU_PROG).stp:
57         $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool \
58                 --$(TRACE_BACKEND) \
59                 --binary $(bindir)/$(QEMU_PROG) \
60                 --target-arch $(TARGET_ARCH) \
61                 --target-type $(TARGET_TYPE) \
62                 --stap < $(SRC_PATH)/trace-events > $(QEMU_PROG).stp,"  GEN   $(QEMU_PROG).stp")
63 else
64 stap:
65 endif
66
67 #all: $(PROGS) $(GUEST_GL_LIB) stap
68 all: libccc.a $(GUEST_GL_LIB)
69
70 # Dummy command so that make thinks it has done something
71         @true
72
73 #########################################################
74 # cpu emulator library
75 libobj-y = exec.o translate-all.o cpu-exec.o translate.o
76 libobj-y += tcg/tcg.o tcg/optimize.o
77 libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o
78 libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o
79 libobj-y += op_helper.o helper.o
80 ifeq ($(TARGET_BASE_ARCH), i386)
81 libobj-y += cpuid.o
82 endif
83 libobj-$(CONFIG_NEED_MMU) += mmu.o
84 libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
85
86 libobj-y += disas.o
87
88 $(libobj-y): $(GENERATED_HEADERS)
89
90 # libqemu
91
92 translate.o: translate.c cpu.h
93
94 translate-all.o: translate-all.c cpu.h
95
96 tcg/tcg.o: cpu.h
97
98 # HELPER_CFLAGS is used for all the code compiled with static register
99 # variables
100 op_helper.o cpu-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
101
102 # Note: this is a workaround. The real fix is to avoid compiling
103 # cpu_signal_handler() in cpu-exec.c.
104 signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
105
106 #########################################################
107 # Linux user emulator target
108
109 ifdef CONFIG_LINUX_USER
110
111 $(call set-vpath, $(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR))
112
113 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
114 obj-y = main.o syscall.o strace.o mmap.o signal.o thunk.o \
115       elfload.o linuxload.o uaccess.o gdbstub.o cpu-uname.o \
116       qemu-malloc.o $(oslib-obj-y)
117
118 obj-$(TARGET_HAS_BFLT) += flatload.o
119
120 obj-$(TARGET_I386) += vm86.o
121
122 obj-i386-y += ioport-user.o
123
124 nwfpe-obj-y = fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o
125 nwfpe-obj-y += single_cpdo.o double_cpdo.o extended_cpdo.o
126 obj-arm-y +=  $(addprefix nwfpe/, $(nwfpe-obj-y))
127 obj-arm-y += arm-semi.o
128
129 obj-m68k-y += m68k-sim.o m68k-semi.o
130
131 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
132
133 obj-y += $(addprefix ../libuser/, $(user-obj-y))
134 obj-y += $(addprefix ../libdis-user/, $(libdis-y))
135 obj-y += $(libobj-y)
136
137 endif #CONFIG_LINUX_USER
138
139 #########################################################
140 # Darwin user emulator target
141
142 ifdef CONFIG_DARWIN_USER
143
144 $(call set-vpath, $(SRC_PATH)/darwin-user)
145
146 QEMU_CFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
147
148 # Leave some space for the regular program loading zone
149 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
150
151 LIBS+=-lmx
152
153 obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
154         gdbstub.o
155
156 obj-i386-y += ioport-user.o
157
158 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
159
160 obj-y += $(addprefix ../libuser/, $(user-obj-y))
161 obj-y += $(addprefix ../libdis-user/, $(libdis-y))
162 obj-y += $(libobj-y)
163
164 endif #CONFIG_DARWIN_USER
165
166 #########################################################
167 # BSD user emulator target
168
169 ifdef CONFIG_BSD_USER
170
171 $(call set-vpath, $(SRC_PATH)/bsd-user)
172
173 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
174
175 obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
176         gdbstub.o uaccess.o
177
178 obj-i386-y += ioport-user.o
179
180 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
181
182 obj-y += $(addprefix ../libuser/, $(user-obj-y))
183 obj-y += $(addprefix ../libdis-user/, $(libdis-y))
184 obj-y += $(libobj-y)
185
186 endif #CONFIG_BSD_USER
187
188 #########################################################
189 # System emulator target
190 ifdef CONFIG_SOFTMMU
191
192 obj-y = arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o
193 # virtio has to be here due to weird dependency between PCI and virtio-net.
194 # need to fix this properly
195 obj-$(CONFIG_NO_PCI) += pci-stub.o
196 obj-$(CONFIG_VIRTIO) += virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o virtio-gpi.o
197 obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
198 obj-y += vhost_net.o
199 obj-$(CONFIG_VHOST_NET) += vhost.o
200 obj-$(CONFIG_REALLY_VIRTFS) += virtio-9p.o
201 obj-y += rwhandler.o
202 obj-y += sdb.o
203 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
204 obj-$(CONFIG_NO_KVM) += kvm-stub.o
205 LIBS+=-lz
206
207 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
208 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
209 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
210 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
211
212 # xen backend driver support
213 obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
214
215 # Inter-VM PCI shared memory
216 obj-$(CONFIG_KVM) += ivshmem.o
217
218 # Hardware support
219 obj-i386-y += vga.o
220 obj-i386-y += mc146818rtc.o i8259.o pc.o
221 obj-i386-y += cirrus_vga.o apic.o ioapic.o piix_pci.o
222 obj-i386-y += vmmouse.o vmport.o hpet.o applesmc.o
223 obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
224 obj-i386-y += debugcon.o multiboot.o
225 obj-i386-y += pc_piix.o
226 obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
227
228 ##########################################################
229 # opengl library for i386 
230 obj-i386-y += helper_opengl.o opengl_exec.o opengl_server.o
231 ##########################################################
232
233 ##########################################################
234 # general purpose interface for i386 
235 obj-i386-y += helper_gpi.o
236 ##########################################################
237
238 # shared objects
239 obj-ppc-y = ppc.o
240 obj-ppc-y += vga.o
241 # PREP target
242 obj-ppc-y += i8259.o mc146818rtc.o
243 obj-ppc-y += ppc_prep.o
244 # OldWorld PowerMac
245 obj-ppc-y += ppc_oldworld.o
246 # NewWorld PowerMac
247 obj-ppc-y += ppc_newworld.o
248 # PowerPC 4xx boards
249 obj-ppc-y += ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
250 obj-ppc-y += ppc440.o ppc440_bamboo.o
251 # PowerPC E500 boards
252 obj-ppc-y += ppce500_mpc8544ds.o
253 # PowerPC 440 Xilinx ML507 reference board.
254 obj-ppc-y += virtex_ml507.o
255 obj-ppc-$(CONFIG_KVM) += kvm_ppc.o
256 obj-ppc-$(CONFIG_FDT) += device_tree.o
257
258 # Xilinx PPC peripherals
259 obj-ppc-y += xilinx_intc.o
260 obj-ppc-y += xilinx_timer.o
261 obj-ppc-y += xilinx_uartlite.o
262 obj-ppc-y += xilinx_ethlite.o
263
264 obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
265 obj-mips-y += mips_addr.o mips_timer.o mips_int.o
266 obj-mips-y += vga.o i8259.o
267 obj-mips-y += g364fb.o jazz_led.o
268 obj-mips-y += gt64xxx.o mc146818rtc.o
269 obj-mips-y += cirrus_vga.o
270 obj-mips-$(CONFIG_FULONG) += bonito.o vt82c686.o mips_fulong2e.o
271
272 obj-microblaze-y = petalogix_s3adsp1800_mmu.o
273
274 obj-microblaze-y += microblaze_pic_cpu.o
275 obj-microblaze-y += xilinx_intc.o
276 obj-microblaze-y += xilinx_timer.o
277 obj-microblaze-y += xilinx_uartlite.o
278 obj-microblaze-y += xilinx_ethlite.o
279
280 obj-microblaze-$(CONFIG_FDT) += device_tree.o
281
282 # Boards
283 obj-cris-y = cris_pic_cpu.o
284 obj-cris-y += cris-boot.o
285 obj-cris-y += etraxfs.o axis_dev88.o
286 obj-cris-y += axis_dev88.o
287
288 # IO blocks
289 obj-cris-y += etraxfs_dma.o
290 obj-cris-y += etraxfs_pic.o
291 obj-cris-y += etraxfs_eth.o
292 obj-cris-y += etraxfs_timer.o
293 obj-cris-y += etraxfs_ser.o
294
295 ifeq ($(TARGET_ARCH), sparc64)
296 obj-sparc-y = sun4u.o apb_pci.o
297 obj-sparc-y += vga.o
298 obj-sparc-y += mc146818rtc.o
299 obj-sparc-y += cirrus_vga.o
300 else
301 obj-sparc-y = sun4m.o lance.o tcx.o sun4m_iommu.o slavio_intctl.o
302 obj-sparc-y += slavio_timer.o slavio_misc.o sparc32_dma.o
303 obj-sparc-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o leon3.o
304
305 # GRLIB
306 obj-sparc-y += grlib_gptimer.o grlib_irqmp.o grlib_apbuart.o
307 endif
308
309 obj-arm-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o
310 obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
311 obj-arm-y += versatile_pci.o
312 obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o
313 obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
314 obj-arm-y += pl061.o
315 obj-arm-y += arm-semi.o
316 obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
317 obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
318 obj-arm-y += gumstix.o
319 obj-arm-y += zaurus.o ide/microdrive.o spitz.o tosa.o tc6393xb.o
320 obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o \
321                 omap_gpio.o omap_intc.o omap_uart.o
322 obj-arm-y += omap2.o omap_dss.o soc_dma.o omap_gptimer.o omap_synctimer.o \
323                 omap_gpmc.o omap_sdrc.o omap_spi.o omap_tap.o omap_l4.o
324 obj-arm-y += omap_sx1.o palm.o tsc210x.o
325 obj-arm-y += nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
326 obj-arm-y += mst_fpga.o mainstone.o
327 obj-arm-y += musicpal.o bitbang_i2c.o marvell_88w8618_audio.o
328 obj-arm-y += framebuffer.o
329 obj-arm-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
330 obj-arm-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
331 obj-arm-y += syborg_virtio.o
332
333 obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
334 obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
335 obj-sh4-y += ide/mmio.o
336
337 obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
338 obj-m68k-y += m68k-semi.o dummy_m68k.o
339
340 obj-s390x-y = s390-virtio-bus.o s390-virtio.o
341
342 obj-alpha-y = alpha_palcode.o
343
344 #
345 # TIZEN hw
346 #
347
348 # x86
349 obj-i386-y += tizen-board.o
350 obj-i386-y += tizen-ac97.o
351 obj-i386-y += overlay.o
352 obj-i386-y += brightness.o
353 obj-i386-y += maru_touchscreen.o
354 obj-i386-y += maru_pm.o
355 obj-i386-$(CONFIG_PCI) += svcamera_pci.o
356 obj-i386-$(CONFIG_LINUX) += svcamera_linux.o
357 obj-i386-$(CONFIG_WIN32) += svcamera_win32.o
358
359 ifdef CONFIG_FFMPEG
360 obj-i386-y += maru_codec.o
361 LIBS+=-lavformat -lavcodec -lavutil -lswscale -lbz2
362 CFLAGS+=$(FFMPEG_CFLAGS)
363 endif
364
365 # arm
366 # common
367
368
369
370 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
371
372 monitor.o: hmp-commands.h qmp-commands.h
373
374 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
375
376 obj-y += $(addprefix ../, $(common-obj-y))
377 obj-y += $(addprefix ../libdis/, $(libdis-y))
378 obj-y += $(libobj-y)
379 obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
380
381 endif # CONFIG_SOFTMMU
382
383 obj-y += $(addprefix ../, $(trace-obj-y))
384 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
385
386 #$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
387 #       $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
388
389 libccc.a: $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
390         rm -f libccc.a-$(TARGET_ARCH2)
391         @$(AR) rcs libccc.a $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) 
392
393
394
395 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
396         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
397
398 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
399         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
400
401 qmp-commands.h: $(SRC_PATH)/qmp-commands.hx
402         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
403 ##########################################################
404 # Build openGL
405 # i386
406 ifeq ($(TARGET_ARCH), i386)
407 parse_gl_h: $(TARGET_PATH)/parse_gl_h.c
408         $(CC) -Wall -O2 -g $< -o $@
409
410 client_stub.c server_stub.c gl_func.h: parse_gl_h
411         ./parse_gl_h
412
413 opengl_exec.o: opengl_exec.c server_stub.c gl_func.h
414
415 opengl_server.o: opengl_server.c opengl_exec.c
416
417 helper_opengl.o: gl_func.h
418
419 $(TARGET_PATH)/libGL.so.1: opengl_client.c gl_func.h
420         $(CC) -I$(TARGET_PATH) -I. -Wall -g -O2 $< -shared -o $@
421 endif
422
423 # arm
424 #gles1_calls.o: gles1_calls.c gles2.h gles2_calls.h
425 #gles2_calls.o: gles2_calls.c gles2.h gles2_calls.h
426 #gles2.o: gles2.c gles2.h gles2_calls.h
427
428 ##########################################################
429
430 clean:
431         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
432         rm -f *.d */*.d tcg/*.o ide/*.o
433         rm -f hmp-commands.h qmp-commands.h gdbstub-xml.c
434 ifdef CONFIG_SYSTEMTAP_TRACE
435         rm -f *.stp
436 endif
437
438 install: all
439 ifneq ($(PROGS),)
440         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
441 ifneq ($(STRIP),)
442         $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
443 endif
444 endif
445 ifdef CONFIG_SYSTEMTAP_TRACE
446         $(INSTALL_DIR) "$(DESTDIR)$(datadir)/../systemtap/tapset"
447         $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(datadir)/../systemtap/tapset"
448 endif
449
450 # Include automatically generated dependency files
451 -include $(wildcard *.d */*.d)