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