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