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