3 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
4 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
5 DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
7 VPATH+=:$(SRC_PATH)/linux-user
8 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
13 HELPER_CFLAGS=$(CFLAGS)
14 DYNGEN=../dyngen$(EXESUF)
16 QEMU_USER=qemu-$(TARGET_ARCH)
17 # system emulator name
19 QEMU_SYSTEM=qemu$(EXESUF)
24 ifdef CONFIG_USER_ONLY
27 ifeq ($(TARGET_ARCH), i386)
35 # the system emulator using soft mmu is portable
41 endif # TARGET_ARCH = i386
43 ifeq ($(TARGET_ARCH), ppc)
55 endif # TARGET_ARCH = ppc
56 endif # !CONFIG_USER_ONLY
63 CFLAGS+=-fomit-frame-pointer
64 OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
65 ifeq ($(HAVE_GCC3_OPTIONS),yes)
66 OP_CFLAGS+= -falign-functions=0
68 OP_CFLAGS+= -malign-functions=0
78 LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
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!
88 OP_CFLAGS=$(CFLAGS) -falign-functions=0
89 LDFLAGS+=-Wl,-T,$(SRC_PATH)/amd64.ld
94 LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
99 LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
103 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
105 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
106 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
107 # -static is used to avoid g1/g3 usage by the dynamic linker
108 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
111 ifeq ($(ARCH),sparc64)
112 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
114 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
118 # -msmall-data is not used because we want two-instruction relocations
119 # for the constant constructions
120 OP_CFLAGS=-Wall -O2 -g
121 # Ensure there's only a single GP
122 CFLAGS += -msmall-data
123 LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
131 OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
132 LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
136 OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
137 LDFLAGS+=-Wl,-T,m68k.ld
140 ifeq ($(HAVE_GCC3_OPTIONS),yes)
141 # very important to generate a return at the end of every operation
142 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
145 #########################################################
147 DEFINES+=-D_GNU_SOURCE
159 OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o
160 ifeq ($(TARGET_ARCH), i386)
163 ifeq ($(TARGET_ARCH), arm)
164 OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
165 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
166 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o
171 # cpu emulator library
172 LIBOBJS=exec.o translate-all.o cpu-exec.o\
175 ifeq ($(TARGET_ARCH), i386)
176 LIBOBJS+=helper.o helper2.o
178 LIBOBJS+=translate-copy.o
182 ifeq ($(TARGET_ARCH), ppc)
183 LIBOBJS+= op_helper.o helper.o
186 # NOTE: the disassembler code is only needed for debugging
188 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
191 ifeq ($(findstring amd64, $(TARGET_ARCH) $(ARCH)),amd64)
197 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
200 ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
203 ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
206 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
211 OBJS += ia64-syscall.o
216 $(QEMU_USER): $(OBJS)
217 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
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
224 # must use static linking to avoid leaving stuff in virtual address space
225 VL_OBJS=vl.o osdep.o block.o monitor.o \
226 ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o \
227 fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o
231 ifeq ($(TARGET_ARCH), ppc)
237 SDL_LIBS:=$(SDL_STATIC_LIBS)
242 # specific flags are needed for non soft mmu emulator
246 ifndef CONFIG_SOFTMMU
247 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
253 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
254 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS)
257 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
260 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
264 libqemu.a: $(LIBOBJS)
266 $(AR) rcs $@ $(LIBOBJS)
268 translate.o: translate.c gen-op.h opc.h cpu.h
270 translate-all.o: translate-all.c op.h opc.h cpu.h
275 opc.h: op.o $(DYNGEN)
276 $(DYNGEN) -c -o $@ $<
278 gen-op.h: op.o $(DYNGEN)
279 $(DYNGEN) -g -o $@ $<
282 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
285 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
287 ifeq ($(TARGET_ARCH), i386)
288 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
291 ifeq ($(TARGET_ARCH), arm)
292 op.o: op.c op_template.h
295 ifeq ($(TARGET_ARCH), sparc)
296 op.o: op.c op_template.h
299 ifeq ($(TARGET_ARCH), ppc)
300 op.o: op.c op_template.h op_mem.h
301 op_helper.o: op_helper_mem.h
305 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
308 $(CC) $(DEFINES) -c -o $@ $<
311 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o
315 install -m 755 -s $(PROGS) "$(bindir)"
318 ifneq ($(wildcard .depend),)