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