]> git.proxmox.com Git - qemu.git/blame - Makefile.target
fixed protected lret imm insn (one more OS/2 fix)
[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
bc51c5c9
FB
83ifeq ($(ARCH),amd64)
84OP_CFLAGS=$(CFLAGS) -falign-functions=0
85LDFLAGS+=-Wl,-T,$(SRC_PATH)/amd64.ld
86endif
87
626df76a
FB
88ifeq ($(ARCH),ppc)
89OP_CFLAGS=$(CFLAGS)
90LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
91endif
92
93ifeq ($(ARCH),s390)
94OP_CFLAGS=$(CFLAGS)
95LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
96endif
97
98ifeq ($(ARCH),sparc)
99CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
100LDFLAGS+=-m32
101OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
102HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
103# -static is used to avoid g1/g3 usage by the dynamic linker
104LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
105endif
106
107ifeq ($(ARCH),sparc64)
108CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
109LDFLAGS+=-m64
110OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
111endif
112
113ifeq ($(ARCH),alpha)
114# -msmall-data is not used because we want two-instruction relocations
115# for the constant constructions
116OP_CFLAGS=-Wall -O2 -g
117# Ensure there's only a single GP
118CFLAGS += -msmall-data
119LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
120endif
121
122ifeq ($(ARCH),ia64)
123OP_CFLAGS=$(CFLAGS)
124endif
125
126ifeq ($(ARCH),arm)
127OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
128LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
129endif
130
38e584a0
FB
131ifeq ($(ARCH),m68k)
132OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
133LDFLAGS+=-Wl,-T,m68k.ld
134endif
135
626df76a
FB
136ifeq ($(HAVE_GCC3_OPTIONS),yes)
137# very important to generate a return at the end of every operation
138OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
139endif
140
141#########################################################
142
143DEFINES+=-D_GNU_SOURCE
144LIBS+=-lm
145
146# profiling code
147ifdef TARGET_GPROF
148LDFLAGS+=-p
149main.o: CFLAGS+=-p
150endif
151
f72b519c 152OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o
626df76a
FB
153ifeq ($(TARGET_ARCH), i386)
154OBJS+= vm86.o
155endif
f72b519c
FB
156ifeq ($(TARGET_ARCH), arm)
157OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
158nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
159 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o
160endif
626df76a
FB
161SRCS:= $(OBJS:.o=.c)
162OBJS+= libqemu.a
163
164# cpu emulator library
1e43adfc
FB
165LIBOBJS=thunk.o exec.o translate-all.o cpu-exec.o gdbstub.o \
166 translate.o op.o
626df76a
FB
167
168ifeq ($(TARGET_ARCH), i386)
1e43adfc 169LIBOBJS+=helper.o helper2.o
f72b519c
FB
170ifeq ($(ARCH), i386)
171LIBOBJS+=translate-copy.o
172endif
626df76a
FB
173endif
174
67867308 175ifeq ($(TARGET_ARCH), ppc)
728c9fd5 176LIBOBJS+= op_helper.o helper.o
67867308
FB
177endif
178
626df76a
FB
179# NOTE: the disassembler code is only needed for debugging
180LIBOBJS+=disas.o
181ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bc51c5c9
FB
182USE_I386_DIS=y
183endif
184ifeq ($(findstring amd64, $(TARGET_ARCH) $(ARCH)),amd64)
185USE_I386_DIS=y
186endif
187ifdef USE_I386_DIS
626df76a
FB
188LIBOBJS+=i386-dis.o
189endif
190ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
191LIBOBJS+=alpha-dis.o
192endif
193ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
194LIBOBJS+=ppc-dis.o
195endif
196ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
197LIBOBJS+=sparc-dis.o
198endif
199ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
200LIBOBJS+=arm-dis.o
201endif
202
203ifeq ($(ARCH),ia64)
204OBJS += ia64-syscall.o
205endif
206
1e43adfc 207all: $(PROGS)
626df76a 208
1e43adfc 209$(QEMU_USER): $(OBJS)
626df76a
FB
210 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
211ifeq ($(ARCH),alpha)
212# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
213# the address space (31 bit so sign extending doesn't matter)
214 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
215endif
216
217# must use static linking to avoid leaving stuff in virtual address space
9dc39cba
FB
218VL_OBJS=vl.o osdep.o block.o monitor.o \
219 ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o \
80cabfad 220 fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o
728c9fd5
FB
221ifeq ($(TARGET_ARCH), ppc)
222VL_OBJS+= hw.o
223endif
626df76a
FB
224ifdef CONFIG_SDL
225VL_OBJS+=sdl.o
de5eaa64
FB
226ifdef CONFIG_STATIC
227SDL_LIBS:=$(SDL_STATIC_LIBS)
228endif
626df76a
FB
229endif
230
c321f673
FB
231VL_LDFLAGS=
232# specific flags are needed for non soft mmu emulator
c321f673
FB
233ifdef CONFIG_STATIC
234VL_LDFLAGS+=-static
235endif
de5eaa64
FB
236ifndef CONFIG_SOFTMMU
237VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
238endif
c321f673 239
1e43adfc 240$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
9dc39cba 241 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) -lutil
626df76a
FB
242
243sdl.o: sdl.c
244 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
245
246depend: $(SRCS)
16e9b7de 247 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
626df76a
FB
248
249# libqemu
250
251libqemu.a: $(LIBOBJS)
252 rm -f $@
253 $(AR) rcs $@ $(LIBOBJS)
254
1e43adfc 255translate.o: translate.c gen-op.h opc.h cpu.h
626df76a 256
1e43adfc 257translate-all.o: translate-all.c op.h opc.h cpu.h
626df76a 258
1e43adfc 259op.h: op.o $(DYNGEN)
626df76a
FB
260 $(DYNGEN) -o $@ $<
261
1e43adfc 262opc.h: op.o $(DYNGEN)
626df76a
FB
263 $(DYNGEN) -c -o $@ $<
264
1e43adfc 265gen-op.h: op.o $(DYNGEN)
626df76a
FB
266 $(DYNGEN) -g -o $@ $<
267
1e43adfc 268op.o: op.c
626df76a
FB
269 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
270
1e43adfc 271helper.o: helper.c
626df76a
FB
272 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
273
1e43adfc
FB
274ifeq ($(TARGET_ARCH), i386)
275op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
276endif
277
278ifeq ($(TARGET_ARCH), arm)
279op.o: op.c op_template.h
280endif
626df76a 281
1e43adfc
FB
282ifeq ($(TARGET_ARCH), sparc)
283op.o: op.c op_template.h
284endif
626df76a 285
728c9fd5
FB
286ifeq ($(TARGET_ARCH), ppc)
287op.o: op.c op_template.h op_mem.h
288op_helper.o: op_helper_mem.h
289endif
290
626df76a
FB
291%.o: %.c
292 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
293
f72b519c
FB
294%.o: %.S
295 $(CC) $(DEFINES) -c -o $@ $<
296
626df76a 297clean:
f72b519c 298 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o
1e43adfc
FB
299
300install: all
301 install -m 755 -s $(PROGS) $(prefix)/bin
626df76a
FB
302
303ifneq ($(wildcard .depend),)
304include .depend
305endif