bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 1 | include config.mak |
| 2 | |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 3 | TARGET_BASE_ARCH:=$(TARGET_ARCH) |
| 4 | ifeq ($(TARGET_ARCH), x86_64) |
| 5 | TARGET_BASE_ARCH:=i386 |
| 6 | endif |
bellard | 64b3ab2 | 2005-01-30 22:43:42 +0000 | [diff] [blame] | 7 | ifeq ($(TARGET_ARCH), sparc64) |
| 8 | TARGET_BASE_ARCH:=sparc |
| 9 | endif |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 10 | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 11 | VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio |
bellard | 3035f7f | 2004-03-21 17:02:00 +0000 | [diff] [blame] | 12 | DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH) |
| 13 | ifdef CONFIG_USER_ONLY |
| 14 | VPATH+=:$(SRC_PATH)/linux-user |
| 15 | DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) |
| 16 | endif |
bellard | ab2572d | 2004-06-03 19:07:57 +0000 | [diff] [blame] | 17 | CFLAGS=-Wall -O2 -g -fno-strict-aliasing |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 18 | #CFLAGS+=-Werror |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 19 | LDFLAGS=-g |
| 20 | LIBS= |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 21 | HELPER_CFLAGS=$(CFLAGS) |
bellard | 67b915a | 2004-03-31 23:37:16 +0000 | [diff] [blame] | 22 | DYNGEN=../dyngen$(EXESUF) |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 23 | # user emulator name |
bellard | 808c495 | 2004-12-19 23:33:47 +0000 | [diff] [blame] | 24 | ifeq ($(TARGET_ARCH),arm) |
| 25 | ifeq ($(TARGET_WORDS_BIGENDIAN),yes) |
| 26 | QEMU_USER=qemu-armeb |
| 27 | else |
| 28 | QEMU_USER=qemu-arm |
| 29 | endif |
| 30 | else |
| 31 | QEMU_USER=qemu-$(TARGET_ARCH) |
| 32 | endif |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 33 | # system emulator name |
| 34 | ifdef CONFIG_SOFTMMU |
bellard | a541f29 | 2004-04-12 20:39:29 +0000 | [diff] [blame] | 35 | ifeq ($(TARGET_ARCH), i386) |
bellard | 67b915a | 2004-03-31 23:37:16 +0000 | [diff] [blame] | 36 | QEMU_SYSTEM=qemu$(EXESUF) |
bellard | 0db6347 | 2003-10-27 21:37:46 +0000 | [diff] [blame] | 37 | else |
bellard | a541f29 | 2004-04-12 20:39:29 +0000 | [diff] [blame] | 38 | QEMU_SYSTEM=qemu-system-$(TARGET_ARCH)$(EXESUF) |
| 39 | endif |
| 40 | else |
bellard | 0db6347 | 2003-10-27 21:37:46 +0000 | [diff] [blame] | 41 | QEMU_SYSTEM=qemu-fast |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 42 | endif |
| 43 | |
bellard | 16e9b7d | 2003-10-27 21:09:52 +0000 | [diff] [blame] | 44 | ifdef CONFIG_USER_ONLY |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 45 | PROGS=$(QEMU_USER) |
bellard | 16e9b7d | 2003-10-27 21:09:52 +0000 | [diff] [blame] | 46 | else |
bellard | 16e9b7d | 2003-10-27 21:09:52 +0000 | [diff] [blame] | 47 | ifeq ($(TARGET_ARCH), i386) |
bellard | c321f67 | 2003-10-30 01:18:42 +0000 | [diff] [blame] | 48 | |
| 49 | ifeq ($(ARCH), i386) |
bellard | 16e9b7d | 2003-10-27 21:09:52 +0000 | [diff] [blame] | 50 | PROGS+=$(QEMU_SYSTEM) |
bellard | de5eaa6 | 2003-11-16 23:18:17 +0000 | [diff] [blame] | 51 | ifndef CONFIG_SOFTMMU |
| 52 | CONFIG_STATIC=y |
| 53 | endif |
bellard | 38ca2ab | 2004-03-13 18:32:13 +0000 | [diff] [blame] | 54 | else |
| 55 | # the system emulator using soft mmu is portable |
bellard | c321f67 | 2003-10-30 01:18:42 +0000 | [diff] [blame] | 56 | ifdef CONFIG_SOFTMMU |
| 57 | PROGS+=$(QEMU_SYSTEM) |
| 58 | endif |
bellard | 38ca2ab | 2004-03-13 18:32:13 +0000 | [diff] [blame] | 59 | endif # ARCH != i386 |
bellard | c321f67 | 2003-10-30 01:18:42 +0000 | [diff] [blame] | 60 | |
bellard | 38ca2ab | 2004-03-13 18:32:13 +0000 | [diff] [blame] | 61 | endif # TARGET_ARCH = i386 |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 62 | |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 63 | ifeq ($(TARGET_ARCH), x86_64) |
| 64 | ifdef CONFIG_SOFTMMU |
| 65 | PROGS+=$(QEMU_SYSTEM) |
| 66 | endif |
| 67 | endif # TARGET_ARCH = x86_64 |
| 68 | |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 69 | ifeq ($(TARGET_ARCH), ppc) |
| 70 | |
| 71 | ifeq ($(ARCH), ppc) |
| 72 | PROGS+=$(QEMU_SYSTEM) |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 73 | endif |
| 74 | |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 75 | ifeq ($(ARCH), i386) |
| 76 | ifdef CONFIG_SOFTMMU |
| 77 | PROGS+=$(QEMU_SYSTEM) |
| 78 | endif |
| 79 | endif # ARCH = i386 |
| 80 | |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 81 | ifeq ($(ARCH), x86_64) |
bellard | 75dfaa1 | 2004-04-25 19:04:19 +0000 | [diff] [blame] | 82 | ifdef CONFIG_SOFTMMU |
| 83 | PROGS+=$(QEMU_SYSTEM) |
| 84 | endif |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 85 | endif # ARCH = x86_64 |
bellard | 75dfaa1 | 2004-04-25 19:04:19 +0000 | [diff] [blame] | 86 | |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 87 | endif # TARGET_ARCH = ppc |
bellard | e95c8d5 | 2004-09-30 22:22:08 +0000 | [diff] [blame] | 88 | |
| 89 | ifeq ($(TARGET_ARCH), sparc) |
| 90 | |
| 91 | ifeq ($(ARCH), ppc) |
| 92 | PROGS+=$(QEMU_SYSTEM) |
| 93 | endif |
| 94 | |
| 95 | ifeq ($(ARCH), i386) |
| 96 | ifdef CONFIG_SOFTMMU |
| 97 | PROGS+=$(QEMU_SYSTEM) |
| 98 | endif |
| 99 | endif # ARCH = i386 |
| 100 | |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 101 | ifeq ($(ARCH), x86_64) |
bellard | e95c8d5 | 2004-09-30 22:22:08 +0000 | [diff] [blame] | 102 | ifdef CONFIG_SOFTMMU |
| 103 | PROGS+=$(QEMU_SYSTEM) |
| 104 | endif |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 105 | endif # ARCH = x86_64 |
bellard | e95c8d5 | 2004-09-30 22:22:08 +0000 | [diff] [blame] | 106 | |
| 107 | endif # TARGET_ARCH = sparc |
bellard | 64b3ab2 | 2005-01-30 22:43:42 +0000 | [diff] [blame] | 108 | |
| 109 | ifeq ($(TARGET_ARCH), sparc64) |
| 110 | ifdef CONFIG_SOFTMMU |
| 111 | PROGS+=$(QEMU_SYSTEM) |
| 112 | endif |
| 113 | endif # TARGET_ARCH = sparc64 |
| 114 | |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 115 | endif # !CONFIG_USER_ONLY |
| 116 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 117 | ifdef CONFIG_STATIC |
| 118 | LDFLAGS+=-static |
| 119 | endif |
| 120 | |
| 121 | ifeq ($(ARCH),i386) |
| 122 | CFLAGS+=-fomit-frame-pointer |
| 123 | OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2 |
| 124 | ifeq ($(HAVE_GCC3_OPTIONS),yes) |
bellard | 3611a29 | 2004-08-03 21:42:45 +0000 | [diff] [blame] | 125 | OP_CFLAGS+= -falign-functions=0 -fno-gcse |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 126 | else |
| 127 | OP_CFLAGS+= -malign-functions=0 |
| 128 | endif |
bellard | 3a4739d | 2003-10-28 00:48:22 +0000 | [diff] [blame] | 129 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 130 | ifdef TARGET_GPROF |
bellard | 3a4739d | 2003-10-28 00:48:22 +0000 | [diff] [blame] | 131 | USE_I386_LD=y |
| 132 | endif |
| 133 | ifdef CONFIG_STATIC |
| 134 | USE_I386_LD=y |
| 135 | endif |
| 136 | ifdef USE_I386_LD |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 137 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld |
| 138 | else |
| 139 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object |
| 140 | # that the kernel ELF loader considers as an executable. I think this |
| 141 | # is the simplest way to make it self virtualizable! |
| 142 | LDFLAGS+=-Wl,-shared |
| 143 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 144 | endif |
| 145 | |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 146 | ifeq ($(ARCH),x86_64) |
bellard | bc51c5c | 2004-03-17 23:46:04 +0000 | [diff] [blame] | 147 | OP_CFLAGS=$(CFLAGS) -falign-functions=0 |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 148 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld |
bellard | bc51c5c | 2004-03-17 23:46:04 +0000 | [diff] [blame] | 149 | endif |
| 150 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 151 | ifeq ($(ARCH),ppc) |
bellard | 83fb7ad | 2004-07-05 21:25:26 +0000 | [diff] [blame] | 152 | CFLAGS+= -D__powerpc__ |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 153 | OP_CFLAGS=$(CFLAGS) |
| 154 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld |
| 155 | endif |
| 156 | |
| 157 | ifeq ($(ARCH),s390) |
| 158 | OP_CFLAGS=$(CFLAGS) |
| 159 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld |
| 160 | endif |
| 161 | |
| 162 | ifeq ($(ARCH),sparc) |
| 163 | CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 |
| 164 | LDFLAGS+=-m32 |
| 165 | OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 |
| 166 | HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat |
| 167 | # -static is used to avoid g1/g3 usage by the dynamic linker |
| 168 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static |
| 169 | endif |
| 170 | |
| 171 | ifeq ($(ARCH),sparc64) |
| 172 | CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 |
| 173 | LDFLAGS+=-m64 |
| 174 | OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 |
| 175 | endif |
| 176 | |
| 177 | ifeq ($(ARCH),alpha) |
| 178 | # -msmall-data is not used because we want two-instruction relocations |
| 179 | # for the constant constructions |
| 180 | OP_CFLAGS=-Wall -O2 -g |
| 181 | # Ensure there's only a single GP |
| 182 | CFLAGS += -msmall-data |
| 183 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld |
| 184 | endif |
| 185 | |
| 186 | ifeq ($(ARCH),ia64) |
| 187 | OP_CFLAGS=$(CFLAGS) |
| 188 | endif |
| 189 | |
| 190 | ifeq ($(ARCH),arm) |
bellard | ba68055 | 2005-03-13 09:49:52 +0000 | [diff] [blame^] | 191 | OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 192 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld |
| 193 | endif |
| 194 | |
bellard | 38e584a | 2003-08-10 22:14:22 +0000 | [diff] [blame] | 195 | ifeq ($(ARCH),m68k) |
| 196 | OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer |
| 197 | LDFLAGS+=-Wl,-T,m68k.ld |
| 198 | endif |
| 199 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 200 | ifeq ($(HAVE_GCC3_OPTIONS),yes) |
| 201 | # very important to generate a return at the end of every operation |
| 202 | OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls |
| 203 | endif |
| 204 | |
bellard | 83fb7ad | 2004-07-05 21:25:26 +0000 | [diff] [blame] | 205 | ifeq ($(CONFIG_DARWIN),yes) |
| 206 | OP_CFLAGS+= -mdynamic-no-pic |
bellard | e80cfcf | 2004-12-19 23:18:01 +0000 | [diff] [blame] | 207 | LIBS+=-lmx |
bellard | 83fb7ad | 2004-07-05 21:25:26 +0000 | [diff] [blame] | 208 | endif |
| 209 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 210 | ######################################################### |
| 211 | |
bellard | d524939 | 2004-08-03 21:14:23 +0000 | [diff] [blame] | 212 | DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 213 | LIBS+=-lm |
bellard | b932cab | 2004-08-01 21:46:49 +0000 | [diff] [blame] | 214 | ifndef CONFIG_USER_ONLY |
| 215 | LIBS+=-lz |
| 216 | endif |
bellard | 67b915a | 2004-03-31 23:37:16 +0000 | [diff] [blame] | 217 | ifdef CONFIG_WIN32 |
bellard | 3db38e8 | 2004-07-14 17:19:55 +0000 | [diff] [blame] | 218 | LIBS+=-lwinmm -lws2_32 -liphlpapi |
bellard | 67b915a | 2004-03-31 23:37:16 +0000 | [diff] [blame] | 219 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 220 | |
| 221 | # profiling code |
| 222 | ifdef TARGET_GPROF |
| 223 | LDFLAGS+=-p |
| 224 | main.o: CFLAGS+=-p |
| 225 | endif |
| 226 | |
bellard | 3035f7f | 2004-03-21 17:02:00 +0000 | [diff] [blame] | 227 | OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 228 | ifeq ($(TARGET_ARCH), i386) |
| 229 | OBJS+= vm86.o |
| 230 | endif |
bellard | f72b519 | 2004-02-16 21:55:35 +0000 | [diff] [blame] | 231 | ifeq ($(TARGET_ARCH), arm) |
| 232 | OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ |
| 233 | nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ |
| 234 | nwfpe/double_cpdo.o nwfpe/extended_cpdo.o |
| 235 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 236 | SRCS:= $(OBJS:.o=.c) |
| 237 | OBJS+= libqemu.a |
| 238 | |
| 239 | # cpu emulator library |
bellard | e3086fb | 2005-02-10 21:48:51 +0000 | [diff] [blame] | 240 | LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ |
| 241 | translate.o op.o |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 242 | |
| 243 | ifeq ($(TARGET_ARCH), i386) |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 244 | LIBOBJS+=helper.o helper2.o |
bellard | f72b519 | 2004-02-16 21:55:35 +0000 | [diff] [blame] | 245 | ifeq ($(ARCH), i386) |
| 246 | LIBOBJS+=translate-copy.o |
| 247 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 248 | endif |
| 249 | |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 250 | ifeq ($(TARGET_ARCH), x86_64) |
| 251 | LIBOBJS+=helper.o helper2.o |
| 252 | endif |
| 253 | |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 254 | ifeq ($(TARGET_ARCH), ppc) |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 255 | LIBOBJS+= op_helper.o helper.o |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 256 | endif |
| 257 | |
bellard | 64b3ab2 | 2005-01-30 22:43:42 +0000 | [diff] [blame] | 258 | ifeq ($(TARGET_BASE_ARCH), sparc) |
bellard | e95c8d5 | 2004-09-30 22:22:08 +0000 | [diff] [blame] | 259 | LIBOBJS+= op_helper.o helper.o |
| 260 | endif |
| 261 | |
bellard | b7bcbe9 | 2005-02-22 19:27:29 +0000 | [diff] [blame] | 262 | ifeq ($(TARGET_BASE_ARCH), arm) |
| 263 | LIBOBJS+= op_helper.o |
| 264 | endif |
| 265 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 266 | # NOTE: the disassembler code is only needed for debugging |
| 267 | LIBOBJS+=disas.o |
| 268 | ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) |
bellard | bc51c5c | 2004-03-17 23:46:04 +0000 | [diff] [blame] | 269 | USE_I386_DIS=y |
| 270 | endif |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 271 | ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64) |
bellard | bc51c5c | 2004-03-17 23:46:04 +0000 | [diff] [blame] | 272 | USE_I386_DIS=y |
| 273 | endif |
| 274 | ifdef USE_I386_DIS |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 275 | LIBOBJS+=i386-dis.o |
| 276 | endif |
| 277 | ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) |
| 278 | LIBOBJS+=alpha-dis.o |
| 279 | endif |
| 280 | ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc) |
| 281 | LIBOBJS+=ppc-dis.o |
| 282 | endif |
bellard | 64b3ab2 | 2005-01-30 22:43:42 +0000 | [diff] [blame] | 283 | ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc) |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 284 | LIBOBJS+=sparc-dis.o |
| 285 | endif |
| 286 | ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) |
| 287 | LIBOBJS+=arm-dis.o |
| 288 | endif |
| 289 | |
| 290 | ifeq ($(ARCH),ia64) |
| 291 | OBJS += ia64-syscall.o |
| 292 | endif |
| 293 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 294 | all: $(PROGS) |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 295 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 296 | $(QEMU_USER): $(OBJS) |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 297 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
| 298 | ifeq ($(ARCH),alpha) |
| 299 | # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of |
| 300 | # the address space (31 bit so sign extending doesn't matter) |
| 301 | echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc |
| 302 | endif |
| 303 | |
| 304 | # must use static linking to avoid leaving stuff in virtual address space |
bellard | b932cab | 2004-08-01 21:46:49 +0000 | [diff] [blame] | 305 | VL_OBJS=vl.o osdep.o block.o readline.o monitor.o pci.o console.o |
bellard | 585d0ed | 2004-12-12 11:24:44 +0000 | [diff] [blame] | 306 | VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o |
bellard | a541f29 | 2004-04-12 20:39:29 +0000 | [diff] [blame] | 307 | |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 308 | SOUND_HW = sb16.o |
bellard | 7372f88 | 2004-11-11 16:55:09 +0000 | [diff] [blame] | 309 | AUDIODRV = audio.o noaudio.o wavaudio.o |
bellard | fb06518 | 2004-11-09 23:09:44 +0000 | [diff] [blame] | 310 | ifdef CONFIG_SDL |
| 311 | AUDIODRV += sdlaudio.o |
| 312 | endif |
| 313 | ifdef CONFIG_OSS |
| 314 | AUDIODRV += ossaudio.o |
| 315 | endif |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 316 | |
bellard | fb06518 | 2004-11-09 23:09:44 +0000 | [diff] [blame] | 317 | pc.o: DEFINES := -DUSE_SB16 $(DEFINES) |
| 318 | |
| 319 | ifdef CONFIG_ADLIB |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 320 | SOUND_HW += fmopl.o adlib.o |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 321 | endif |
| 322 | |
bellard | 102a52e | 2004-11-14 19:57:29 +0000 | [diff] [blame] | 323 | ifdef CONFIG_FMOD |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 324 | AUDIODRV += fmodaudio.o |
bellard | 102a52e | 2004-11-14 19:57:29 +0000 | [diff] [blame] | 325 | audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES) |
| 326 | LIBS += $(CONFIG_FMOD_LIB) |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 327 | endif |
| 328 | |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 329 | ifeq ($(TARGET_BASE_ARCH), i386) |
bellard | a541f29 | 2004-04-12 20:39:29 +0000 | [diff] [blame] | 330 | # Hardware support |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 331 | VL_OBJS+= ide.o ne2000.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) |
| 332 | VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o |
bellard | 6508fe5 | 2005-01-15 12:02:56 +0000 | [diff] [blame] | 333 | VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o |
bellard | 67b915a | 2004-03-31 23:37:16 +0000 | [diff] [blame] | 334 | endif |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 335 | ifeq ($(TARGET_ARCH), ppc) |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 336 | VL_OBJS+= ppc.o ide.o ne2000.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) |
bellard | 6420120 | 2004-05-26 22:55:16 +0000 | [diff] [blame] | 337 | VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 338 | VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o mixeng.o |
bellard | a541f29 | 2004-04-12 20:39:29 +0000 | [diff] [blame] | 339 | endif |
bellard | 64b3ab2 | 2005-01-30 22:43:42 +0000 | [diff] [blame] | 340 | ifeq ($(TARGET_BASE_ARCH), sparc) |
bellard | 6f7e9ae | 2005-03-13 09:43:36 +0000 | [diff] [blame] | 341 | VL_OBJS+= sun4m.o tcx.o lance.o iommu.o m48t08.o magic-load.o slavio_intctl.o slavio_timer.o slavio_serial.o fdc.o esp.o |
bellard | e95c8d5 | 2004-09-30 22:22:08 +0000 | [diff] [blame] | 342 | endif |
bellard | a541f29 | 2004-04-12 20:39:29 +0000 | [diff] [blame] | 343 | ifdef CONFIG_GDBSTUB |
| 344 | VL_OBJS+=gdbstub.o |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 345 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 346 | ifdef CONFIG_SDL |
| 347 | VL_OBJS+=sdl.o |
bellard | de5eaa6 | 2003-11-16 23:18:17 +0000 | [diff] [blame] | 348 | endif |
bellard | 5b0753e | 2005-03-01 21:37:28 +0000 | [diff] [blame] | 349 | ifdef CONFIG_COCOA |
| 350 | VL_OBJS+=cocoa.o |
| 351 | COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa |
| 352 | endif |
bellard | 7c1f25b | 2004-04-22 00:02:08 +0000 | [diff] [blame] | 353 | ifdef CONFIG_SLIRP |
| 354 | DEFINES+=-I$(SRC_PATH)/slirp |
| 355 | SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ |
| 356 | slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ |
bellard | c7f7464 | 2004-08-24 21:57:12 +0000 | [diff] [blame] | 357 | tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o |
bellard | 7c1f25b | 2004-04-22 00:02:08 +0000 | [diff] [blame] | 358 | VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 359 | endif |
| 360 | |
bellard | c321f67 | 2003-10-30 01:18:42 +0000 | [diff] [blame] | 361 | VL_LDFLAGS= |
| 362 | # specific flags are needed for non soft mmu emulator |
bellard | c321f67 | 2003-10-30 01:18:42 +0000 | [diff] [blame] | 363 | ifdef CONFIG_STATIC |
| 364 | VL_LDFLAGS+=-static |
| 365 | endif |
bellard | de5eaa6 | 2003-11-16 23:18:17 +0000 | [diff] [blame] | 366 | ifndef CONFIG_SOFTMMU |
| 367 | VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld |
| 368 | endif |
bellard | 83fb7ad | 2004-07-05 21:25:26 +0000 | [diff] [blame] | 369 | ifndef CONFIG_DARWIN |
bellard | 11d9f69 | 2004-04-02 20:55:59 +0000 | [diff] [blame] | 370 | ifndef CONFIG_WIN32 |
| 371 | VL_LIBS=-lutil |
| 372 | endif |
bellard | 83fb7ad | 2004-07-05 21:25:26 +0000 | [diff] [blame] | 373 | endif |
bellard | e3086fb | 2005-02-10 21:48:51 +0000 | [diff] [blame] | 374 | ifdef TARGET_GPROF |
| 375 | vl.o: CFLAGS+=-p |
| 376 | VL_LDFLAGS+=-p |
| 377 | endif |
bellard | c321f67 | 2003-10-30 01:18:42 +0000 | [diff] [blame] | 378 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 379 | $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a |
bellard | 5b0753e | 2005-03-01 21:37:28 +0000 | [diff] [blame] | 380 | $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) |
| 381 | |
| 382 | cocoa.o: cocoa.m |
| 383 | $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 384 | |
bellard | 3d11d0e | 2004-12-12 16:56:30 +0000 | [diff] [blame] | 385 | sdl.o: sdl.c keymaps.c sdl_keysym.h |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 386 | $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< |
| 387 | |
bellard | 9f059ec | 2004-11-14 18:59:52 +0000 | [diff] [blame] | 388 | sdlaudio.o: sdlaudio.c |
| 389 | $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< |
| 390 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 391 | depend: $(SRCS) |
bellard | 16e9b7d | 2003-10-27 21:09:52 +0000 | [diff] [blame] | 392 | $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 393 | |
| 394 | # libqemu |
| 395 | |
| 396 | libqemu.a: $(LIBOBJS) |
| 397 | rm -f $@ |
| 398 | $(AR) rcs $@ $(LIBOBJS) |
| 399 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 400 | translate.o: translate.c gen-op.h opc.h cpu.h |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 401 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 402 | translate-all.o: translate-all.c op.h opc.h cpu.h |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 403 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 404 | op.h: op.o $(DYNGEN) |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 405 | $(DYNGEN) -o $@ $< |
| 406 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 407 | opc.h: op.o $(DYNGEN) |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 408 | $(DYNGEN) -c -o $@ $< |
| 409 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 410 | gen-op.h: op.o $(DYNGEN) |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 411 | $(DYNGEN) -g -o $@ $< |
| 412 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 413 | op.o: op.c |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 414 | $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< |
| 415 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 416 | helper.o: helper.c |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 417 | $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< |
| 418 | |
bellard | 0b0babc | 2005-01-03 23:38:40 +0000 | [diff] [blame] | 419 | ifeq ($(TARGET_BASE_ARCH), i386) |
bellard | 664e0f1 | 2005-01-08 18:58:29 +0000 | [diff] [blame] | 420 | op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 421 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 422 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 423 | ifeq ($(TARGET_ARCH), arm) |
| 424 | op.o: op.c op_template.h |
| 425 | endif |
| 426 | |
bellard | 64b3ab2 | 2005-01-30 22:43:42 +0000 | [diff] [blame] | 427 | ifeq ($(TARGET_BASE_ARCH), sparc) |
bellard | e95c8d5 | 2004-09-30 22:22:08 +0000 | [diff] [blame] | 428 | op.o: op.c op_template.h op_mem.h |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 429 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 430 | |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 431 | ifeq ($(TARGET_ARCH), ppc) |
| 432 | op.o: op.c op_template.h op_mem.h |
| 433 | op_helper.o: op_helper_mem.h |
| 434 | endif |
| 435 | |
bellard | 85571bc | 2004-11-07 18:04:02 +0000 | [diff] [blame] | 436 | mixeng.o: mixeng.c mixeng.h mixeng_template.h |
| 437 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 438 | %.o: %.c |
| 439 | $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< |
| 440 | |
bellard | f72b519 | 2004-02-16 21:55:35 +0000 | [diff] [blame] | 441 | %.o: %.S |
| 442 | $(CC) $(DEFINES) -c -o $@ $< |
| 443 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 444 | clean: |
bellard | 7c1f25b | 2004-04-22 00:02:08 +0000 | [diff] [blame] | 445 | rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 446 | |
| 447 | install: all |
bellard | 9b14bb0 | 2004-03-26 22:43:34 +0000 | [diff] [blame] | 448 | ifneq ($(PROGS),) |
bellard | 11d9f69 | 2004-04-02 20:55:59 +0000 | [diff] [blame] | 449 | install -m 755 -s $(PROGS) "$(bindir)" |
bellard | 9b14bb0 | 2004-03-26 22:43:34 +0000 | [diff] [blame] | 450 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 451 | |
| 452 | ifneq ($(wildcard .depend),) |
| 453 | include .depend |
| 454 | endif |