]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile.target
base memory size in cmos
[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
3035f7ff
FB
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
626df76a
FB
10CFLAGS=-Wall -O2 -g
11LDFLAGS=-g
12LIBS=
626df76a 13HELPER_CFLAGS=$(CFLAGS)
67b915a5 14DYNGEN=../dyngen$(EXESUF)
1e43adfc
FB
15# user emulator name
16QEMU_USER=qemu-$(TARGET_ARCH)
17# system emulator name
18ifdef CONFIG_SOFTMMU
67b915a5 19QEMU_SYSTEM=qemu$(EXESUF)
0db63474
FB
20else
21QEMU_SYSTEM=qemu-fast
1e43adfc
FB
22endif
23
16e9b7de 24ifdef CONFIG_USER_ONLY
1e43adfc 25PROGS=$(QEMU_USER)
16e9b7de 26else
16e9b7de 27ifeq ($(TARGET_ARCH), i386)
c321f673
FB
28
29ifeq ($(ARCH), i386)
30PROGS+=$(QEMU_SYSTEM)
de5eaa64
FB
31ifndef CONFIG_SOFTMMU
32CONFIG_STATIC=y
33endif
38ca2abc
FB
34else
35# the system emulator using soft mmu is portable
c321f673 36ifdef CONFIG_SOFTMMU
16e9b7de
FB
37PROGS+=$(QEMU_SYSTEM)
38endif
38ca2abc 39endif # ARCH != i386
c321f673 40
38ca2abc 41endif # TARGET_ARCH = i386
728c9fd5
FB
42
43ifeq ($(TARGET_ARCH), ppc)
44
45ifeq ($(ARCH), ppc)
46PROGS+=$(QEMU_SYSTEM)
47endif
48
49ifeq ($(ARCH), i386)
50ifdef CONFIG_SOFTMMU
51PROGS+=$(QEMU_SYSTEM)
626df76a 52endif
728c9fd5
FB
53endif # ARCH = i386
54
55endif # TARGET_ARCH = ppc
56endif # !CONFIG_USER_ONLY
626df76a
FB
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
3a4739d6 70
626df76a 71ifdef TARGET_GPROF
3a4739d6
FB
72USE_I386_LD=y
73endif
74ifdef CONFIG_STATIC
75USE_I386_LD=y
76endif
77ifdef USE_I386_LD
626df76a
FB
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
626df76a
FB
85endif
86
bc51c5c9
FB
87ifeq ($(ARCH),amd64)
88OP_CFLAGS=$(CFLAGS) -falign-functions=0
89LDFLAGS+=-Wl,-T,$(SRC_PATH)/amd64.ld
90endif
91
626df76a
FB
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
38e584a0
FB
135ifeq ($(ARCH),m68k)
136OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
137LDFLAGS+=-Wl,-T,m68k.ld
138endif
139
626df76a
FB
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
67b915a5
FB
149ifdef CONFIG_WIN32
150LIBS+=-lwinmm
151endif
626df76a
FB
152
153# profiling code
154ifdef TARGET_GPROF
155LDFLAGS+=-p
156main.o: CFLAGS+=-p
157endif
158
3035f7ff 159OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o
626df76a
FB
160ifeq ($(TARGET_ARCH), i386)
161OBJS+= vm86.o
162endif
f72b519c
FB
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
626df76a
FB
168SRCS:= $(OBJS:.o=.c)
169OBJS+= libqemu.a
170
171# cpu emulator library
858693c6 172LIBOBJS=exec.o translate-all.o cpu-exec.o\
1e43adfc 173 translate.o op.o
626df76a
FB
174
175ifeq ($(TARGET_ARCH), i386)
1e43adfc 176LIBOBJS+=helper.o helper2.o
f72b519c
FB
177ifeq ($(ARCH), i386)
178LIBOBJS+=translate-copy.o
179endif
626df76a
FB
180endif
181
67867308 182ifeq ($(TARGET_ARCH), ppc)
728c9fd5 183LIBOBJS+= op_helper.o helper.o
67867308
FB
184endif
185
626df76a
FB
186# NOTE: the disassembler code is only needed for debugging
187LIBOBJS+=disas.o
188ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bc51c5c9
FB
189USE_I386_DIS=y
190endif
191ifeq ($(findstring amd64, $(TARGET_ARCH) $(ARCH)),amd64)
192USE_I386_DIS=y
193endif
194ifdef USE_I386_DIS
626df76a
FB
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
1e43adfc 214all: $(PROGS)
626df76a 215
1e43adfc 216$(QEMU_USER): $(OBJS)
626df76a
FB
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
67b915a5 225VL_OBJS=vl.o osdep.o block.o monitor.o \
9dc39cba 226 ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o \
80cabfad 227 fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o
67b915a5
FB
228ifdef CONFIG_GDBSTUB
229VL_OBJS+=gdbstub.o
230endif
728c9fd5
FB
231ifeq ($(TARGET_ARCH), ppc)
232VL_OBJS+= hw.o
233endif
626df76a
FB
234ifdef CONFIG_SDL
235VL_OBJS+=sdl.o
de5eaa64
FB
236ifdef CONFIG_STATIC
237SDL_LIBS:=$(SDL_STATIC_LIBS)
238endif
626df76a
FB
239endif
240
c321f673
FB
241VL_LDFLAGS=
242# specific flags are needed for non soft mmu emulator
c321f673
FB
243ifdef CONFIG_STATIC
244VL_LDFLAGS+=-static
245endif
de5eaa64
FB
246ifndef CONFIG_SOFTMMU
247VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
248endif
11d9f695
FB
249ifndef CONFIG_WIN32
250VL_LIBS=-lutil
251endif
c321f673 252
1e43adfc 253$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
11d9f695 254 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS)
626df76a
FB
255
256sdl.o: sdl.c
257 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
258
259depend: $(SRCS)
16e9b7de 260 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
626df76a
FB
261
262# libqemu
263
264libqemu.a: $(LIBOBJS)
265 rm -f $@
266 $(AR) rcs $@ $(LIBOBJS)
267
1e43adfc 268translate.o: translate.c gen-op.h opc.h cpu.h
626df76a 269
1e43adfc 270translate-all.o: translate-all.c op.h opc.h cpu.h
626df76a 271
1e43adfc 272op.h: op.o $(DYNGEN)
626df76a
FB
273 $(DYNGEN) -o $@ $<
274
1e43adfc 275opc.h: op.o $(DYNGEN)
626df76a
FB
276 $(DYNGEN) -c -o $@ $<
277
1e43adfc 278gen-op.h: op.o $(DYNGEN)
626df76a
FB
279 $(DYNGEN) -g -o $@ $<
280
1e43adfc 281op.o: op.c
626df76a
FB
282 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
283
1e43adfc 284helper.o: helper.c
626df76a
FB
285 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
286
1e43adfc
FB
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
626df76a 294
1e43adfc
FB
295ifeq ($(TARGET_ARCH), sparc)
296op.o: op.c op_template.h
297endif
626df76a 298
728c9fd5
FB
299ifeq ($(TARGET_ARCH), ppc)
300op.o: op.c op_template.h op_mem.h
301op_helper.o: op_helper_mem.h
302endif
303
626df76a
FB
304%.o: %.c
305 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
306
f72b519c
FB
307%.o: %.S
308 $(CC) $(DEFINES) -c -o $@ $<
309
626df76a 310clean:
f72b519c 311 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o
1e43adfc
FB
312
313install: all
9b14bb04 314ifneq ($(PROGS),)
11d9f695 315 install -m 755 -s $(PROGS) "$(bindir)"
9b14bb04 316endif
626df76a
FB
317
318ifneq ($(wildcard .depend),)
319include .depend
320endif