]>
Commit | Line | Data |
---|---|---|
626df76a FB |
1 | include config.mak |
2 | ||
0b0babc6 FB |
3 | TARGET_BASE_ARCH:=$(TARGET_ARCH) |
4 | ifeq ($(TARGET_ARCH), x86_64) | |
5 | TARGET_BASE_ARCH:=i386 | |
6 | endif | |
540635ba TS |
7 | ifeq ($(TARGET_ARCH), mipsn32) |
8 | TARGET_BASE_ARCH:=mips | |
9 | endif | |
fbe4f65b TS |
10 | ifeq ($(TARGET_ARCH), mips64) |
11 | TARGET_BASE_ARCH:=mips | |
12 | endif | |
a2458627 FB |
13 | ifeq ($(TARGET_ARCH), ppc64) |
14 | TARGET_BASE_ARCH:=ppc | |
15 | endif | |
22f8a8b3 JM |
16 | ifeq ($(TARGET_ARCH), ppc64h) |
17 | TARGET_BASE_ARCH:=ppc | |
18 | endif | |
d4082e95 JM |
19 | ifeq ($(TARGET_ARCH), ppcemb) |
20 | TARGET_BASE_ARCH:=ppc | |
21 | endif | |
64b3ab24 FB |
22 | ifeq ($(TARGET_ARCH), sparc64) |
23 | TARGET_BASE_ARCH:=sparc | |
24 | endif | |
0b0babc6 | 25 | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) |
4fb240a4 | 26 | VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw |
faf07963 | 27 | CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MP -DNEED_CPU_H |
831b7825 TS |
28 | ifdef CONFIG_DARWIN_USER |
29 | VPATH+=:$(SRC_PATH)/darwin-user | |
30 | CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) | |
31 | endif | |
32 | ifdef CONFIG_LINUX_USER | |
3035f7ff | 33 | VPATH+=:$(SRC_PATH)/linux-user |
992f48a0 BS |
34 | ifndef TARGET_ABI_DIR |
35 | TARGET_ABI_DIR=$(TARGET_ARCH) | |
36 | endif | |
37 | CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) | |
3035f7ff | 38 | endif |
6f30fa85 TS |
39 | BASE_CFLAGS= |
40 | BASE_LDFLAGS= | |
0b0babc6 | 41 | #CFLAGS+=-Werror |
626df76a | 42 | LIBS= |
626df76a | 43 | HELPER_CFLAGS=$(CFLAGS) |
67b915a5 | 44 | DYNGEN=../dyngen$(EXESUF) |
1e43adfc | 45 | # user emulator name |
0c64b9cd | 46 | ifndef TARGET_ARCH2 |
c91fde65 | 47 | TARGET_ARCH2=$(TARGET_ARCH) |
0c64b9cd | 48 | endif |
808c4954 FB |
49 | ifeq ($(TARGET_ARCH),arm) |
50 | ifeq ($(TARGET_WORDS_BIGENDIAN),yes) | |
c91fde65 | 51 | TARGET_ARCH2=armeb |
808c4954 | 52 | endif |
c91fde65 | 53 | endif |
908f52b0 PB |
54 | ifeq ($(TARGET_ARCH),sh4) |
55 | ifeq ($(TARGET_WORDS_BIGENDIAN),yes) | |
56 | TARGET_ARCH2=sh4eb | |
57 | endif | |
58 | endif | |
01f5e596 | 59 | ifeq ($(TARGET_ARCH),mips) |
c91fde65 FB |
60 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) |
61 | TARGET_ARCH2=mipsel | |
01f5e596 | 62 | endif |
01f5e596 | 63 | endif |
540635ba TS |
64 | ifeq ($(TARGET_ARCH),mipsn32) |
65 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) | |
66 | TARGET_ARCH2=mipsn32el | |
67 | endif | |
68 | endif | |
fbe4f65b TS |
69 | ifeq ($(TARGET_ARCH),mips64) |
70 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) | |
71 | TARGET_ARCH2=mips64el | |
72 | endif | |
73 | endif | |
c91fde65 | 74 | QEMU_USER=qemu-$(TARGET_ARCH2) |
1e43adfc FB |
75 | # system emulator name |
76 | ifdef CONFIG_SOFTMMU | |
a541f297 | 77 | ifeq ($(TARGET_ARCH), i386) |
67b915a5 | 78 | QEMU_SYSTEM=qemu$(EXESUF) |
0db63474 | 79 | else |
c91fde65 | 80 | QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF) |
a541f297 FB |
81 | endif |
82 | else | |
0db63474 | 83 | QEMU_SYSTEM=qemu-fast |
1e43adfc FB |
84 | endif |
85 | ||
16e9b7de | 86 | ifdef CONFIG_USER_ONLY |
1e43adfc | 87 | PROGS=$(QEMU_USER) |
16e9b7de | 88 | else |
c321f673 | 89 | PROGS+=$(QEMU_SYSTEM) |
de5eaa64 FB |
90 | ifndef CONFIG_SOFTMMU |
91 | CONFIG_STATIC=y | |
92 | endif | |
728c9fd5 | 93 | endif # !CONFIG_USER_ONLY |
626df76a FB |
94 | |
95 | ifdef CONFIG_STATIC | |
6f30fa85 | 96 | BASE_LDFLAGS+=-static |
626df76a FB |
97 | endif |
98 | ||
6f30fa85 | 99 | # We require -O2 to avoid the stack setup prologue in EXIT_TB |
6c041c54 TS |
100 | OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing |
101 | ||
102 | # cc-option | |
103 | # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) | |
104 | ||
105 | cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | |
106 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) | |
107 | ||
108 | OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "") | |
109 | OP_CFLAGS+=$(call cc-option, -fno-gcse, "") | |
110 | OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "") | |
111 | OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "") | |
112 | OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "") | |
113 | OP_CFLAGS+=$(call cc-option, -fno-align-labels, "") | |
114 | OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "") | |
115 | OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, "")) | |
1870a74c | 116 | OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "") |
6f30fa85 | 117 | |
626df76a | 118 | ifeq ($(ARCH),i386) |
6f30fa85 TS |
119 | HELPER_CFLAGS+=-fomit-frame-pointer |
120 | OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer | |
626df76a | 121 | ifdef TARGET_GPROF |
3a4739d6 FB |
122 | USE_I386_LD=y |
123 | endif | |
124 | ifdef CONFIG_STATIC | |
125 | USE_I386_LD=y | |
126 | endif | |
127 | ifdef USE_I386_LD | |
6f30fa85 | 128 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
626df76a | 129 | else |
831b7825 | 130 | ifdef CONFIG_LINUX_USER |
626df76a FB |
131 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object |
132 | # that the kernel ELF loader considers as an executable. I think this | |
133 | # is the simplest way to make it self virtualizable! | |
6f30fa85 | 134 | BASE_LDFLAGS+=-Wl,-shared |
626df76a | 135 | endif |
626df76a | 136 | endif |
831b7825 | 137 | endif |
626df76a | 138 | |
0b0babc6 | 139 | ifeq ($(ARCH),x86_64) |
8a0ef219 TS |
140 | ifneq ($(CONFIG_SOLARIS),yes) |
141 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
142 | endif | |
bc51c5c9 FB |
143 | endif |
144 | ||
626df76a | 145 | ifeq ($(ARCH),ppc) |
6f30fa85 TS |
146 | CPPFLAGS+= -D__powerpc__ |
147 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
626df76a FB |
148 | endif |
149 | ||
150 | ifeq ($(ARCH),s390) | |
6f30fa85 | 151 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
626df76a FB |
152 | endif |
153 | ||
154 | ifeq ($(ARCH),sparc) | |
3142255c BS |
155 | BASE_CFLAGS+=-ffixed-g2 -ffixed-g3 |
156 | OP_CFLAGS+=-fno-delayed-branch -ffixed-i0 | |
157 | ifeq ($(CONFIG_SOLARIS),yes) | |
158 | OP_CFLAGS+=-fno-omit-frame-pointer | |
159 | else | |
160 | BASE_CFLAGS+=-ffixed-g1 -ffixed-g6 | |
66f1cdbd | 161 | HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 |
3142255c BS |
162 | # -static is used to avoid g1/g3 usage by the dynamic linker |
163 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static | |
164 | endif | |
fdbb4691 | 165 | endif |
626df76a FB |
166 | |
167 | ifeq ($(ARCH),sparc64) | |
3142255c BS |
168 | BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 |
169 | OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0 | |
170 | ifneq ($(CONFIG_SOLARIS),yes) | |
171 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
172 | OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 | |
173 | endif | |
626df76a FB |
174 | endif |
175 | ||
176 | ifeq ($(ARCH),alpha) | |
6f30fa85 TS |
177 | # -msmall-data is not used for OP_CFLAGS because we want two-instruction |
178 | # relocations for the constant constructions | |
626df76a | 179 | # Ensure there's only a single GP |
6f30fa85 TS |
180 | BASE_CFLAGS+=-msmall-data |
181 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
626df76a FB |
182 | endif |
183 | ||
184 | ifeq ($(ARCH),ia64) | |
6f30fa85 TS |
185 | BASE_CFLAGS+=-mno-sdata |
186 | OP_CFLAGS+=-mno-sdata | |
187 | BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
626df76a FB |
188 | endif |
189 | ||
190 | ifeq ($(ARCH),arm) | |
6f30fa85 TS |
191 | OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer |
192 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
626df76a FB |
193 | endif |
194 | ||
38e584a0 | 195 | ifeq ($(ARCH),m68k) |
6f30fa85 TS |
196 | OP_CFLAGS+=-fomit-frame-pointer |
197 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
198 | endif | |
199 | ||
200 | ifeq ($(ARCH),mips) | |
9617efe8 | 201 | OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0 |
fbe4f65b TS |
202 | ifeq ($(WORDS_BIGENDIAN),yes) |
203 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
204 | else | |
205 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
206 | endif | |
207 | endif | |
208 | ||
209 | ifeq ($(ARCH),mips64) | |
9617efe8 | 210 | OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0 |
fbe4f65b | 211 | ifeq ($(WORDS_BIGENDIAN),yes) |
6f30fa85 | 212 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
fbe4f65b TS |
213 | else |
214 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
215 | endif | |
38e584a0 FB |
216 | endif |
217 | ||
83fb7adf | 218 | ifeq ($(CONFIG_DARWIN),yes) |
e80cfcfc | 219 | LIBS+=-lmx |
83fb7adf FB |
220 | endif |
221 | ||
01feaa05 TS |
222 | ifdef CONFIG_DARWIN_USER |
223 | # Leave some space for the regular program loading zone | |
224 | BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 | |
225 | endif | |
226 | ||
3142255c BS |
227 | BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) |
228 | BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) | |
229 | OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) | |
230 | OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) | |
6f30fa85 | 231 | |
626df76a FB |
232 | ######################################################### |
233 | ||
6f30fa85 | 234 | CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
626df76a | 235 | LIBS+=-lm |
b932caba FB |
236 | ifndef CONFIG_USER_ONLY |
237 | LIBS+=-lz | |
238 | endif | |
67b915a5 | 239 | ifdef CONFIG_WIN32 |
3db38e87 | 240 | LIBS+=-lwinmm -lws2_32 -liphlpapi |
67b915a5 | 241 | endif |
ec530c81 FB |
242 | ifdef CONFIG_SOLARIS |
243 | LIBS+=-lsocket -lnsl -lresolv | |
0475a5ca TS |
244 | ifdef NEEDS_LIBSUNMATH |
245 | LIBS+=-lsunmath | |
246 | LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib | |
247 | OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc | |
248 | BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc | |
249 | endif | |
ec530c81 | 250 | endif |
626df76a FB |
251 | |
252 | # profiling code | |
253 | ifdef TARGET_GPROF | |
6f30fa85 TS |
254 | BASE_LDFLAGS+=-p |
255 | main.o: BASE_CFLAGS+=-p | |
626df76a FB |
256 | endif |
257 | ||
831b7825 | 258 | ifdef CONFIG_LINUX_USER |
b92c47c1 | 259 | OBJS= main.o syscall.o strace.o mmap.o signal.o path.o osdep.o thunk.o \ |
579a97f7 | 260 | elfload.o linuxload.o uaccess.o |
b5906f95 | 261 | LIBS+= $(AIOLIBS) |
e5fe0c52 PB |
262 | ifdef TARGET_HAS_BFLT |
263 | OBJS+= flatload.o | |
264 | endif | |
cb33da57 BS |
265 | ifdef TARGET_HAS_ELFLOAD32 |
266 | OBJS+= elfload32.o | |
267 | elfload32.o: elfload.c | |
268 | endif | |
e5fe0c52 | 269 | |
626df76a FB |
270 | ifeq ($(TARGET_ARCH), i386) |
271 | OBJS+= vm86.o | |
272 | endif | |
f72b519c | 273 | ifeq ($(TARGET_ARCH), arm) |
158142c2 | 274 | OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ |
f72b519c | 275 | nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ |
a4f81979 | 276 | nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o |
f72b519c | 277 | endif |
e6e5906b PB |
278 | ifeq ($(TARGET_ARCH), m68k) |
279 | OBJS+= m68k-sim.o m68k-semi.o | |
280 | endif | |
831b7825 TS |
281 | endif #CONFIG_LINUX_USER |
282 | ||
283 | ifdef CONFIG_DARWIN_USER | |
284 | OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o | |
285 | endif | |
286 | ||
626df76a FB |
287 | SRCS:= $(OBJS:.o=.c) |
288 | OBJS+= libqemu.a | |
289 | ||
290 | # cpu emulator library | |
158142c2 | 291 | LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\ |
f1548daa | 292 | translate.o op.o host-utils.o |
158142c2 FB |
293 | ifdef CONFIG_SOFTFLOAT |
294 | LIBOBJS+=fpu/softfloat.o | |
295 | else | |
296 | LIBOBJS+=fpu/softfloat-native.o | |
297 | endif | |
6f30fa85 | 298 | CPPFLAGS+=-I$(SRC_PATH)/fpu |
626df76a FB |
299 | |
300 | ifeq ($(TARGET_ARCH), i386) | |
1e43adfc | 301 | LIBOBJS+=helper.o helper2.o |
626df76a FB |
302 | endif |
303 | ||
0b0babc6 FB |
304 | ifeq ($(TARGET_ARCH), x86_64) |
305 | LIBOBJS+=helper.o helper2.o | |
306 | endif | |
307 | ||
a2458627 | 308 | ifeq ($(TARGET_BASE_ARCH), ppc) |
728c9fd5 | 309 | LIBOBJS+= op_helper.o helper.o |
67867308 FB |
310 | endif |
311 | ||
fbe4f65b | 312 | ifeq ($(TARGET_BASE_ARCH), mips) |
6af0bf9c FB |
313 | LIBOBJS+= op_helper.o helper.o |
314 | endif | |
315 | ||
64b3ab24 | 316 | ifeq ($(TARGET_BASE_ARCH), sparc) |
e95c8d51 FB |
317 | LIBOBJS+= op_helper.o helper.o |
318 | endif | |
319 | ||
b7bcbe95 | 320 | ifeq ($(TARGET_BASE_ARCH), arm) |
b5ff1b31 | 321 | LIBOBJS+= op_helper.o helper.o |
b7bcbe95 FB |
322 | endif |
323 | ||
fdf9b3e8 FB |
324 | ifeq ($(TARGET_BASE_ARCH), sh4) |
325 | LIBOBJS+= op_helper.o helper.o | |
326 | endif | |
327 | ||
e6e5906b | 328 | ifeq ($(TARGET_BASE_ARCH), m68k) |
0633879f | 329 | LIBOBJS+= op_helper.o helper.o |
e6e5906b PB |
330 | endif |
331 | ||
cf6c1b16 JM |
332 | ifeq ($(TARGET_BASE_ARCH), alpha) |
333 | LIBOBJS+= op_helper.o helper.o alpha_palcode.o | |
334 | endif | |
335 | ||
e7daa605 TS |
336 | ifeq ($(TARGET_BASE_ARCH), cris) |
337 | LIBOBJS+= op_helper.o helper.o | |
338 | LIBOBJS+= cris-dis.o | |
339 | ||
340 | ifndef CONFIG_USER_ONLY | |
341 | LIBOBJS+= mmu.o | |
342 | endif | |
343 | endif | |
344 | ||
626df76a | 345 | # NOTE: the disassembler code is only needed for debugging |
5fafdf24 | 346 | LIBOBJS+=disas.o |
626df76a | 347 | ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) |
bc51c5c9 FB |
348 | USE_I386_DIS=y |
349 | endif | |
0b0babc6 | 350 | ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64) |
bc51c5c9 FB |
351 | USE_I386_DIS=y |
352 | endif | |
353 | ifdef USE_I386_DIS | |
626df76a FB |
354 | LIBOBJS+=i386-dis.o |
355 | endif | |
356 | ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) | |
357 | LIBOBJS+=alpha-dis.o | |
358 | endif | |
a2458627 | 359 | ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc) |
626df76a FB |
360 | LIBOBJS+=ppc-dis.o |
361 | endif | |
fbe4f65b | 362 | ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips) |
6af0bf9c FB |
363 | LIBOBJS+=mips-dis.o |
364 | endif | |
64b3ab24 | 365 | ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc) |
626df76a FB |
366 | LIBOBJS+=sparc-dis.o |
367 | endif | |
368 | ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) | |
369 | LIBOBJS+=arm-dis.o | |
370 | endif | |
48024e4a FB |
371 | ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k) |
372 | LIBOBJS+=m68k-dis.o | |
373 | endif | |
fdf9b3e8 FB |
374 | ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4) |
375 | LIBOBJS+=sh4-dis.o | |
376 | endif | |
8f860bb8 TS |
377 | ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390) |
378 | LIBOBJS+=s390-dis.o | |
379 | endif | |
626df76a | 380 | |
1fddef4b FB |
381 | ifdef CONFIG_GDBSTUB |
382 | OBJS+=gdbstub.o | |
383 | endif | |
626df76a | 384 | |
1e43adfc | 385 | all: $(PROGS) |
626df76a | 386 | |
1e43adfc | 387 | $(QEMU_USER): $(OBJS) |
6f30fa85 | 388 | $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ $(LIBS) |
626df76a FB |
389 | ifeq ($(ARCH),alpha) |
390 | # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of | |
391 | # the address space (31 bit so sign extending doesn't matter) | |
392 | echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc | |
393 | endif | |
394 | ||
395 | # must use static linking to avoid leaving stuff in virtual address space | |
4fb240a4 FB |
396 | VL_OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o |
397 | # XXX: suppress QEMU_TOOL tests | |
223d4670 TS |
398 | ifdef CONFIG_WIN32 |
399 | VL_OBJS+=block-raw-win32.o | |
400 | else | |
401 | VL_OBJS+=block-raw-posix.o | |
402 | endif | |
a541f297 | 403 | |
1d14ffa9 | 404 | ifdef CONFIG_ALSA |
1d14ffa9 FB |
405 | LIBS += -lasound |
406 | endif | |
ca9cc28c AZ |
407 | ifdef CONFIG_ESD |
408 | LIBS += -lesd | |
409 | endif | |
1d14ffa9 | 410 | ifdef CONFIG_DSOUND |
1d14ffa9 | 411 | LIBS += -lole32 -ldxguid |
85571bc7 | 412 | endif |
102a52e4 | 413 | ifdef CONFIG_FMOD |
102a52e4 | 414 | LIBS += $(CONFIG_FMOD_LIB) |
85571bc7 | 415 | endif |
4fb240a4 FB |
416 | |
417 | SOUND_HW = sb16.o es1370.o | |
ca9cc28c AZ |
418 | ifdef CONFIG_AC97 |
419 | SOUND_HW += ac97.o | |
420 | endif | |
1d14ffa9 FB |
421 | ifdef CONFIG_ADLIB |
422 | SOUND_HW += fmopl.o adlib.o | |
423 | endif | |
423d65f4 AZ |
424 | ifdef CONFIG_GUS |
425 | SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o | |
426 | endif | |
85571bc7 | 427 | |
8d5d2d4c TS |
428 | ifdef CONFIG_VNC_TLS |
429 | CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) | |
430 | LIBS += $(CONFIG_VNC_TLS_LIBS) | |
431 | endif | |
432 | ||
2e5d83bb | 433 | # SCSI layer |
87ecb68b | 434 | VL_OBJS+= lsi53c895a.o |
2e5d83bb | 435 | |
a594cfbf | 436 | # USB layer |
87ecb68b | 437 | VL_OBJS+= usb-ohci.o |
a594cfbf | 438 | |
663e8e51 TS |
439 | # EEPROM emulation |
440 | VL_OBJS += eeprom93xx.o | |
441 | ||
a41b2ff2 | 442 | # PCI network cards |
663e8e51 TS |
443 | VL_OBJS += eepro100.o |
444 | VL_OBJS += ne2000.o | |
445 | VL_OBJS += pcnet.o | |
446 | VL_OBJS += rtl8139.o | |
a41b2ff2 | 447 | |
0b0babc6 | 448 | ifeq ($(TARGET_BASE_ARCH), i386) |
a541f297 | 449 | # Hardware support |
4fb240a4 | 450 | VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o |
fd06c375 | 451 | VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o |
b00052e4 | 452 | VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o |
87ecb68b | 453 | VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o |
b00052e4 | 454 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
67b915a5 | 455 | endif |
a2458627 | 456 | ifeq ($(TARGET_BASE_ARCH), ppc) |
b00052e4 | 457 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
3cbee15b | 458 | # shared objects |
4fb240a4 | 459 | VL_OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o |
3cbee15b JM |
460 | # PREP target |
461 | VL_OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o | |
462 | VL_OBJS+= prep_pci.o ppc_prep.o | |
463 | # Mac shared devices | |
464 | VL_OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o | |
465 | # OldWorld PowerMac | |
466 | VL_OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o | |
467 | # NewWorld PowerMac | |
468 | VL_OBJS+= unin_pci.o ppc_chrp.o | |
469 | # PowerPC 4xx boards | |
470 | VL_OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o | |
a541f297 | 471 | endif |
fbe4f65b | 472 | ifeq ($(TARGET_BASE_ARCH), mips) |
6bf5b4e8 | 473 | VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o |
ad6fe1d2 | 474 | VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o |
31211df1 | 475 | VL_OBJS+= jazz_led.o |
9542611a | 476 | VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o |
87ecb68b | 477 | VL_OBJS+= piix_pci.o parallel.o cirrus_vga.o $(SOUND_HW) |
6bf5b4e8 | 478 | VL_OBJS+= mipsnet.o |
c8b153d7 | 479 | VL_OBJS+= pflash_cfi01.o |
83b1fb88 | 480 | CPPFLAGS += -DHAS_AUDIO |
6af0bf9c | 481 | endif |
e7daa605 TS |
482 | ifeq ($(TARGET_BASE_ARCH), cris) |
483 | VL_OBJS+= etraxfs.o | |
484 | VL_OBJS+= ptimer.o | |
485 | VL_OBJS+= etraxfs_timer.o | |
486 | VL_OBJS+= etraxfs_ser.o | |
487 | endif | |
64b3ab24 | 488 | ifeq ($(TARGET_BASE_ARCH), sparc) |
3475187d | 489 | ifeq ($(TARGET_ARCH), sparc64) |
502a5395 | 490 | VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o |
83469015 | 491 | VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o |
20c9f095 | 492 | VL_OBJS+= cirrus_vga.o parallel.o ptimer.o |
3475187d | 493 | else |
67e999be FB |
494 | VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o |
495 | VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o | |
ee76f82e | 496 | VL_OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o |
3475187d | 497 | endif |
e95c8d51 | 498 | endif |
b5ff1b31 | 499 | ifeq ($(TARGET_BASE_ARCH), arm) |
cdbdb648 | 500 | VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o |
7e1543c2 | 501 | VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o |
775616c3 | 502 | VL_OBJS+= versatile_pci.o ptimer.o |
9ee6e8bb | 503 | VL_OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o |
eea589cc | 504 | VL_OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o |
87ecb68b | 505 | VL_OBJS+= pl061.o |
8e71621f | 506 | VL_OBJS+= arm-semi.o |
b00052e4 | 507 | VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o |
31b87f2e | 508 | VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o |
05ee37eb | 509 | VL_OBJS+= pflash_cfi01.o gumstix.o |
7233b355 | 510 | VL_OBJS+= spitz.o ide.o serial.o nand.o ecc.o |
02645926 AZ |
511 | VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o |
512 | VL_OBJS+= palm.o tsc210x.o | |
7233b355 | 513 | VL_OBJS+= mst_fpga.o mainstone.o |
5a1237c4 | 514 | CPPFLAGS += -DHAS_AUDIO |
b5ff1b31 | 515 | endif |
fdf9b3e8 | 516 | ifeq ($(TARGET_BASE_ARCH), sh4) |
0d78f544 | 517 | VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o |
80f515e6 | 518 | VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o |
fdf9b3e8 | 519 | endif |
0633879f | 520 | ifeq ($(TARGET_BASE_ARCH), m68k) |
7e049b8a | 521 | VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o |
ca02f319 | 522 | VL_OBJS+= m68k-semi.o dummy_m68k.o |
0633879f | 523 | endif |
a541f297 | 524 | ifdef CONFIG_GDBSTUB |
5fafdf24 | 525 | VL_OBJS+=gdbstub.o |
728c9fd5 | 526 | endif |
5b0753e0 | 527 | ifdef CONFIG_COCOA |
1d14ffa9 FB |
528 | COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit |
529 | ifdef CONFIG_COREAUDIO | |
530 | COCOA_LIBS+=-framework CoreAudio | |
531 | endif | |
5b0753e0 | 532 | endif |
7c1f25b4 | 533 | ifdef CONFIG_SLIRP |
6f30fa85 | 534 | CPPFLAGS+=-I$(SRC_PATH)/slirp |
626df76a FB |
535 | endif |
536 | ||
db8d7dd1 | 537 | VL_LDFLAGS=$(VL_OS_LDFLAGS) |
70956b77 | 538 | VL_LIBS=$(AIOLIBS) |
c321f673 | 539 | # specific flags are needed for non soft mmu emulator |
c321f673 FB |
540 | ifdef CONFIG_STATIC |
541 | VL_LDFLAGS+=-static | |
542 | endif | |
de5eaa64 | 543 | ifndef CONFIG_SOFTMMU |
5fafdf24 | 544 | VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld |
de5eaa64 | 545 | endif |
83fb7adf | 546 | ifndef CONFIG_DARWIN |
11d9f695 | 547 | ifndef CONFIG_WIN32 |
ec530c81 | 548 | ifndef CONFIG_SOLARIS |
70956b77 | 549 | VL_LIBS+=-lutil |
11d9f695 | 550 | endif |
83fb7adf | 551 | endif |
ec530c81 | 552 | endif |
e3086fbf | 553 | ifdef TARGET_GPROF |
6f30fa85 | 554 | vl.o: BASE_CFLAGS+=-p |
e3086fbf FB |
555 | VL_LDFLAGS+=-p |
556 | endif | |
c321f673 | 557 | |
b8076a74 FB |
558 | ifeq ($(ARCH),ia64) |
559 | VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld | |
560 | endif | |
561 | ||
74ccb34e | 562 | ifeq ($(ARCH),sparc64) |
3142255c BS |
563 | VL_LDFLAGS+=-m64 |
564 | ifneq ($(CONFIG_SOLARIS),yes) | |
565 | VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
566 | endif | |
8a0ef219 TS |
567 | endif |
568 | ||
569 | ifeq ($(ARCH),x86_64) | |
570 | VL_LDFLAGS+=-m64 | |
571 | ifneq ($(CONFIG_SOLARIS),yes) | |
572 | VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
573 | endif | |
74ccb34e FB |
574 | endif |
575 | ||
1d14ffa9 FB |
576 | ifdef CONFIG_WIN32 |
577 | SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole | |
578 | endif | |
579 | ||
4fb240a4 | 580 | $(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a |
3a11702b | 581 | $(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) |
5b0753e0 | 582 | |
626df76a | 583 | depend: $(SRCS) |
6f30fa85 | 584 | $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend |
626df76a | 585 | |
1d14ffa9 | 586 | vldepend: $(VL_OBJS:.o=.c) |
6f30fa85 | 587 | $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend |
1d14ffa9 | 588 | |
5fafdf24 | 589 | # libqemu |
626df76a FB |
590 | |
591 | libqemu.a: $(LIBOBJS) | |
592 | rm -f $@ | |
593 | $(AR) rcs $@ $(LIBOBJS) | |
594 | ||
1e43adfc | 595 | translate.o: translate.c gen-op.h opc.h cpu.h |
626df76a | 596 | |
158142c2 FB |
597 | translate-all.o: translate-all.c opc.h cpu.h |
598 | ||
599 | translate-op.o: translate-all.c op.h opc.h cpu.h | |
626df76a | 600 | |
1e43adfc | 601 | op.h: op.o $(DYNGEN) |
626df76a FB |
602 | $(DYNGEN) -o $@ $< |
603 | ||
1e43adfc | 604 | opc.h: op.o $(DYNGEN) |
626df76a FB |
605 | $(DYNGEN) -c -o $@ $< |
606 | ||
1e43adfc | 607 | gen-op.h: op.o $(DYNGEN) |
626df76a FB |
608 | $(DYNGEN) -g -o $@ $< |
609 | ||
1e43adfc | 610 | op.o: op.c |
6f30fa85 | 611 | $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $< |
626df76a | 612 | |
6e1b3e4d FB |
613 | # HELPER_CFLAGS is used for all the code compiled with static register |
614 | # variables | |
615 | ifeq ($(TARGET_BASE_ARCH), i386) | |
616 | # XXX: rename helper.c to op_helper.c | |
1e43adfc | 617 | helper.o: helper.c |
6f30fa85 | 618 | $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< |
6e1b3e4d FB |
619 | else |
620 | op_helper.o: op_helper.c | |
6f30fa85 | 621 | $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< |
6e1b3e4d FB |
622 | endif |
623 | ||
624 | cpu-exec.o: cpu-exec.c | |
6f30fa85 | 625 | $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< |
626df76a | 626 | |
00a67ba1 FB |
627 | # Note: this is a workaround. The real fix is to avoid compiling |
628 | # cpu_signal_handler() in cpu-exec.c. | |
629 | signal.o: signal.c | |
6f30fa85 | 630 | $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< |
00a67ba1 | 631 | |
626df76a | 632 | %.o: %.c |
6f30fa85 | 633 | $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< |
626df76a | 634 | |
f72b519c | 635 | %.o: %.S |
6f30fa85 | 636 | $(CC) $(CPPFLAGS) -c -o $@ $< |
f72b519c | 637 | |
626df76a | 638 | clean: |
4fb240a4 | 639 | rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o fpu/*.o |
2f96c28d | 640 | rm -f *.d */*.d |
1e43adfc | 641 | |
5fafdf24 | 642 | install: all |
9b14bb04 | 643 | ifneq ($(PROGS),) |
6a882643 | 644 | $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)" |
9b14bb04 | 645 | endif |
626df76a FB |
646 | |
647 | ifneq ($(wildcard .depend),) | |
648 | include .depend | |
649 | endif | |
1d14ffa9 | 650 | |
c0fe3827 | 651 | ifeq (1, 0) |
1d14ffa9 | 652 | audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \ |
ca9cc28c AZ |
653 | fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o ac97.o gus.o adlib.o \ |
654 | esdaudio.o audio_pt_int.o: \ | |
655 | CFLAGS := $(CFLAGS) -O0 -g -Wall -Werror -W -Wsign-compare -Wno-unused | |
1d14ffa9 | 656 | endif |
2f96c28d JM |
657 | |
658 | # Include automatically generated dependency files | |
659 | -include $(wildcard *.d */*.d) |