]> Git Repo - qemu.git/blame - Makefile.target
disabled again register usage for ppc because my previous patch seems still buggy
[qemu.git] / Makefile.target
CommitLineData
626df76a
FB
1include config.mak
2
85571bc7
FB
3#After enabling Adlib and/or FMOD rebuild QEMU from scratch
4#Uncomment following for adlib support
5#USE_ADLIB=1
6
7#Uncomment following and specify proper paths/names for FMOD support
8#USE_FMOD=1
9#FMOD_INCLUDE=/net/include/fmod
10#FMOD_LIBPATH=/net/lib
11#FMOD_VERSION=3.74
12
1e43adfc 13TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
85571bc7 14VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
3035f7ff
FB
15DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
16ifdef CONFIG_USER_ONLY
17VPATH+=:$(SRC_PATH)/linux-user
18DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
19endif
ab2572d7 20CFLAGS=-Wall -O2 -g -fno-strict-aliasing
626df76a
FB
21LDFLAGS=-g
22LIBS=
626df76a 23HELPER_CFLAGS=$(CFLAGS)
67b915a5 24DYNGEN=../dyngen$(EXESUF)
1e43adfc
FB
25# user emulator name
26QEMU_USER=qemu-$(TARGET_ARCH)
27# system emulator name
28ifdef CONFIG_SOFTMMU
a541f297 29ifeq ($(TARGET_ARCH), i386)
67b915a5 30QEMU_SYSTEM=qemu$(EXESUF)
0db63474 31else
a541f297
FB
32QEMU_SYSTEM=qemu-system-$(TARGET_ARCH)$(EXESUF)
33endif
34else
0db63474 35QEMU_SYSTEM=qemu-fast
1e43adfc
FB
36endif
37
16e9b7de 38ifdef CONFIG_USER_ONLY
1e43adfc 39PROGS=$(QEMU_USER)
16e9b7de 40else
16e9b7de 41ifeq ($(TARGET_ARCH), i386)
c321f673
FB
42
43ifeq ($(ARCH), i386)
44PROGS+=$(QEMU_SYSTEM)
de5eaa64
FB
45ifndef CONFIG_SOFTMMU
46CONFIG_STATIC=y
47endif
38ca2abc
FB
48else
49# the system emulator using soft mmu is portable
c321f673 50ifdef CONFIG_SOFTMMU
16e9b7de
FB
51PROGS+=$(QEMU_SYSTEM)
52endif
38ca2abc 53endif # ARCH != i386
c321f673 54
38ca2abc 55endif # TARGET_ARCH = i386
728c9fd5
FB
56
57ifeq ($(TARGET_ARCH), ppc)
58
59ifeq ($(ARCH), ppc)
60PROGS+=$(QEMU_SYSTEM)
61endif
62
63ifeq ($(ARCH), i386)
64ifdef CONFIG_SOFTMMU
65PROGS+=$(QEMU_SYSTEM)
626df76a 66endif
728c9fd5
FB
67endif # ARCH = i386
68
75dfaa1e
FB
69ifeq ($(ARCH), amd64)
70ifdef CONFIG_SOFTMMU
71PROGS+=$(QEMU_SYSTEM)
72endif
73endif # ARCH = amd64
74
728c9fd5 75endif # TARGET_ARCH = ppc
e95c8d51
FB
76
77ifeq ($(TARGET_ARCH), sparc)
78
79ifeq ($(ARCH), ppc)
80PROGS+=$(QEMU_SYSTEM)
81endif
82
83ifeq ($(ARCH), i386)
84ifdef CONFIG_SOFTMMU
85PROGS+=$(QEMU_SYSTEM)
86endif
87endif # ARCH = i386
88
89ifeq ($(ARCH), amd64)
90ifdef CONFIG_SOFTMMU
91PROGS+=$(QEMU_SYSTEM)
92endif
93endif # ARCH = amd64
94
95endif # TARGET_ARCH = sparc
728c9fd5 96endif # !CONFIG_USER_ONLY
626df76a
FB
97
98ifdef CONFIG_STATIC
99LDFLAGS+=-static
100endif
101
102ifeq ($(ARCH),i386)
103CFLAGS+=-fomit-frame-pointer
104OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
105ifeq ($(HAVE_GCC3_OPTIONS),yes)
3611a29c 106OP_CFLAGS+= -falign-functions=0 -fno-gcse
626df76a
FB
107else
108OP_CFLAGS+= -malign-functions=0
109endif
3a4739d6 110
626df76a 111ifdef TARGET_GPROF
3a4739d6
FB
112USE_I386_LD=y
113endif
114ifdef CONFIG_STATIC
115USE_I386_LD=y
116endif
117ifdef USE_I386_LD
626df76a
FB
118LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
119else
120# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
121# that the kernel ELF loader considers as an executable. I think this
122# is the simplest way to make it self virtualizable!
123LDFLAGS+=-Wl,-shared
124endif
626df76a
FB
125endif
126
bc51c5c9
FB
127ifeq ($(ARCH),amd64)
128OP_CFLAGS=$(CFLAGS) -falign-functions=0
129LDFLAGS+=-Wl,-T,$(SRC_PATH)/amd64.ld
130endif
131
626df76a 132ifeq ($(ARCH),ppc)
83fb7adf 133CFLAGS+= -D__powerpc__
626df76a
FB
134OP_CFLAGS=$(CFLAGS)
135LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
136endif
137
138ifeq ($(ARCH),s390)
139OP_CFLAGS=$(CFLAGS)
140LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
141endif
142
143ifeq ($(ARCH),sparc)
144CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
145LDFLAGS+=-m32
146OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
147HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
148# -static is used to avoid g1/g3 usage by the dynamic linker
149LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
150endif
151
152ifeq ($(ARCH),sparc64)
153CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
154LDFLAGS+=-m64
155OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
156endif
157
158ifeq ($(ARCH),alpha)
159# -msmall-data is not used because we want two-instruction relocations
160# for the constant constructions
161OP_CFLAGS=-Wall -O2 -g
162# Ensure there's only a single GP
163CFLAGS += -msmall-data
164LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
165endif
166
167ifeq ($(ARCH),ia64)
168OP_CFLAGS=$(CFLAGS)
169endif
170
171ifeq ($(ARCH),arm)
172OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
173LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
174endif
175
38e584a0
FB
176ifeq ($(ARCH),m68k)
177OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
178LDFLAGS+=-Wl,-T,m68k.ld
179endif
180
626df76a
FB
181ifeq ($(HAVE_GCC3_OPTIONS),yes)
182# very important to generate a return at the end of every operation
183OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
184endif
185
83fb7adf
FB
186ifeq ($(CONFIG_DARWIN),yes)
187OP_CFLAGS+= -mdynamic-no-pic
188endif
189
626df76a
FB
190#########################################################
191
d5249393 192DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
626df76a 193LIBS+=-lm
b932caba
FB
194ifndef CONFIG_USER_ONLY
195LIBS+=-lz
196endif
67b915a5 197ifdef CONFIG_WIN32
3db38e87 198LIBS+=-lwinmm -lws2_32 -liphlpapi
67b915a5 199endif
626df76a
FB
200
201# profiling code
202ifdef TARGET_GPROF
203LDFLAGS+=-p
204main.o: CFLAGS+=-p
205endif
206
3035f7ff 207OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o
626df76a
FB
208ifeq ($(TARGET_ARCH), i386)
209OBJS+= vm86.o
210endif
f72b519c
FB
211ifeq ($(TARGET_ARCH), arm)
212OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
213nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
214 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o
215endif
626df76a
FB
216SRCS:= $(OBJS:.o=.c)
217OBJS+= libqemu.a
218
219# cpu emulator library
858693c6 220LIBOBJS=exec.o translate-all.o cpu-exec.o\
1e43adfc 221 translate.o op.o
626df76a
FB
222
223ifeq ($(TARGET_ARCH), i386)
1e43adfc 224LIBOBJS+=helper.o helper2.o
f72b519c
FB
225ifeq ($(ARCH), i386)
226LIBOBJS+=translate-copy.o
227endif
626df76a
FB
228endif
229
67867308 230ifeq ($(TARGET_ARCH), ppc)
728c9fd5 231LIBOBJS+= op_helper.o helper.o
67867308
FB
232endif
233
e95c8d51
FB
234ifeq ($(TARGET_ARCH), sparc)
235LIBOBJS+= op_helper.o helper.o
236endif
237
626df76a
FB
238# NOTE: the disassembler code is only needed for debugging
239LIBOBJS+=disas.o
240ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bc51c5c9
FB
241USE_I386_DIS=y
242endif
243ifeq ($(findstring amd64, $(TARGET_ARCH) $(ARCH)),amd64)
244USE_I386_DIS=y
245endif
246ifdef USE_I386_DIS
626df76a
FB
247LIBOBJS+=i386-dis.o
248endif
249ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
250LIBOBJS+=alpha-dis.o
251endif
252ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
253LIBOBJS+=ppc-dis.o
254endif
255ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
256LIBOBJS+=sparc-dis.o
257endif
258ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
259LIBOBJS+=arm-dis.o
260endif
261
262ifeq ($(ARCH),ia64)
263OBJS += ia64-syscall.o
264endif
265
1e43adfc 266all: $(PROGS)
626df76a 267
1e43adfc 268$(QEMU_USER): $(OBJS)
626df76a
FB
269 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
270ifeq ($(ARCH),alpha)
271# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
272# the address space (31 bit so sign extending doesn't matter)
273 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
274endif
275
276# must use static linking to avoid leaving stuff in virtual address space
b932caba 277VL_OBJS=vl.o osdep.o block.o readline.o monitor.o pci.o console.o
3c56521b 278VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
a541f297 279
85571bc7
FB
280SOUND_HW = sb16.o
281AUDIODRV = audio.o ossaudio.o sdlaudio.o wavaudio.o
282
283ifeq ($(USE_ADLIB),1)
284SOUND_HW += fmopl.o adlib.o
285audio.o: DEFINES := -DUSE_ADLIB $(DEFINES)
286endif
287
288ifeq ($(USE_FMOD),1)
289AUDIODRV += fmodaudio.o
290audio.o fmodaudio.o: DEFINES := -DUSE_FMOD_AUDIO -I$(FMOD_INCLUDE) $(DEFINES)
291LDFLAGS += -L$(FMOD_LIBPATH) -Wl,-rpath,$(FMOD_LIBPATH)
292LIBS += -lfmod-$(FMOD_VERSION)
293endif
294
a541f297
FB
295ifeq ($(TARGET_ARCH), i386)
296# Hardware support
85571bc7
FB
297VL_OBJS+= ide.o ne2000.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
298VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o
299VL_OBJS+= cirrus_vga.o mixeng.o
67b915a5 300endif
728c9fd5 301ifeq ($(TARGET_ARCH), ppc)
85571bc7 302VL_OBJS+= ppc.o ide.o ne2000.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
64201201 303VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
85571bc7 304VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o mixeng.o
a541f297 305endif
e95c8d51 306ifeq ($(TARGET_ARCH), sparc)
8d5f07fa 307VL_OBJS+= sun4m.o tcx.o lance.o iommu.o sched.o m48t08.o magic-load.o timer.o
e95c8d51 308endif
a541f297
FB
309ifdef CONFIG_GDBSTUB
310VL_OBJS+=gdbstub.o
728c9fd5 311endif
626df76a
FB
312ifdef CONFIG_SDL
313VL_OBJS+=sdl.o
de5eaa64 314endif
7c1f25b4
FB
315ifdef CONFIG_SLIRP
316DEFINES+=-I$(SRC_PATH)/slirp
317SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
318slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
c7f74643 319tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
7c1f25b4 320VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
626df76a
FB
321endif
322
c321f673
FB
323VL_LDFLAGS=
324# specific flags are needed for non soft mmu emulator
c321f673
FB
325ifdef CONFIG_STATIC
326VL_LDFLAGS+=-static
327endif
de5eaa64
FB
328ifndef CONFIG_SOFTMMU
329VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
330endif
83fb7adf 331ifndef CONFIG_DARWIN
11d9f695
FB
332ifndef CONFIG_WIN32
333VL_LIBS=-lutil
334endif
83fb7adf 335endif
c321f673 336
1e43adfc 337$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
11d9f695 338 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS)
626df76a
FB
339
340sdl.o: sdl.c
341 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
342
343depend: $(SRCS)
16e9b7de 344 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
626df76a
FB
345
346# libqemu
347
348libqemu.a: $(LIBOBJS)
349 rm -f $@
350 $(AR) rcs $@ $(LIBOBJS)
351
1e43adfc 352translate.o: translate.c gen-op.h opc.h cpu.h
626df76a 353
1e43adfc 354translate-all.o: translate-all.c op.h opc.h cpu.h
626df76a 355
1e43adfc 356op.h: op.o $(DYNGEN)
626df76a
FB
357 $(DYNGEN) -o $@ $<
358
1e43adfc 359opc.h: op.o $(DYNGEN)
626df76a
FB
360 $(DYNGEN) -c -o $@ $<
361
1e43adfc 362gen-op.h: op.o $(DYNGEN)
626df76a
FB
363 $(DYNGEN) -g -o $@ $<
364
1e43adfc 365op.o: op.c
626df76a
FB
366 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
367
1e43adfc 368helper.o: helper.c
626df76a
FB
369 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
370
1e43adfc
FB
371ifeq ($(TARGET_ARCH), i386)
372op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
373endif
374
375ifeq ($(TARGET_ARCH), arm)
376op.o: op.c op_template.h
377endif
626df76a 378
1e43adfc 379ifeq ($(TARGET_ARCH), sparc)
e95c8d51 380op.o: op.c op_template.h op_mem.h
1e43adfc 381endif
626df76a 382
728c9fd5
FB
383ifeq ($(TARGET_ARCH), ppc)
384op.o: op.c op_template.h op_mem.h
385op_helper.o: op_helper_mem.h
386endif
387
85571bc7
FB
388mixeng.o: mixeng.c mixeng.h mixeng_template.h
389
626df76a
FB
390%.o: %.c
391 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
392
f72b519c
FB
393%.o: %.S
394 $(CC) $(DEFINES) -c -o $@ $<
395
626df76a 396clean:
7c1f25b4 397 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o
1e43adfc
FB
398
399install: all
9b14bb04 400ifneq ($(PROGS),)
11d9f695 401 install -m 755 -s $(PROGS) "$(bindir)"
9b14bb04 402endif
626df76a
FB
403
404ifneq ($(wildcard .depend),)
405include .depend
406endif
This page took 0.100428 seconds and 4 git commands to generate.