]> git.proxmox.com Git - qemu.git/blame - Makefile.target
sparc emulation target (thanx to Thomas M. Ogrisegg)
[qemu.git] / Makefile.target
CommitLineData
626df76a
FB
1include config.mak
2
3VPATH=$(SRC_PATH)
4CFLAGS=-Wall -O2 -g
5LDFLAGS=-g
6LIBS=
7DEFINES=-I.
8HELPER_CFLAGS=$(CFLAGS)
9DYNGEN=../dyngen
10ifndef CONFIG_SOFTMMU
11PROGS=qemu
12endif
13
14ifdef CONFIG_STATIC
15LDFLAGS+=-static
16endif
17
18ifeq ($(ARCH),i386)
19CFLAGS+=-fomit-frame-pointer
20OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
21ifeq ($(HAVE_GCC3_OPTIONS),yes)
22OP_CFLAGS+= -falign-functions=0
23else
24OP_CFLAGS+= -malign-functions=0
25endif
26ifdef TARGET_GPROF
27LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
28else
29# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
30# that the kernel ELF loader considers as an executable. I think this
31# is the simplest way to make it self virtualizable!
32LDFLAGS+=-Wl,-shared
33endif
34ifeq ($(TARGET_ARCH), i386)
35PROGS+=vl
36endif
37endif
38
39ifeq ($(ARCH),ppc)
40OP_CFLAGS=$(CFLAGS)
41LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
42endif
43
44ifeq ($(ARCH),s390)
45OP_CFLAGS=$(CFLAGS)
46LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
47endif
48
49ifeq ($(ARCH),sparc)
50CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
51LDFLAGS+=-m32
52OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
53HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
54# -static is used to avoid g1/g3 usage by the dynamic linker
55LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
56endif
57
58ifeq ($(ARCH),sparc64)
59CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
60LDFLAGS+=-m64
61OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
62endif
63
64ifeq ($(ARCH),alpha)
65# -msmall-data is not used because we want two-instruction relocations
66# for the constant constructions
67OP_CFLAGS=-Wall -O2 -g
68# Ensure there's only a single GP
69CFLAGS += -msmall-data
70LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
71endif
72
73ifeq ($(ARCH),ia64)
74OP_CFLAGS=$(CFLAGS)
75endif
76
77ifeq ($(ARCH),arm)
78OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
79LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
80endif
81
38e584a0
FB
82ifeq ($(ARCH),m68k)
83OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
84LDFLAGS+=-Wl,-T,m68k.ld
85endif
86
626df76a
FB
87ifeq ($(HAVE_GCC3_OPTIONS),yes)
88# very important to generate a return at the end of every operation
89OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
90endif
91
92#########################################################
93
94DEFINES+=-D_GNU_SOURCE
95LIBS+=-lm
96
97# profiling code
98ifdef TARGET_GPROF
99LDFLAGS+=-p
100main.o: CFLAGS+=-p
101endif
102
103OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o
104ifeq ($(TARGET_ARCH), i386)
105OBJS+= vm86.o
106endif
107SRCS:= $(OBJS:.o=.c)
108OBJS+= libqemu.a
109
110# cpu emulator library
111LIBOBJS=thunk.o exec.o translate.o cpu-exec.o gdbstub.o
112
113ifeq ($(TARGET_ARCH), i386)
114LIBOBJS+=translate-i386.o op-i386.o helper-i386.o helper2-i386.o
115endif
116ifeq ($(TARGET_ARCH), arm)
117LIBOBJS+=translate-arm.o op-arm.o
118endif
119
120# NOTE: the disassembler code is only needed for debugging
121LIBOBJS+=disas.o
122ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
123LIBOBJS+=i386-dis.o
124endif
125ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
126LIBOBJS+=alpha-dis.o
127endif
128ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
129LIBOBJS+=ppc-dis.o
130endif
131ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
132LIBOBJS+=sparc-dis.o
133endif
134ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
135LIBOBJS+=arm-dis.o
136endif
137
138ifeq ($(ARCH),ia64)
139OBJS += ia64-syscall.o
140endif
141
142all: $(PROGS) qemu-doc.html
143
144qemu: $(OBJS)
145 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
146ifeq ($(ARCH),alpha)
147# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
148# the address space (31 bit so sign extending doesn't matter)
149 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
150endif
151
152# must use static linking to avoid leaving stuff in virtual address space
153VL_OBJS=vl.o block.o vga.o
154ifdef CONFIG_SDL
155VL_OBJS+=sdl.o
b7dda06a 156SDL_LIBS+=-L/usr/X11R6/lib -lX11 -lXext -lXv -ldl -lm
626df76a
FB
157endif
158
159vl: $(VL_OBJS) libqemu.a
160 $(CC) -static -Wl,-T,$(SRC_PATH)/i386-vl.ld -o $@ $^ $(LIBS) $(SDL_LIBS)
161
162sdl.o: sdl.c
163 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
164
165depend: $(SRCS)
166 $(CC) -MM $(CFLAGS) $^ 1>.depend
167
168# libqemu
169
170libqemu.a: $(LIBOBJS)
171 rm -f $@
172 $(AR) rcs $@ $(LIBOBJS)
173
174translate-$(TARGET_ARCH).o: translate-$(TARGET_ARCH).c gen-op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h
175
176translate.o: translate.c op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h
177
178op-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o $(DYNGEN)
179 $(DYNGEN) -o $@ $<
180
181opc-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o $(DYNGEN)
182 $(DYNGEN) -c -o $@ $<
183
184gen-op-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o $(DYNGEN)
185 $(DYNGEN) -g -o $@ $<
186
187op-$(TARGET_ARCH).o: op-$(TARGET_ARCH).c
188 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
189
190helper-$(TARGET_ARCH).o: helper-$(TARGET_ARCH).c
191 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
192
193op-i386.o: op-i386.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
194
195op-arm.o: op-arm.c op-arm-template.h
196
197%.o: %.c
198 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
199
200clean:
201 rm -f *.o *.a *~ $(PROGS) \
202 gen-op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h op-$(TARGET_ARCH).h
203
204ifneq ($(wildcard .depend),)
205include .depend
206endif