root / Makefile.target @ 6c9bf893
History | View | Annotate | Download (5.6 kB)
1 | 626df76a | bellard | include config.mak |
---|---|---|---|
2 | 626df76a | bellard | |
3 | 1e43adfc | bellard | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH) |
4 | 1e43adfc | bellard | VPATH=$(SRC_PATH):$(TARGET_PATH) |
5 | 626df76a | bellard | CFLAGS=-Wall -O2 -g |
6 | 626df76a | bellard | LDFLAGS=-g |
7 | 626df76a | bellard | LIBS= |
8 | 1e43adfc | bellard | DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH) |
9 | 626df76a | bellard | HELPER_CFLAGS=$(CFLAGS) |
10 | 626df76a | bellard | DYNGEN=../dyngen |
11 | 1e43adfc | bellard | # user emulator name |
12 | 1e43adfc | bellard | QEMU_USER=qemu-$(TARGET_ARCH) |
13 | 1e43adfc | bellard | # system emulator name |
14 | 1e43adfc | bellard | ifdef CONFIG_SOFTMMU |
15 | 1e43adfc | bellard | QEMU_SYSTEM=qemu |
16 | 0db63474 | bellard | else |
17 | 0db63474 | bellard | QEMU_SYSTEM=qemu-fast |
18 | 1e43adfc | bellard | endif |
19 | 1e43adfc | bellard | |
20 | 16e9b7de | bellard | ifdef CONFIG_USER_ONLY |
21 | 1e43adfc | bellard | PROGS=$(QEMU_USER) |
22 | 16e9b7de | bellard | else |
23 | 16e9b7de | bellard | ifeq ($(TARGET_ARCH), i386) |
24 | c321f673 | bellard | |
25 | c321f673 | bellard | ifeq ($(ARCH), i386) |
26 | c321f673 | bellard | PROGS+=$(QEMU_SYSTEM) |
27 | de5eaa64 | bellard | ifndef CONFIG_SOFTMMU |
28 | de5eaa64 | bellard | CONFIG_STATIC=y |
29 | de5eaa64 | bellard | endif |
30 | c321f673 | bellard | endif |
31 | c321f673 | bellard | |
32 | c321f673 | bellard | ifeq ($(ARCH), ppc) |
33 | c321f673 | bellard | ifdef CONFIG_SOFTMMU |
34 | 16e9b7de | bellard | PROGS+=$(QEMU_SYSTEM) |
35 | 16e9b7de | bellard | endif |
36 | 16e9b7de | bellard | endif |
37 | c321f673 | bellard | |
38 | c321f673 | bellard | endif |
39 | 728c9fd5 | bellard | |
40 | 728c9fd5 | bellard | ifeq ($(TARGET_ARCH), ppc) |
41 | 728c9fd5 | bellard | |
42 | 728c9fd5 | bellard | ifeq ($(ARCH), ppc) |
43 | 728c9fd5 | bellard | PROGS+=$(QEMU_SYSTEM) |
44 | 728c9fd5 | bellard | endif |
45 | 728c9fd5 | bellard | |
46 | 728c9fd5 | bellard | ifeq ($(ARCH), i386) |
47 | 728c9fd5 | bellard | ifdef CONFIG_SOFTMMU |
48 | 728c9fd5 | bellard | PROGS+=$(QEMU_SYSTEM) |
49 | 626df76a | bellard | endif |
50 | 728c9fd5 | bellard | endif # ARCH = i386 |
51 | 728c9fd5 | bellard | |
52 | 728c9fd5 | bellard | endif # TARGET_ARCH = ppc |
53 | 728c9fd5 | bellard | endif # !CONFIG_USER_ONLY |
54 | 626df76a | bellard | |
55 | 626df76a | bellard | ifdef CONFIG_STATIC |
56 | 626df76a | bellard | LDFLAGS+=-static |
57 | 626df76a | bellard | endif |
58 | 626df76a | bellard | |
59 | 626df76a | bellard | ifeq ($(ARCH),i386) |
60 | 626df76a | bellard | CFLAGS+=-fomit-frame-pointer |
61 | 626df76a | bellard | OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2 |
62 | 626df76a | bellard | ifeq ($(HAVE_GCC3_OPTIONS),yes) |
63 | 626df76a | bellard | OP_CFLAGS+= -falign-functions=0 |
64 | 626df76a | bellard | else |
65 | 626df76a | bellard | OP_CFLAGS+= -malign-functions=0 |
66 | 626df76a | bellard | endif |
67 | 3a4739d6 | bellard | |
68 | 626df76a | bellard | ifdef TARGET_GPROF |
69 | 3a4739d6 | bellard | USE_I386_LD=y |
70 | 3a4739d6 | bellard | endif |
71 | 3a4739d6 | bellard | ifdef CONFIG_STATIC |
72 | 3a4739d6 | bellard | USE_I386_LD=y |
73 | 3a4739d6 | bellard | endif |
74 | 3a4739d6 | bellard | ifdef USE_I386_LD |
75 | 626df76a | bellard | LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld |
76 | 626df76a | bellard | else |
77 | 626df76a | bellard | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object |
78 | 626df76a | bellard | # that the kernel ELF loader considers as an executable. I think this |
79 | 626df76a | bellard | # is the simplest way to make it self virtualizable! |
80 | 626df76a | bellard | LDFLAGS+=-Wl,-shared |
81 | 626df76a | bellard | endif |
82 | 626df76a | bellard | endif |
83 | 626df76a | bellard | |
84 | 626df76a | bellard | ifeq ($(ARCH),ppc) |
85 | 626df76a | bellard | OP_CFLAGS=$(CFLAGS) |
86 | 626df76a | bellard | LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld |
87 | 626df76a | bellard | endif |
88 | 626df76a | bellard | |
89 | 626df76a | bellard | ifeq ($(ARCH),s390) |
90 | 626df76a | bellard | OP_CFLAGS=$(CFLAGS) |
91 | 626df76a | bellard | LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld |
92 | 626df76a | bellard | endif |
93 | 626df76a | bellard | |
94 | 626df76a | bellard | ifeq ($(ARCH),sparc) |
95 | 626df76a | bellard | CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 |
96 | 626df76a | bellard | LDFLAGS+=-m32 |
97 | 626df76a | bellard | OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 |
98 | 626df76a | bellard | HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat |
99 | 626df76a | bellard | # -static is used to avoid g1/g3 usage by the dynamic linker |
100 | 626df76a | bellard | LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static |
101 | 626df76a | bellard | endif |
102 | 626df76a | bellard | |
103 | 626df76a | bellard | ifeq ($(ARCH),sparc64) |
104 | 626df76a | bellard | CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 |
105 | 626df76a | bellard | LDFLAGS+=-m64 |
106 | 626df76a | bellard | OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 |
107 | 626df76a | bellard | endif |
108 | 626df76a | bellard | |
109 | 626df76a | bellard | ifeq ($(ARCH),alpha) |
110 | 626df76a | bellard | # -msmall-data is not used because we want two-instruction relocations |
111 | 626df76a | bellard | # for the constant constructions |
112 | 626df76a | bellard | OP_CFLAGS=-Wall -O2 -g |
113 | 626df76a | bellard | # Ensure there's only a single GP |
114 | 626df76a | bellard | CFLAGS += -msmall-data |
115 | 626df76a | bellard | LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld |
116 | 626df76a | bellard | endif |
117 | 626df76a | bellard | |
118 | 626df76a | bellard | ifeq ($(ARCH),ia64) |
119 | 626df76a | bellard | OP_CFLAGS=$(CFLAGS) |
120 | 626df76a | bellard | endif |
121 | 626df76a | bellard | |
122 | 626df76a | bellard | ifeq ($(ARCH),arm) |
123 | 626df76a | bellard | OP_CFLAGS=$(CFLAGS) -mno-sched-prolog |
124 | 626df76a | bellard | LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld |
125 | 626df76a | bellard | endif |
126 | 626df76a | bellard | |
127 | 38e584a0 | bellard | ifeq ($(ARCH),m68k) |
128 | 38e584a0 | bellard | OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer |
129 | 38e584a0 | bellard | LDFLAGS+=-Wl,-T,m68k.ld |
130 | 38e584a0 | bellard | endif |
131 | 38e584a0 | bellard | |
132 | 626df76a | bellard | ifeq ($(HAVE_GCC3_OPTIONS),yes) |
133 | 626df76a | bellard | # very important to generate a return at the end of every operation |
134 | 626df76a | bellard | OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls |
135 | 626df76a | bellard | endif |
136 | 626df76a | bellard | |
137 | 626df76a | bellard | ######################################################### |
138 | 626df76a | bellard | |
139 | 626df76a | bellard | DEFINES+=-D_GNU_SOURCE |
140 | 626df76a | bellard | LIBS+=-lm |
141 | 626df76a | bellard | |
142 | 626df76a | bellard | # profiling code |
143 | 626df76a | bellard | ifdef TARGET_GPROF |
144 | 626df76a | bellard | LDFLAGS+=-p |
145 | 626df76a | bellard | main.o: CFLAGS+=-p |
146 | 626df76a | bellard | endif |
147 | 626df76a | bellard | |
148 | 626df76a | bellard | OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o |
149 | 626df76a | bellard | ifeq ($(TARGET_ARCH), i386) |
150 | 626df76a | bellard | OBJS+= vm86.o |
151 | 626df76a | bellard | endif |
152 | 626df76a | bellard | SRCS:= $(OBJS:.o=.c) |
153 | 626df76a | bellard | OBJS+= libqemu.a |
154 | 626df76a | bellard | |
155 | 626df76a | bellard | # cpu emulator library |
156 | 1e43adfc | bellard | LIBOBJS=thunk.o exec.o translate-all.o cpu-exec.o gdbstub.o \ |
157 | 1e43adfc | bellard | translate.o op.o |
158 | 626df76a | bellard | |
159 | 626df76a | bellard | ifeq ($(TARGET_ARCH), i386) |
160 | 1e43adfc | bellard | LIBOBJS+=helper.o helper2.o |
161 | 626df76a | bellard | endif |
162 | 626df76a | bellard | |
163 | 67867308 | bellard | ifeq ($(TARGET_ARCH), ppc) |
164 | 728c9fd5 | bellard | LIBOBJS+= op_helper.o helper.o |
165 | 67867308 | bellard | endif |
166 | 67867308 | bellard | |
167 | 626df76a | bellard | # NOTE: the disassembler code is only needed for debugging |
168 | 626df76a | bellard | LIBOBJS+=disas.o |
169 | 626df76a | bellard | ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) |
170 | 626df76a | bellard | LIBOBJS+=i386-dis.o |
171 | 626df76a | bellard | endif |
172 | 626df76a | bellard | ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) |
173 | 626df76a | bellard | LIBOBJS+=alpha-dis.o |
174 | 626df76a | bellard | endif |
175 | 626df76a | bellard | ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc) |
176 | 626df76a | bellard | LIBOBJS+=ppc-dis.o |
177 | 626df76a | bellard | endif |
178 | 626df76a | bellard | ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc) |
179 | 626df76a | bellard | LIBOBJS+=sparc-dis.o |
180 | 626df76a | bellard | endif |
181 | 626df76a | bellard | ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) |
182 | 626df76a | bellard | LIBOBJS+=arm-dis.o |
183 | 626df76a | bellard | endif |
184 | 626df76a | bellard | |
185 | 626df76a | bellard | ifeq ($(ARCH),ia64) |
186 | 626df76a | bellard | OBJS += ia64-syscall.o |
187 | 626df76a | bellard | endif |
188 | 626df76a | bellard | |
189 | 1e43adfc | bellard | all: $(PROGS) |
190 | 626df76a | bellard | |
191 | 1e43adfc | bellard | $(QEMU_USER): $(OBJS) |
192 | 626df76a | bellard | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
193 | 626df76a | bellard | ifeq ($(ARCH),alpha) |
194 | 626df76a | bellard | # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of |
195 | 626df76a | bellard | # the address space (31 bit so sign extending doesn't matter) |
196 | 626df76a | bellard | echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc |
197 | 626df76a | bellard | endif |
198 | 626df76a | bellard | |
199 | 626df76a | bellard | # must use static linking to avoid leaving stuff in virtual address space |
200 | 728c9fd5 | bellard | VL_OBJS=vl.o block.o ide.o vga.o sb16.o dma.o oss.o fdc.o |
201 | 728c9fd5 | bellard | ifeq ($(TARGET_ARCH), ppc) |
202 | 728c9fd5 | bellard | VL_OBJS+= hw.o |
203 | 728c9fd5 | bellard | endif |
204 | 626df76a | bellard | ifdef CONFIG_SDL |
205 | 626df76a | bellard | VL_OBJS+=sdl.o |
206 | de5eaa64 | bellard | ifdef CONFIG_STATIC |
207 | de5eaa64 | bellard | SDL_LIBS:=$(SDL_STATIC_LIBS) |
208 | de5eaa64 | bellard | endif |
209 | 626df76a | bellard | endif |
210 | 626df76a | bellard | |
211 | c321f673 | bellard | VL_LDFLAGS= |
212 | c321f673 | bellard | # specific flags are needed for non soft mmu emulator |
213 | c321f673 | bellard | ifdef CONFIG_STATIC |
214 | c321f673 | bellard | VL_LDFLAGS+=-static |
215 | c321f673 | bellard | endif |
216 | de5eaa64 | bellard | ifndef CONFIG_SOFTMMU |
217 | de5eaa64 | bellard | VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld |
218 | de5eaa64 | bellard | endif |
219 | c321f673 | bellard | |
220 | 1e43adfc | bellard | $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a |
221 | c321f673 | bellard | $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) |
222 | 626df76a | bellard | |
223 | 626df76a | bellard | sdl.o: sdl.c |
224 | 626df76a | bellard | $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< |
225 | 626df76a | bellard | |
226 | 626df76a | bellard | depend: $(SRCS) |
227 | 16e9b7de | bellard | $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend |
228 | 626df76a | bellard | |
229 | 626df76a | bellard | # libqemu |
230 | 626df76a | bellard | |
231 | 626df76a | bellard | libqemu.a: $(LIBOBJS) |
232 | 626df76a | bellard | rm -f $@ |
233 | 626df76a | bellard | $(AR) rcs $@ $(LIBOBJS) |
234 | 626df76a | bellard | |
235 | 1e43adfc | bellard | translate.o: translate.c gen-op.h opc.h cpu.h |
236 | 626df76a | bellard | |
237 | 1e43adfc | bellard | translate-all.o: translate-all.c op.h opc.h cpu.h |
238 | 626df76a | bellard | |
239 | 1e43adfc | bellard | op.h: op.o $(DYNGEN) |
240 | 626df76a | bellard | $(DYNGEN) -o $@ $< |
241 | 626df76a | bellard | |
242 | 1e43adfc | bellard | opc.h: op.o $(DYNGEN) |
243 | 626df76a | bellard | $(DYNGEN) -c -o $@ $< |
244 | 626df76a | bellard | |
245 | 1e43adfc | bellard | gen-op.h: op.o $(DYNGEN) |
246 | 626df76a | bellard | $(DYNGEN) -g -o $@ $< |
247 | 626df76a | bellard | |
248 | 1e43adfc | bellard | op.o: op.c |
249 | 626df76a | bellard | $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< |
250 | 626df76a | bellard | |
251 | 1e43adfc | bellard | helper.o: helper.c |
252 | 626df76a | bellard | $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< |
253 | 626df76a | bellard | |
254 | 1e43adfc | bellard | ifeq ($(TARGET_ARCH), i386) |
255 | 1e43adfc | bellard | op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h |
256 | 1e43adfc | bellard | endif |
257 | 1e43adfc | bellard | |
258 | 1e43adfc | bellard | ifeq ($(TARGET_ARCH), arm) |
259 | 1e43adfc | bellard | op.o: op.c op_template.h |
260 | 1e43adfc | bellard | endif |
261 | 626df76a | bellard | |
262 | 1e43adfc | bellard | ifeq ($(TARGET_ARCH), sparc) |
263 | 1e43adfc | bellard | op.o: op.c op_template.h |
264 | 1e43adfc | bellard | endif |
265 | 626df76a | bellard | |
266 | 728c9fd5 | bellard | ifeq ($(TARGET_ARCH), ppc) |
267 | 728c9fd5 | bellard | op.o: op.c op_template.h op_mem.h |
268 | 728c9fd5 | bellard | op_helper.o: op_helper_mem.h |
269 | 728c9fd5 | bellard | endif |
270 | 728c9fd5 | bellard | |
271 | 626df76a | bellard | %.o: %.c |
272 | 626df76a | bellard | $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< |
273 | 626df76a | bellard | |
274 | 626df76a | bellard | clean: |
275 | 1e43adfc | bellard | rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h |
276 | 1e43adfc | bellard | |
277 | 1e43adfc | bellard | install: all |
278 | 1e43adfc | bellard | install -m 755 -s $(PROGS) $(prefix)/bin |
279 | 626df76a | bellard | |
280 | 626df76a | bellard | ifneq ($(wildcard .depend),) |
281 | 626df76a | bellard | include .depend |
282 | 626df76a | bellard | endif |