]> git.proxmox.com Git - qemu.git/blame - Makefile.target
suppressed use of gen_multi - use intermediate FT0 register for floats - use T0 tempo...
[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
149# NOTE: the disassembler code is only needed for debugging
150LIBOBJS+=disas.o
151ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
152LIBOBJS+=i386-dis.o
153endif
154ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
155LIBOBJS+=alpha-dis.o
156endif
157ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
158LIBOBJS+=ppc-dis.o
159endif
160ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
161LIBOBJS+=sparc-dis.o
162endif
163ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
164LIBOBJS+=arm-dis.o
165endif
166
167ifeq ($(ARCH),ia64)
168OBJS += ia64-syscall.o
169endif
170
1e43adfc 171all: $(PROGS)
626df76a 172
1e43adfc 173$(QEMU_USER): $(OBJS)
626df76a
FB
174 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
175ifeq ($(ARCH),alpha)
176# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
177# the address space (31 bit so sign extending doesn't matter)
178 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
179endif
180
181# must use static linking to avoid leaving stuff in virtual address space
27503323 182VL_OBJS=vl.o block.o ide.o vga.o sb16.o dma.o oss.o
626df76a
FB
183ifdef CONFIG_SDL
184VL_OBJS+=sdl.o
de5eaa64
FB
185ifdef CONFIG_STATIC
186SDL_LIBS:=$(SDL_STATIC_LIBS)
187endif
626df76a
FB
188endif
189
c321f673
FB
190VL_LDFLAGS=
191# specific flags are needed for non soft mmu emulator
c321f673
FB
192ifdef CONFIG_STATIC
193VL_LDFLAGS+=-static
194endif
de5eaa64
FB
195ifndef CONFIG_SOFTMMU
196VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
197endif
c321f673 198
1e43adfc 199$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
c321f673 200 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS)
626df76a
FB
201
202sdl.o: sdl.c
203 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
204
205depend: $(SRCS)
16e9b7de 206 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
626df76a
FB
207
208# libqemu
209
210libqemu.a: $(LIBOBJS)
211 rm -f $@
212 $(AR) rcs $@ $(LIBOBJS)
213
1e43adfc 214translate.o: translate.c gen-op.h opc.h cpu.h
626df76a 215
1e43adfc 216translate-all.o: translate-all.c op.h opc.h cpu.h
626df76a 217
1e43adfc 218op.h: op.o $(DYNGEN)
626df76a
FB
219 $(DYNGEN) -o $@ $<
220
1e43adfc 221opc.h: op.o $(DYNGEN)
626df76a
FB
222 $(DYNGEN) -c -o $@ $<
223
1e43adfc 224gen-op.h: op.o $(DYNGEN)
626df76a
FB
225 $(DYNGEN) -g -o $@ $<
226
1e43adfc 227op.o: op.c
626df76a
FB
228 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
229
1e43adfc 230helper.o: helper.c
626df76a
FB
231 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
232
1e43adfc
FB
233ifeq ($(TARGET_ARCH), i386)
234op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
235endif
236
237ifeq ($(TARGET_ARCH), arm)
238op.o: op.c op_template.h
239endif
626df76a 240
1e43adfc
FB
241ifeq ($(TARGET_ARCH), sparc)
242op.o: op.c op_template.h
243endif
626df76a
FB
244
245%.o: %.c
246 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
247
248clean:
1e43adfc
FB
249 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h
250
251install: all
252 install -m 755 -s $(PROGS) $(prefix)/bin
626df76a
FB
253
254ifneq ($(wildcard .depend),)
255include .depend
256endif