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