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
20 ifdef CONFIG_USER_ONLY
23 ifeq ($(TARGET_ARCH), i386)
46 CFLAGS+=-fomit-frame-pointer
47 OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
48 ifeq ($(HAVE_GCC3_OPTIONS),yes)
49 OP_CFLAGS+= -falign-functions=0
51 OP_CFLAGS+= -malign-functions=0
61 LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
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!
72 LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
77 LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
81 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
83 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
84 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
85 # -static is used to avoid g1/g3 usage by the dynamic linker
86 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
89 ifeq ($(ARCH),sparc64)
90 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
92 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
96 # -msmall-data is not used because we want two-instruction relocations
97 # for the constant constructions
98 OP_CFLAGS=-Wall -O2 -g
99 # Ensure there's only a single GP
100 CFLAGS += -msmall-data
101 LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
109 OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
110 LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
114 OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
115 LDFLAGS+=-Wl,-T,m68k.ld
118 ifeq ($(HAVE_GCC3_OPTIONS),yes)
119 # very important to generate a return at the end of every operation
120 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
123 #########################################################
125 DEFINES+=-D_GNU_SOURCE
134 OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o
135 ifeq ($(TARGET_ARCH), i386)
141 # cpu emulator library
142 LIBOBJS=thunk.o exec.o translate-all.o cpu-exec.o gdbstub.o \
145 ifeq ($(TARGET_ARCH), i386)
146 LIBOBJS+=helper.o helper2.o
149 ifeq ($(TARGET_ARCH), ppc)
153 # NOTE: the disassembler code is only needed for debugging
155 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
158 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
161 ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
164 ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
167 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
172 OBJS += ia64-syscall.o
177 $(QEMU_USER): $(OBJS)
178 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
180 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
181 # the address space (31 bit so sign extending doesn't matter)
182 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
185 # must use static linking to avoid leaving stuff in virtual address space
186 VL_OBJS=vl.o block.o ide.o vga.o sb16.o dma.o oss.o
190 SDL_LIBS:=$(SDL_STATIC_LIBS)
195 # specific flags are needed for non soft mmu emulator
199 ifndef CONFIG_SOFTMMU
200 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
203 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
204 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS)
207 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
210 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
214 libqemu.a: $(LIBOBJS)
216 $(AR) rcs $@ $(LIBOBJS)
218 translate.o: translate.c gen-op.h opc.h cpu.h
220 translate-all.o: translate-all.c op.h opc.h cpu.h
225 opc.h: op.o $(DYNGEN)
226 $(DYNGEN) -c -o $@ $<
228 gen-op.h: op.o $(DYNGEN)
229 $(DYNGEN) -g -o $@ $<
232 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
235 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
237 ifeq ($(TARGET_ARCH), i386)
238 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
241 ifeq ($(TARGET_ARCH), arm)
242 op.o: op.c op_template.h
245 ifeq ($(TARGET_ARCH), sparc)
246 op.o: op.c op_template.h
250 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
253 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h
256 install -m 755 -s $(PROGS) $(prefix)/bin
258 ifneq ($(wildcard .depend),)