update source for tizen_2.1
[sdk/emulator/qemu.git] / Makefile.target
1 # -*- Mode: makefile -*-
2
3 include ../config-host.mak
4 include config-devices.mak
5 include config-target.mak
6 include $(SRC_PATH)/rules.mak
7 ifneq ($(HWDIR),)
8 include $(HWDIR)/config.mak
9 endif
10
11 $(call set-vpath, $(SRC_PATH))
12 ifdef CONFIG_LINUX
13 QEMU_CFLAGS += -I../linux-headers
14 endif
15 QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H
16
17 QEMU_CFLAGS+=-I$(SRC_PATH)/include
18
19 ifdef CONFIG_USER_ONLY
20 # user emulator name
21 QEMU_PROG=qemu-$(TARGET_ARCH2)
22 else
23 # system emulator name
24 ifneq (,$(findstring -mwindows,$(LIBS)))
25 # Terminate program name with a 'w' because the linker builds a windows executable.
26 QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
27 endif # windows executable
28 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
29 endif
30
31 PROGS=$(QEMU_PROG)
32 ifdef QEMU_PROGW
33 PROGS+=$(QEMU_PROGW)
34 endif
35 STPFILES=
36
37 ifndef CONFIG_HAIKU
38 LIBS+=-lm
39 endif
40
41 config-target.h: config-target.h-timestamp
42 config-target.h-timestamp: config-target.mak
43
44 ifdef CONFIG_TRACE_SYSTEMTAP
45 stap: $(QEMU_PROG).stp
46
47 ifdef CONFIG_USER_ONLY
48 TARGET_TYPE=user
49 else
50 TARGET_TYPE=system
51 endif
52
53 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
54         $(call quiet-command,$(TRACETOOL) \
55                 --format=stap \
56                 --backend=$(TRACE_BACKEND) \
57                 --binary=$(bindir)/$(QEMU_PROG) \
58                 --target-arch=$(TARGET_ARCH) \
59                 --target-type=$(TARGET_TYPE) \
60                 < $< > $@,"  GEN   $(QEMU_PROG).stp")
61 else
62 stap:
63 endif
64
65 all: $(PROGS) stap check-gl
66
67 # Dummy command so that make thinks it has done something
68         @true
69
70 #########################################################
71 # cpu emulator library
72 obj-y = exec.o translate-all.o cpu-exec.o
73 obj-y += tcg/tcg.o tcg/optimize.o
74 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
75 obj-y += fpu/softfloat.o
76 obj-y += disas.o
77 obj-$(CONFIG_TCI_DIS) += tci-dis.o
78 obj-y += target-$(TARGET_BASE_ARCH)/
79 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
80
81 tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
82
83 # HELPER_CFLAGS is used for all the legacy code compiled with static register
84 # variables
85 user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
86
87 # Note: this is a workaround. The real fix is to avoid compiling
88 # cpu_signal_handler() in user-exec.c.
89 %/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
90
91 #########################################################
92 # Linux user emulator target
93
94 ifdef CONFIG_LINUX_USER
95
96 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
97
98 obj-y += linux-user/
99 obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
100
101 endif #CONFIG_LINUX_USER
102
103 #########################################################
104 # BSD user emulator target
105
106 ifdef CONFIG_BSD_USER
107
108 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
109
110 obj-y += bsd-user/
111 obj-y += gdbstub.o user-exec.o $(oslib-obj-y)
112
113 endif #CONFIG_BSD_USER
114
115 #########################################################
116 # System emulator target
117 ifdef CONFIG_SOFTMMU
118 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
119 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
120 CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
121 CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
122 CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
123
124 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
125 obj-y += hw/
126 obj-$(CONFIG_KVM) += kvm-all.o
127 obj-$(CONFIG_NO_KVM) += kvm-stub.o
128 obj-y += memory.o savevm.o cputlb.o
129 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
130 obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
131 obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
132 obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
133 LIBS+=-lz
134
135 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
136 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
137 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
138 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
139
140 # xen support
141 obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
142 obj-$(CONFIG_NO_XEN) += xen-stub.o
143
144 # HAX support
145 ifdef CONFIG_WIN32
146 obj-$(CONFIG_HAX) += target-i386/hax-all.o target-i386/hax-windows.o
147 obj-$(CONFIG_NO_HAX) += hax-stub.o
148 endif
149 ifdef CONFIG_DARWIN
150 obj-$(CONFIG_HAX) += target-i386/hax-all.o target-i386/hax-darwin.o
151 obj-$(CONFIG_NO_HAX) += hax-stub.o
152 endif
153
154 # Hardware support
155 ifeq ($(TARGET_ARCH), sparc64)
156 obj-y += hw/sparc64/
157 else
158 obj-y += hw/$(TARGET_BASE_ARCH)/
159 endif
160
161 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
162
163 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
164
165 endif # CONFIG_SOFTMMU
166
167 nested-vars += obj-y
168
169 # Makefile for TIZEN-maru
170 ifdef CONFIG_MARU
171 include $(SRC_PATH)/tizen/src/Makefile.tizen
172 endif
173 ##
174
175 ifdef CONFIG_BUILD_YAGL
176
177 # YaGL
178 QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl_inc
179
180 $(call set-vpath, $(SRC_PATH)/hw/yagl_apis/egl: \
181                   $(SRC_PATH)/hw/yagl_apis/gles: \
182                   $(SRC_PATH)/hw/yagl_apis/gles1: \
183                   $(SRC_PATH)/hw/yagl_apis/gles2: \
184                   $(SRC_PATH)/hw/yagl_drivers/egl_glx: \
185                   $(SRC_PATH)/hw/yagl_drivers/gles_ogl: \
186                   $(SRC_PATH)/hw/yagl_drivers/gles1_ogl: \
187                   $(SRC_PATH)/hw/yagl_drivers/gles2_ogl)
188
189 obj-y += yagl_device.o
190 obj-y += yagl_log.o
191 obj-y += yagl_process.o
192 obj-y += yagl_thread.o
193 obj-y += yagl_server.o
194 obj-y += yagl_ref.o
195 obj-y += yagl_mem.o
196 obj-y += yagl_mem_egl.o
197 obj-y += yagl_mem_gl.o
198 obj-y += yagl_mem_transfer.o
199 obj-y += yagl_event.o
200 obj-y += yagl_handle_gen.o
201 obj-y += yagl_dyn_lib.o
202 obj-y += yagl_api.o
203 obj-y += yagl_vector.o
204 obj-y += yagl_avl.o
205 obj-y += yagl_range_list.o
206 obj-y += yagl_egl_driver.o
207 obj-y += yagl_gles_driver.o
208 obj-y += yagl_gles1_driver.o
209 obj-y += yagl_gles2_driver.o
210 obj-y += yagl_egl_interface.o
211 obj-y += yagl_client_interface.o
212 obj-y += yagl_client_context.o
213 obj-y += yagl_resource.o
214 obj-y += yagl_resource_list.o
215 obj-y += yagl_object.o
216 obj-y += yagl_namespace.o
217 obj-y += yagl_sharegroup.o
218 obj-y += yagl_stats.o
219 obj-y += yagl_compiled_transfer.o
220 obj-y += yagl_egl_native_config.o
221 obj-y += yagl_egl_surface_attribs.o
222 # EGL api
223 obj-y += yagl_egl_api.o
224 obj-y += yagl_egl_api_ps.o
225 obj-y += yagl_egl_api_ts.o
226 obj-y += yagl_egl_calls.o
227 obj-y += yagl_egl_display.o
228 obj-y += yagl_egl_config.o
229 obj-y += yagl_egl_surface.o
230 obj-y += yagl_egl_context.o
231 obj-y += yagl_egl_validate.o
232 obj-y += yagl_host_egl_calls.o
233 # GLES common api
234 obj-y += yagl_gles_context.o
235 obj-y += yagl_gles_array.o
236 obj-y += yagl_gles_buffer.o
237 obj-y += yagl_gles_texture.o
238 obj-y += yagl_gles_framebuffer.o
239 obj-y += yagl_gles_renderbuffer.o
240 obj-y += yagl_gles_texture_unit.o
241 obj-y += yagl_gles_validate.o
242 obj-y += yagl_host_gles_calls.o
243 # GLESv1_CM api
244 obj-y += yagl_gles1_calls.o
245 obj-y += yagl_host_gles1_calls.o
246 # GLESv2 api
247 obj-y += yagl_gles2_api.o
248 obj-y += yagl_gles2_api_ps.o
249 obj-y += yagl_gles2_api_ts.o
250 obj-y += yagl_gles2_calls.o
251 obj-y += yagl_gles2_context.o
252 obj-y += yagl_gles2_shader.o
253 obj-y += yagl_gles2_program.o
254 obj-y += yagl_gles2_validate.o
255 obj-y += yagl_host_gles2_calls.o
256 # EGL GLX driver
257 obj-y += yagl_egl_glx.o
258 # GLES OpenGL common driver
259 obj-y += yagl_gles_ogl.o
260 # GLESv1_CM OpenGL driver
261 obj-y += yagl_gles1_ogl.o
262 # GLESv2 OpenGL driver
263 obj-y += yagl_gles2_ogl.o
264
265 endif
266
267 ifdef CONFIG_BUILD_GLES
268
269 gles2.o: gles2.c gles2.h
270 gles2_egl.o: gles2_egl.c gles2.h
271 gles2_es11.o: gles2_es11.c gles2.h
272 gles2_es20.o: gles2_es20.c gles2.h
273 gles2_kernel_calls.o: gles2_kernel_calls.c gles2.h gles2_calls.h
274 gles2_egl_calls.o: gles2_egl_calls.c gles2.h gles2_calls.h
275 gles2_es11_calls.o: gles2_es11_calls.c gles2.h gles2_calls.h
276 gles2_es20_calls.o: gles2_es20_calls.c gles2.h gles2_calls.h
277 obj-y += gles2.o gles2_egl.o gles2_es11.o gles2_es20.o
278 obj-y += gles2_kernel_calls.o  gles2_egl_calls.o gles2_es11_calls.o
279 obj-y += gles2_es20_calls.o
280
281 ifdef QEMU_PROGW
282 GLESLIBS_LINK_LIST:=$(wildcard $(CONFIG_GLES_LIBDIR)/*.dll)
283 else
284 GLESLIBS_LINK_LIST:=$(wildcard $(CONFIG_GLES_LIBDIR)/lib*)
285 endif
286
287 $(GLESLIBS_LINK_LIST):
288
289 GLESLIBS_RUNTIME_LIST:=$(addprefix ./,$(notdir $(GLESLIBS_LINK_LIST)))
290
291 $(GLESLIBS_RUNTIME_LIST): $(GLESLIBS_LINK_LIST)
292         @cp -dpu -t ./ $(GLESLIBS_LINK_LIST)
293
294 $(QEMU_PROG): $(GLESLIBS_RUNTIME_LIST)
295
296 endif # CONFIG_BUILD_GLES
297
298 # This resolves all nested paths, so it must come last
299 include $(SRC_PATH)/Makefile.objs
300
301 all-obj-y = $(obj-y)
302 all-obj-y += $(addprefix ../, $(universal-obj-y))
303
304 ifdef CONFIG_SOFTMMU
305 all-obj-y += $(addprefix ../, $(common-obj-y))
306 all-obj-y += $(addprefix ../libdis/, $(libdis-y))
307 all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
308 all-obj-y += $(addprefix ../, $(trace-obj-y))
309 else
310 all-obj-y += $(addprefix ../libuser/, $(user-obj-y))
311 all-obj-y += $(addprefix ../libdis-user/, $(libdis-y))
312 endif #CONFIG_LINUX_USER
313
314 ifdef QEMU_PROGW
315 # The linker builds a windows executable. Make also a console executable.
316 $(QEMU_PROGW): $(all-obj-y)
317         $(call LINK,$^)
318 $(QEMU_PROG): $(QEMU_PROGW)
319         $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
320 else
321 $(QEMU_PROG): $(all-obj-y)
322         $(call LINK,$^)
323 endif
324
325 CHECK_GL_OBJS = check_gl.o gloffscreen_test.o gloffscreen_common.o 
326 CHECK_GL_LDFLAGS =
327 CHECK_GL_TARGET =
328 ifdef CONFIG_LINUX
329 CHECK_GL_OBJS += gloffscreen_xcomposite.o
330 CHECK_GL_LDFLAGS += -lGL -lXcomposite -lXext -lglib-2.0
331 CHECK_GL_TARGET = check-gl
332 endif
333 ifdef CONFIG_WIN32
334 CHECK_GL_OBJS += gloffscreen_wgl.o
335 CHECK_GL_LDFLAGS += -fstack-protector `pkg-config --libs glib-2.0` -lopengl32 -lglu32 -lgdi32
336 CHECK_GL_TARGET = check-gl.exe
337 endif
338 ifdef CONFIG_DARWIN
339 CHECK_GL_OBJS += gloffscreen_agl.o
340 CHECK_GL_LDFLAGS += -mmacosx-version-min=10.4 `pkg-config --cflags --libs glib-2.0` -framework GLUT -framework OpenGL -framework AGL
341 CHECK_GL_TARGET = check-gl
342 endif
343
344 check-gl: check_gl.o
345         gcc -o $(CHECK_GL_TARGET) $(CHECK_GL_OBJS) $(CHECK_GL_LDFLAGS)
346 check_gl.o: check_gl.c
347         gcc -c ../tizen/src/check_gl.c
348
349 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
350         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
351
352 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
353         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
354
355 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
356         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
357
358 clean:
359         rm -f *.a *~ $(PROGS)
360         rm -f $(shell find . -name '*.[od]')
361         rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
362 ifdef CONFIG_TRACE_SYSTEMTAP
363         rm -f *.stp
364 endif
365
366 install: all
367 ifneq ($(PROGS),)
368         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
369 ifneq ($(STRIP),)
370         $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
371 endif
372 ifneq ($(GLESLIBS_RUNTIME_LIST),)
373         $(INSTALL) -m 644 $(GLESLIBS_RUNTIME_LIST) "$(DESTDIR)$(bindir)"
374 endif
375 endif
376 ifdef CONFIG_TRACE_SYSTEMTAP
377         $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
378         $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
379 endif
380
381 GENERATED_HEADERS += config-target.h
382 Makefile: $(GENERATED_HEADERS)