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