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