3 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
4 VPATH=$(SRC_PATH):$(TARGET_PATH)
8 DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
9 HELPER_CFLAGS=$(CFLAGS)
12 QEMU_USER=qemu-$(TARGET_ARCH)
13 # system emulator name
15 QEMU_SYSTEM=qemu-softmmu
20 ifdef CONFIG_USER_ONLY
24 ifeq ($(TARGET_ARCH), i386)
35 CFLAGS+=-fomit-frame-pointer
36 OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
37 ifeq ($(HAVE_GCC3_OPTIONS),yes)
38 OP_CFLAGS+= -falign-functions=0
40 OP_CFLAGS+= -malign-functions=0
43 LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
45 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
46 # that the kernel ELF loader considers as an executable. I think this
47 # is the simplest way to make it self virtualizable!
54 LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
59 LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
63 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
65 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
66 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
67 # -static is used to avoid g1/g3 usage by the dynamic linker
68 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
71 ifeq ($(ARCH),sparc64)
72 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
74 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
78 # -msmall-data is not used because we want two-instruction relocations
79 # for the constant constructions
80 OP_CFLAGS=-Wall -O2 -g
81 # Ensure there's only a single GP
82 CFLAGS += -msmall-data
83 LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
91 OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
92 LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
96 OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
97 LDFLAGS+=-Wl,-T,m68k.ld
100 ifeq ($(HAVE_GCC3_OPTIONS),yes)
101 # very important to generate a return at the end of every operation
102 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
105 #########################################################
107 DEFINES+=-D_GNU_SOURCE
116 OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o
117 ifeq ($(TARGET_ARCH), i386)
123 # cpu emulator library
124 LIBOBJS=thunk.o exec.o translate-all.o cpu-exec.o gdbstub.o \
127 ifeq ($(TARGET_ARCH), i386)
128 LIBOBJS+=helper.o helper2.o
131 # NOTE: the disassembler code is only needed for debugging
133 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
136 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
139 ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
142 ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
145 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
150 OBJS += ia64-syscall.o
155 $(QEMU_USER): $(OBJS)
156 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
158 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
159 # the address space (31 bit so sign extending doesn't matter)
160 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
163 # must use static linking to avoid leaving stuff in virtual address space
164 VL_OBJS=vl.o block.o vga.o
167 SDL_LIBS+=-L/usr/X11R6/lib -lX11 -lXext -lXv -ldl -lm
170 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
171 $(CC) -static -Wl,-T,$(SRC_PATH)/i386-vl.ld -o $@ $^ $(LIBS) $(SDL_LIBS)
174 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
177 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
181 libqemu.a: $(LIBOBJS)
183 $(AR) rcs $@ $(LIBOBJS)
185 translate.o: translate.c gen-op.h opc.h cpu.h
187 translate-all.o: translate-all.c op.h opc.h cpu.h
192 opc.h: op.o $(DYNGEN)
193 $(DYNGEN) -c -o $@ $<
195 gen-op.h: op.o $(DYNGEN)
196 $(DYNGEN) -g -o $@ $<
199 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
202 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
204 ifeq ($(TARGET_ARCH), i386)
205 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
208 ifeq ($(TARGET_ARCH), arm)
209 op.o: op.c op_template.h
212 ifeq ($(TARGET_ARCH), sparc)
213 op.o: op.c op_template.h
217 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
220 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h
223 install -m 755 -s $(PROGS) $(prefix)/bin
225 ifneq ($(wildcard .depend),)