Commit 40293e580daecf40309b9df2f48ba9b62b4bdef9
1 parent
111f061b
Makefile cleanup - more generic support of 32 bit compilation on x86_64
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3937 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
307 additions
and
315 deletions
Makefile
| @@ -7,17 +7,14 @@ include config-host.mak | @@ -7,17 +7,14 @@ include config-host.mak | ||
| 7 | 7 | ||
| 8 | VPATH=$(SRC_PATH):$(SRC_PATH)/hw | 8 | VPATH=$(SRC_PATH):$(SRC_PATH)/hw |
| 9 | 9 | ||
| 10 | -BASE_CFLAGS= | ||
| 11 | -BASE_LDFLAGS= | ||
| 12 | - | ||
| 13 | -BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) | ||
| 14 | -BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) | 10 | +CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) |
| 11 | +LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) | ||
| 15 | 12 | ||
| 16 | CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP | 13 | CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP |
| 17 | CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE | 14 | CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
| 18 | LIBS= | 15 | LIBS= |
| 19 | ifdef CONFIG_STATIC | 16 | ifdef CONFIG_STATIC |
| 20 | -BASE_LDFLAGS += -static | 17 | +LDFLAGS += -static |
| 21 | endif | 18 | endif |
| 22 | ifdef BUILD_DOCS | 19 | ifdef BUILD_DOCS |
| 23 | DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 | 20 | DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 |
| @@ -117,16 +114,16 @@ OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) | @@ -117,16 +114,16 @@ OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) | ||
| 117 | endif | 114 | endif |
| 118 | 115 | ||
| 119 | cocoa.o: cocoa.m | 116 | cocoa.o: cocoa.m |
| 120 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | 117 | + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< |
| 121 | 118 | ||
| 122 | sdl.o: sdl.c keymaps.c sdl_keysym.h | 119 | sdl.o: sdl.c keymaps.c sdl_keysym.h |
| 123 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< | 120 | + $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< |
| 124 | 121 | ||
| 125 | vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h | 122 | vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h |
| 126 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $< | 123 | + $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $< |
| 127 | 124 | ||
| 128 | audio/sdlaudio.o: audio/sdlaudio.c | 125 | audio/sdlaudio.o: audio/sdlaudio.c |
| 129 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< | 126 | + $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< |
| 130 | 127 | ||
| 131 | libqemu_common.a: $(OBJS) | 128 | libqemu_common.a: $(OBJS) |
| 132 | rm -f $@ | 129 | rm -f $@ |
| @@ -142,17 +139,17 @@ endif | @@ -142,17 +139,17 @@ endif | ||
| 142 | ###################################################################### | 139 | ###################################################################### |
| 143 | 140 | ||
| 144 | qemu-img$(EXESUF): qemu-img.o qemu-img-block.o $(QEMU_IMG_BLOCK_OBJS) | 141 | qemu-img$(EXESUF): qemu-img.o qemu-img-block.o $(QEMU_IMG_BLOCK_OBJS) |
| 145 | - $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) | 142 | + $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) |
| 146 | 143 | ||
| 147 | qemu-img-%.o: %.c | 144 | qemu-img-%.o: %.c |
| 148 | - $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $< | 145 | + $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG -c -o $@ $< |
| 149 | 146 | ||
| 150 | %.o: %.c | 147 | %.o: %.c |
| 151 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | 148 | + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< |
| 152 | 149 | ||
| 153 | # dyngen host tool | 150 | # dyngen host tool |
| 154 | dyngen$(EXESUF): dyngen.c | 151 | dyngen$(EXESUF): dyngen.c |
| 155 | - $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ | 152 | + $(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ |
| 156 | 153 | ||
| 157 | clean: | 154 | clean: |
| 158 | # avoid old build problems by removing potentially incorrect old files | 155 | # avoid old build problems by removing potentially incorrect old files |
| @@ -300,9 +297,5 @@ tarbin: | @@ -300,9 +297,5 @@ tarbin: | ||
| 300 | $(docdir)/qemu-tech.html \ | 297 | $(docdir)/qemu-tech.html \ |
| 301 | $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) | 298 | $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) |
| 302 | 299 | ||
| 303 | -ifneq ($(wildcard .depend),) | ||
| 304 | -include .depend | ||
| 305 | -endif | ||
| 306 | - | ||
| 307 | # Include automatically generated dependency files | 300 | # Include automatically generated dependency files |
| 308 | -include $(wildcard *.d audio/*.d slirp/*.d) | 301 | -include $(wildcard *.d audio/*.d slirp/*.d) |
Makefile.target
| @@ -25,22 +25,8 @@ endif | @@ -25,22 +25,8 @@ endif | ||
| 25 | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) | 25 | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) |
| 26 | VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw | 26 | VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw |
| 27 | CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MP -DNEED_CPU_H | 27 | CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MP -DNEED_CPU_H |
| 28 | -ifdef CONFIG_DARWIN_USER | ||
| 29 | -VPATH+=:$(SRC_PATH)/darwin-user | ||
| 30 | -CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) | ||
| 31 | -endif | ||
| 32 | -ifdef CONFIG_LINUX_USER | ||
| 33 | -VPATH+=:$(SRC_PATH)/linux-user | ||
| 34 | -ifndef TARGET_ABI_DIR | ||
| 35 | - TARGET_ABI_DIR=$(TARGET_ARCH) | ||
| 36 | -endif | ||
| 37 | -CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) | ||
| 38 | -endif | ||
| 39 | -BASE_CFLAGS= | ||
| 40 | -BASE_LDFLAGS= | ||
| 41 | #CFLAGS+=-Werror | 28 | #CFLAGS+=-Werror |
| 42 | LIBS= | 29 | LIBS= |
| 43 | -HELPER_CFLAGS=$(CFLAGS) | ||
| 44 | DYNGEN=../dyngen$(EXESUF) | 30 | DYNGEN=../dyngen$(EXESUF) |
| 45 | # user emulator name | 31 | # user emulator name |
| 46 | ifndef TARGET_ARCH2 | 32 | ifndef TARGET_ARCH2 |
| @@ -71,30 +57,20 @@ ifeq ($(TARGET_ARCH),mips64) | @@ -71,30 +57,20 @@ ifeq ($(TARGET_ARCH),mips64) | ||
| 71 | TARGET_ARCH2=mips64el | 57 | TARGET_ARCH2=mips64el |
| 72 | endif | 58 | endif |
| 73 | endif | 59 | endif |
| 74 | -QEMU_USER=qemu-$(TARGET_ARCH2) | 60 | + |
| 61 | +ifdef CONFIG_USER_ONLY | ||
| 62 | +# user emulator name | ||
| 63 | +QEMU_PROG=qemu-$(TARGET_ARCH2) | ||
| 64 | +else | ||
| 75 | # system emulator name | 65 | # system emulator name |
| 76 | -ifdef CONFIG_SOFTMMU | ||
| 77 | ifeq ($(TARGET_ARCH), i386) | 66 | ifeq ($(TARGET_ARCH), i386) |
| 78 | -QEMU_SYSTEM=qemu$(EXESUF) | 67 | +QEMU_PROG=qemu$(EXESUF) |
| 79 | else | 68 | else |
| 80 | -QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF) | 69 | +QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF) |
| 81 | endif | 70 | endif |
| 82 | -else | ||
| 83 | -QEMU_SYSTEM=qemu-fast | ||
| 84 | -endif | ||
| 85 | - | ||
| 86 | -ifdef CONFIG_USER_ONLY | ||
| 87 | -PROGS=$(QEMU_USER) | ||
| 88 | -else | ||
| 89 | -PROGS+=$(QEMU_SYSTEM) | ||
| 90 | -ifndef CONFIG_SOFTMMU | ||
| 91 | -CONFIG_STATIC=y | ||
| 92 | endif | 71 | endif |
| 93 | -endif # !CONFIG_USER_ONLY | ||
| 94 | 72 | ||
| 95 | -ifdef CONFIG_STATIC | ||
| 96 | -BASE_LDFLAGS+=-static | ||
| 97 | -endif | 73 | +PROGS=$(QEMU_PROG) |
| 98 | 74 | ||
| 99 | # We require -O2 to avoid the stack setup prologue in EXIT_TB | 75 | # We require -O2 to avoid the stack setup prologue in EXIT_TB |
| 100 | OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing | 76 | OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing |
| @@ -115,60 +91,32 @@ OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "") | @@ -115,60 +91,32 @@ OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "") | ||
| 115 | OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, "")) | 91 | OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, "")) |
| 116 | OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "") | 92 | OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "") |
| 117 | 93 | ||
| 94 | +HELPER_CFLAGS= | ||
| 95 | + | ||
| 118 | ifeq ($(ARCH),i386) | 96 | ifeq ($(ARCH),i386) |
| 119 | HELPER_CFLAGS+=-fomit-frame-pointer | 97 | HELPER_CFLAGS+=-fomit-frame-pointer |
| 120 | OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer | 98 | OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer |
| 121 | -ifdef TARGET_GPROF | ||
| 122 | -USE_I386_LD=y | ||
| 123 | -endif | ||
| 124 | -ifdef CONFIG_STATIC | ||
| 125 | -USE_I386_LD=y | ||
| 126 | -endif | ||
| 127 | -ifdef USE_I386_LD | ||
| 128 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 129 | -else | ||
| 130 | -ifdef CONFIG_LINUX_USER | ||
| 131 | -# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object | ||
| 132 | -# that the kernel ELF loader considers as an executable. I think this | ||
| 133 | -# is the simplest way to make it self virtualizable! | ||
| 134 | -BASE_LDFLAGS+=-Wl,-shared | ||
| 135 | -endif | ||
| 136 | -endif | ||
| 137 | -endif | ||
| 138 | - | ||
| 139 | -ifeq ($(ARCH),x86_64) | ||
| 140 | - ifneq ($(CONFIG_SOLARIS),yes) | ||
| 141 | - BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 142 | - endif | ||
| 143 | endif | 99 | endif |
| 144 | 100 | ||
| 145 | ifeq ($(ARCH),ppc) | 101 | ifeq ($(ARCH),ppc) |
| 146 | CPPFLAGS+= -D__powerpc__ | 102 | CPPFLAGS+= -D__powerpc__ |
| 147 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 148 | -endif | ||
| 149 | - | ||
| 150 | -ifeq ($(ARCH),s390) | ||
| 151 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 152 | endif | 103 | endif |
| 153 | 104 | ||
| 154 | ifeq ($(ARCH),sparc) | 105 | ifeq ($(ARCH),sparc) |
| 155 | - BASE_CFLAGS+=-ffixed-g2 -ffixed-g3 | 106 | + CFLAGS+=-ffixed-g2 -ffixed-g3 |
| 156 | OP_CFLAGS+=-fno-delayed-branch -ffixed-i0 | 107 | OP_CFLAGS+=-fno-delayed-branch -ffixed-i0 |
| 157 | ifeq ($(CONFIG_SOLARIS),yes) | 108 | ifeq ($(CONFIG_SOLARIS),yes) |
| 158 | OP_CFLAGS+=-fno-omit-frame-pointer | 109 | OP_CFLAGS+=-fno-omit-frame-pointer |
| 159 | else | 110 | else |
| 160 | - BASE_CFLAGS+=-ffixed-g1 -ffixed-g6 | ||
| 161 | - HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 | ||
| 162 | - # -static is used to avoid g1/g3 usage by the dynamic linker | ||
| 163 | - BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static | 111 | + CFLAGS+=-ffixed-g1 -ffixed-g6 |
| 112 | + HELPER_CFLAGS+=-ffixed-i0 | ||
| 164 | endif | 113 | endif |
| 165 | endif | 114 | endif |
| 166 | 115 | ||
| 167 | ifeq ($(ARCH),sparc64) | 116 | ifeq ($(ARCH),sparc64) |
| 168 | - BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 | 117 | + CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 |
| 169 | OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0 | 118 | OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0 |
| 170 | ifneq ($(CONFIG_SOLARIS),yes) | 119 | ifneq ($(CONFIG_SOLARIS),yes) |
| 171 | - BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 172 | OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 | 120 | OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 |
| 173 | endif | 121 | endif |
| 174 | endif | 122 | endif |
| @@ -177,65 +125,36 @@ ifeq ($(ARCH),alpha) | @@ -177,65 +125,36 @@ ifeq ($(ARCH),alpha) | ||
| 177 | # -msmall-data is not used for OP_CFLAGS because we want two-instruction | 125 | # -msmall-data is not used for OP_CFLAGS because we want two-instruction |
| 178 | # relocations for the constant constructions | 126 | # relocations for the constant constructions |
| 179 | # Ensure there's only a single GP | 127 | # Ensure there's only a single GP |
| 180 | -BASE_CFLAGS+=-msmall-data | ||
| 181 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | 128 | +CFLAGS+=-msmall-data |
| 182 | endif | 129 | endif |
| 183 | 130 | ||
| 184 | ifeq ($(ARCH),ia64) | 131 | ifeq ($(ARCH),ia64) |
| 185 | -BASE_CFLAGS+=-mno-sdata | 132 | +CFLAGS+=-mno-sdata |
| 186 | OP_CFLAGS+=-mno-sdata | 133 | OP_CFLAGS+=-mno-sdata |
| 187 | -BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 188 | endif | 134 | endif |
| 189 | 135 | ||
| 190 | ifeq ($(ARCH),arm) | 136 | ifeq ($(ARCH),arm) |
| 191 | OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer | 137 | OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer |
| 192 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 193 | endif | 138 | endif |
| 194 | 139 | ||
| 195 | ifeq ($(ARCH),m68k) | 140 | ifeq ($(ARCH),m68k) |
| 196 | OP_CFLAGS+=-fomit-frame-pointer | 141 | OP_CFLAGS+=-fomit-frame-pointer |
| 197 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 198 | endif | 142 | endif |
| 199 | 143 | ||
| 200 | ifeq ($(ARCH),mips) | 144 | ifeq ($(ARCH),mips) |
| 201 | OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0 | 145 | OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0 |
| 202 | -ifeq ($(WORDS_BIGENDIAN),yes) | ||
| 203 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 204 | -else | ||
| 205 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | ||
| 206 | -endif | ||
| 207 | endif | 146 | endif |
| 208 | 147 | ||
| 209 | ifeq ($(ARCH),mips64) | 148 | ifeq ($(ARCH),mips64) |
| 210 | OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0 | 149 | OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0 |
| 211 | -ifeq ($(WORDS_BIGENDIAN),yes) | ||
| 212 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 213 | -else | ||
| 214 | -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | ||
| 215 | -endif | ||
| 216 | -endif | ||
| 217 | - | ||
| 218 | -ifeq ($(CONFIG_DARWIN),yes) | ||
| 219 | -LIBS+=-lmx | ||
| 220 | endif | 150 | endif |
| 221 | 151 | ||
| 222 | -ifdef CONFIG_DARWIN_USER | ||
| 223 | -# Leave some space for the regular program loading zone | ||
| 224 | -BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 | ||
| 225 | -endif | ||
| 226 | - | ||
| 227 | -BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) | ||
| 228 | -BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) | 152 | +CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) |
| 153 | +LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) | ||
| 229 | OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) | 154 | OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) |
| 230 | -OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) | ||
| 231 | - | ||
| 232 | -######################################################### | ||
| 233 | 155 | ||
| 234 | CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE | 156 | CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
| 235 | LIBS+=-lm | 157 | LIBS+=-lm |
| 236 | -ifndef CONFIG_USER_ONLY | ||
| 237 | -LIBS+=-lz | ||
| 238 | -endif | ||
| 239 | ifdef CONFIG_WIN32 | 158 | ifdef CONFIG_WIN32 |
| 240 | LIBS+=-lwinmm -lws2_32 -liphlpapi | 159 | LIBS+=-lwinmm -lws2_32 -liphlpapi |
| 241 | endif | 160 | endif |
| @@ -245,48 +164,13 @@ ifdef NEEDS_LIBSUNMATH | @@ -245,48 +164,13 @@ ifdef NEEDS_LIBSUNMATH | ||
| 245 | LIBS+=-lsunmath | 164 | LIBS+=-lsunmath |
| 246 | LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib | 165 | LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib |
| 247 | OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc | 166 | OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc |
| 248 | -BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc | ||
| 249 | -endif | ||
| 250 | -endif | ||
| 251 | - | ||
| 252 | -# profiling code | ||
| 253 | -ifdef TARGET_GPROF | ||
| 254 | -BASE_LDFLAGS+=-p | ||
| 255 | -main.o: BASE_CFLAGS+=-p | ||
| 256 | -endif | ||
| 257 | - | ||
| 258 | -ifdef CONFIG_LINUX_USER | ||
| 259 | -OBJS= main.o syscall.o strace.o mmap.o signal.o path.o osdep.o thunk.o \ | ||
| 260 | - elfload.o linuxload.o uaccess.o | ||
| 261 | -LIBS+= $(AIOLIBS) | ||
| 262 | -ifdef TARGET_HAS_BFLT | ||
| 263 | -OBJS+= flatload.o | ||
| 264 | -endif | ||
| 265 | -ifdef TARGET_HAS_ELFLOAD32 | ||
| 266 | -OBJS+= elfload32.o | ||
| 267 | -elfload32.o: elfload.c | ||
| 268 | -endif | ||
| 269 | - | ||
| 270 | -ifeq ($(TARGET_ARCH), i386) | ||
| 271 | -OBJS+= vm86.o | ||
| 272 | -endif | ||
| 273 | -ifeq ($(TARGET_ARCH), arm) | ||
| 274 | -OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ | ||
| 275 | -nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ | ||
| 276 | - nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o | 167 | +CFLAGS+=-I/opt/SUNWspro/prod/include/cc |
| 277 | endif | 168 | endif |
| 278 | -ifeq ($(TARGET_ARCH), m68k) | ||
| 279 | -OBJS+= m68k-sim.o m68k-semi.o | ||
| 280 | -endif | ||
| 281 | -endif #CONFIG_LINUX_USER | ||
| 282 | - | ||
| 283 | -ifdef CONFIG_DARWIN_USER | ||
| 284 | -OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o | ||
| 285 | endif | 169 | endif |
| 286 | 170 | ||
| 287 | -SRCS:= $(OBJS:.o=.c) | ||
| 288 | -OBJS+= libqemu.a | 171 | +all: $(PROGS) |
| 289 | 172 | ||
| 173 | +######################################################### | ||
| 290 | # cpu emulator library | 174 | # cpu emulator library |
| 291 | LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\ | 175 | LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\ |
| 292 | translate.o op.o host-utils.o | 176 | translate.o op.o host-utils.o |
| @@ -378,29 +262,216 @@ ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390) | @@ -378,29 +262,216 @@ ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390) | ||
| 378 | LIBOBJS+=s390-dis.o | 262 | LIBOBJS+=s390-dis.o |
| 379 | endif | 263 | endif |
| 380 | 264 | ||
| 265 | +# libqemu | ||
| 266 | + | ||
| 267 | +libqemu.a: $(LIBOBJS) | ||
| 268 | + rm -f $@ | ||
| 269 | + $(AR) rcs $@ $(LIBOBJS) | ||
| 270 | + | ||
| 271 | +translate.o: translate.c gen-op.h opc.h cpu.h | ||
| 272 | + | ||
| 273 | +translate-all.o: translate-all.c opc.h cpu.h | ||
| 274 | + | ||
| 275 | +translate-op.o: translate-all.c op.h opc.h cpu.h | ||
| 276 | + | ||
| 277 | +op.h: op.o $(DYNGEN) | ||
| 278 | + $(DYNGEN) -o $@ $< | ||
| 279 | + | ||
| 280 | +opc.h: op.o $(DYNGEN) | ||
| 281 | + $(DYNGEN) -c -o $@ $< | ||
| 282 | + | ||
| 283 | +gen-op.h: op.o $(DYNGEN) | ||
| 284 | + $(DYNGEN) -g -o $@ $< | ||
| 285 | + | ||
| 286 | +op.o: op.c | ||
| 287 | + $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $< | ||
| 288 | + | ||
| 289 | +# HELPER_CFLAGS is used for all the code compiled with static register | ||
| 290 | +# variables | ||
| 291 | +ifeq ($(TARGET_BASE_ARCH), i386) | ||
| 292 | +# XXX: rename helper.c to op_helper.c | ||
| 293 | +helper.o: helper.c | ||
| 294 | + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< | ||
| 295 | +else | ||
| 296 | +op_helper.o: op_helper.c | ||
| 297 | + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< | ||
| 298 | +endif | ||
| 299 | + | ||
| 300 | +cpu-exec.o: cpu-exec.c | ||
| 301 | + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< | ||
| 302 | + | ||
| 303 | +######################################################### | ||
| 304 | +# Linux user emulator target | ||
| 305 | + | ||
| 306 | +ifdef CONFIG_LINUX_USER | ||
| 307 | + | ||
| 308 | +VPATH+=:$(SRC_PATH)/linux-user | ||
| 309 | +ifndef TARGET_ABI_DIR | ||
| 310 | + TARGET_ABI_DIR=$(TARGET_ARCH) | ||
| 311 | +endif | ||
| 312 | +CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) | ||
| 313 | + | ||
| 314 | +ifdef CONFIG_STATIC | ||
| 315 | +LDFLAGS+=-static | ||
| 316 | +endif | ||
| 317 | + | ||
| 318 | +ifeq ($(ARCH),i386) | ||
| 319 | +ifdef TARGET_GPROF | ||
| 320 | +USE_I386_LD=y | ||
| 321 | +endif | ||
| 322 | +ifdef CONFIG_STATIC | ||
| 323 | +USE_I386_LD=y | ||
| 324 | +endif | ||
| 325 | +ifdef USE_I386_LD | ||
| 326 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 327 | +else | ||
| 328 | +# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object | ||
| 329 | +# that the kernel ELF loader considers as an executable. I think this | ||
| 330 | +# is the simplest way to make it self virtualizable! | ||
| 331 | +LDFLAGS+=-Wl,-shared | ||
| 332 | +endif | ||
| 333 | +endif | ||
| 334 | + | ||
| 335 | +ifeq ($(ARCH),x86_64) | ||
| 336 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 337 | +endif | ||
| 338 | + | ||
| 339 | +ifeq ($(ARCH),ppc) | ||
| 340 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 341 | +endif | ||
| 342 | + | ||
| 343 | +ifeq ($(ARCH),s390) | ||
| 344 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 345 | +endif | ||
| 346 | + | ||
| 347 | +ifeq ($(ARCH),sparc) | ||
| 348 | +# -static is used to avoid g1/g3 usage by the dynamic linker | ||
| 349 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static | ||
| 350 | +endif | ||
| 351 | + | ||
| 352 | +ifeq ($(ARCH),sparc64) | ||
| 353 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 354 | +endif | ||
| 355 | + | ||
| 356 | +ifeq ($(ARCH),alpha) | ||
| 357 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 358 | +endif | ||
| 359 | + | ||
| 360 | +ifeq ($(ARCH),ia64) | ||
| 361 | +LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 362 | +endif | ||
| 363 | + | ||
| 364 | +ifeq ($(ARCH),arm) | ||
| 365 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 366 | +endif | ||
| 367 | + | ||
| 368 | +ifeq ($(ARCH),m68k) | ||
| 369 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 370 | +endif | ||
| 371 | + | ||
| 372 | +ifeq ($(ARCH),mips) | ||
| 373 | +ifeq ($(WORDS_BIGENDIAN),yes) | ||
| 374 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 375 | +else | ||
| 376 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | ||
| 377 | +endif | ||
| 378 | +endif | ||
| 379 | + | ||
| 380 | +ifeq ($(ARCH),mips64) | ||
| 381 | +ifeq ($(WORDS_BIGENDIAN),yes) | ||
| 382 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 383 | +else | ||
| 384 | +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | ||
| 385 | +endif | ||
| 386 | +endif | ||
| 387 | + | ||
| 388 | +OBJS= main.o syscall.o strace.o mmap.o signal.o path.o osdep.o thunk.o \ | ||
| 389 | + elfload.o linuxload.o uaccess.o | ||
| 390 | +LIBS+= $(AIOLIBS) | ||
| 391 | +ifdef TARGET_HAS_BFLT | ||
| 392 | +OBJS+= flatload.o | ||
| 393 | +endif | ||
| 394 | +ifdef TARGET_HAS_ELFLOAD32 | ||
| 395 | +OBJS+= elfload32.o | ||
| 396 | +elfload32.o: elfload.c | ||
| 397 | +endif | ||
| 398 | + | ||
| 399 | +ifeq ($(TARGET_ARCH), i386) | ||
| 400 | +OBJS+= vm86.o | ||
| 401 | +endif | ||
| 402 | +ifeq ($(TARGET_ARCH), arm) | ||
| 403 | +OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ | ||
| 404 | +nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ | ||
| 405 | + nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o | ||
| 406 | +endif | ||
| 407 | +ifeq ($(TARGET_ARCH), m68k) | ||
| 408 | +OBJS+= m68k-sim.o m68k-semi.o | ||
| 409 | +endif | ||
| 410 | + | ||
| 381 | ifdef CONFIG_GDBSTUB | 411 | ifdef CONFIG_GDBSTUB |
| 382 | OBJS+=gdbstub.o | 412 | OBJS+=gdbstub.o |
| 383 | endif | 413 | endif |
| 384 | 414 | ||
| 385 | -all: $(PROGS) | 415 | +OBJS+= libqemu.a |
| 416 | + | ||
| 417 | +# Note: this is a workaround. The real fix is to avoid compiling | ||
| 418 | +# cpu_signal_handler() in cpu-exec.c. | ||
| 419 | +signal.o: signal.c | ||
| 420 | + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< | ||
| 386 | 421 | ||
| 387 | -$(QEMU_USER): $(OBJS) | ||
| 388 | - $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ $(LIBS) | 422 | +$(QEMU_PROG): $(OBJS) |
| 423 | + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) | ||
| 389 | ifeq ($(ARCH),alpha) | 424 | ifeq ($(ARCH),alpha) |
| 390 | # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of | 425 | # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of |
| 391 | # the address space (31 bit so sign extending doesn't matter) | 426 | # the address space (31 bit so sign extending doesn't matter) |
| 392 | echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc | 427 | echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc |
| 393 | endif | 428 | endif |
| 394 | 429 | ||
| 395 | -# must use static linking to avoid leaving stuff in virtual address space | ||
| 396 | -VL_OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o | ||
| 397 | -# XXX: suppress QEMU_TOOL tests | 430 | +endif #CONFIG_LINUX_USER |
| 431 | + | ||
| 432 | +######################################################### | ||
| 433 | +# Darwin user emulator target | ||
| 434 | + | ||
| 435 | +ifdef CONFIG_DARWIN_USER | ||
| 436 | + | ||
| 437 | +VPATH+=:$(SRC_PATH)/darwin-user | ||
| 438 | +CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) | ||
| 439 | + | ||
| 440 | +# Leave some space for the regular program loading zone | ||
| 441 | +LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 | ||
| 442 | + | ||
| 443 | +LIBS+=-lmx | ||
| 444 | + | ||
| 445 | +OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o | ||
| 446 | + | ||
| 447 | +OBJS+= libqemu.a | ||
| 448 | + | ||
| 449 | +ifdef CONFIG_GDBSTUB | ||
| 450 | +OBJS+=gdbstub.o | ||
| 451 | +endif | ||
| 452 | + | ||
| 453 | +# Note: this is a workaround. The real fix is to avoid compiling | ||
| 454 | +# cpu_signal_handler() in cpu-exec.c. | ||
| 455 | +signal.o: signal.c | ||
| 456 | + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< | ||
| 457 | + | ||
| 458 | +$(QEMU_PROG): $(OBJS) | ||
| 459 | + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) | ||
| 460 | + | ||
| 461 | +endif #CONFIG_DARWIN_USER | ||
| 462 | + | ||
| 463 | +######################################################### | ||
| 464 | +# System emulator target | ||
| 465 | +ifndef CONFIG_USER_ONLY | ||
| 466 | + | ||
| 467 | +OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o | ||
| 398 | ifdef CONFIG_WIN32 | 468 | ifdef CONFIG_WIN32 |
| 399 | -VL_OBJS+=block-raw-win32.o | 469 | +OBJS+=block-raw-win32.o |
| 400 | else | 470 | else |
| 401 | -VL_OBJS+=block-raw-posix.o | 471 | +OBJS+=block-raw-posix.o |
| 402 | endif | 472 | endif |
| 403 | 473 | ||
| 474 | +LIBS+=-lz | ||
| 404 | ifdef CONFIG_ALSA | 475 | ifdef CONFIG_ALSA |
| 405 | LIBS += -lasound | 476 | LIBS += -lasound |
| 406 | endif | 477 | endif |
| @@ -431,98 +502,98 @@ LIBS += $(CONFIG_VNC_TLS_LIBS) | @@ -431,98 +502,98 @@ LIBS += $(CONFIG_VNC_TLS_LIBS) | ||
| 431 | endif | 502 | endif |
| 432 | 503 | ||
| 433 | # SCSI layer | 504 | # SCSI layer |
| 434 | -VL_OBJS+= lsi53c895a.o | 505 | +OBJS+= lsi53c895a.o |
| 435 | 506 | ||
| 436 | # USB layer | 507 | # USB layer |
| 437 | -VL_OBJS+= usb-ohci.o | 508 | +OBJS+= usb-ohci.o |
| 438 | 509 | ||
| 439 | # EEPROM emulation | 510 | # EEPROM emulation |
| 440 | -VL_OBJS += eeprom93xx.o | 511 | +OBJS += eeprom93xx.o |
| 441 | 512 | ||
| 442 | # PCI network cards | 513 | # PCI network cards |
| 443 | -VL_OBJS += eepro100.o | ||
| 444 | -VL_OBJS += ne2000.o | ||
| 445 | -VL_OBJS += pcnet.o | ||
| 446 | -VL_OBJS += rtl8139.o | 514 | +OBJS += eepro100.o |
| 515 | +OBJS += ne2000.o | ||
| 516 | +OBJS += pcnet.o | ||
| 517 | +OBJS += rtl8139.o | ||
| 447 | 518 | ||
| 448 | ifeq ($(TARGET_BASE_ARCH), i386) | 519 | ifeq ($(TARGET_BASE_ARCH), i386) |
| 449 | # Hardware support | 520 | # Hardware support |
| 450 | -VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o | ||
| 451 | -VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o | ||
| 452 | -VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o | ||
| 453 | -VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o | 521 | +OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o |
| 522 | +OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o | ||
| 523 | +OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o | ||
| 524 | +OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o | ||
| 454 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE | 525 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
| 455 | endif | 526 | endif |
| 456 | ifeq ($(TARGET_BASE_ARCH), ppc) | 527 | ifeq ($(TARGET_BASE_ARCH), ppc) |
| 457 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE | 528 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
| 458 | # shared objects | 529 | # shared objects |
| 459 | -VL_OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o | 530 | +OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o |
| 460 | # PREP target | 531 | # PREP target |
| 461 | -VL_OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o | ||
| 462 | -VL_OBJS+= prep_pci.o ppc_prep.o | 532 | +OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o |
| 533 | +OBJS+= prep_pci.o ppc_prep.o | ||
| 463 | # Mac shared devices | 534 | # Mac shared devices |
| 464 | -VL_OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o | 535 | +OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o |
| 465 | # OldWorld PowerMac | 536 | # OldWorld PowerMac |
| 466 | -VL_OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o | 537 | +OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o |
| 467 | # NewWorld PowerMac | 538 | # NewWorld PowerMac |
| 468 | -VL_OBJS+= unin_pci.o ppc_chrp.o | 539 | +OBJS+= unin_pci.o ppc_chrp.o |
| 469 | # PowerPC 4xx boards | 540 | # PowerPC 4xx boards |
| 470 | -VL_OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o | 541 | +OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o |
| 471 | endif | 542 | endif |
| 472 | ifeq ($(TARGET_BASE_ARCH), mips) | 543 | ifeq ($(TARGET_BASE_ARCH), mips) |
| 473 | -VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o | ||
| 474 | -VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o | ||
| 475 | -VL_OBJS+= jazz_led.o | ||
| 476 | -VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o | ||
| 477 | -VL_OBJS+= piix_pci.o parallel.o cirrus_vga.o $(SOUND_HW) | ||
| 478 | -VL_OBJS+= mipsnet.o | ||
| 479 | -VL_OBJS+= pflash_cfi01.o | 544 | +OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o |
| 545 | +OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o | ||
| 546 | +OBJS+= jazz_led.o | ||
| 547 | +OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o | ||
| 548 | +OBJS+= piix_pci.o parallel.o cirrus_vga.o $(SOUND_HW) | ||
| 549 | +OBJS+= mipsnet.o | ||
| 550 | +OBJS+= pflash_cfi01.o | ||
| 480 | CPPFLAGS += -DHAS_AUDIO | 551 | CPPFLAGS += -DHAS_AUDIO |
| 481 | endif | 552 | endif |
| 482 | ifeq ($(TARGET_BASE_ARCH), cris) | 553 | ifeq ($(TARGET_BASE_ARCH), cris) |
| 483 | -VL_OBJS+= etraxfs.o | ||
| 484 | -VL_OBJS+= ptimer.o | ||
| 485 | -VL_OBJS+= etraxfs_timer.o | ||
| 486 | -VL_OBJS+= etraxfs_ser.o | 554 | +OBJS+= etraxfs.o |
| 555 | +OBJS+= ptimer.o | ||
| 556 | +OBJS+= etraxfs_timer.o | ||
| 557 | +OBJS+= etraxfs_ser.o | ||
| 487 | endif | 558 | endif |
| 488 | ifeq ($(TARGET_BASE_ARCH), sparc) | 559 | ifeq ($(TARGET_BASE_ARCH), sparc) |
| 489 | ifeq ($(TARGET_ARCH), sparc64) | 560 | ifeq ($(TARGET_ARCH), sparc64) |
| 490 | -VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o | ||
| 491 | -VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o | ||
| 492 | -VL_OBJS+= cirrus_vga.o parallel.o ptimer.o | 561 | +OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o |
| 562 | +OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o | ||
| 563 | +OBJS+= cirrus_vga.o parallel.o ptimer.o | ||
| 493 | else | 564 | else |
| 494 | -VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o | ||
| 495 | -VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o | ||
| 496 | -VL_OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o | 565 | +OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o |
| 566 | +OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o | ||
| 567 | +OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o | ||
| 497 | endif | 568 | endif |
| 498 | endif | 569 | endif |
| 499 | ifeq ($(TARGET_BASE_ARCH), arm) | 570 | ifeq ($(TARGET_BASE_ARCH), arm) |
| 500 | -VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o | ||
| 501 | -VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o | ||
| 502 | -VL_OBJS+= versatile_pci.o ptimer.o | ||
| 503 | -VL_OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o | ||
| 504 | -VL_OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o | ||
| 505 | -VL_OBJS+= pl061.o | ||
| 506 | -VL_OBJS+= arm-semi.o | ||
| 507 | -VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o | ||
| 508 | -VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o | ||
| 509 | -VL_OBJS+= pflash_cfi01.o gumstix.o | ||
| 510 | -VL_OBJS+= spitz.o ide.o serial.o nand.o ecc.o | ||
| 511 | -VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o | ||
| 512 | -VL_OBJS+= palm.o tsc210x.o | ||
| 513 | -VL_OBJS+= mst_fpga.o mainstone.o | 571 | +OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o |
| 572 | +OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o | ||
| 573 | +OBJS+= versatile_pci.o ptimer.o | ||
| 574 | +OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o | ||
| 575 | +OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o | ||
| 576 | +OBJS+= pl061.o | ||
| 577 | +OBJS+= arm-semi.o | ||
| 578 | +OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o | ||
| 579 | +OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o | ||
| 580 | +OBJS+= pflash_cfi01.o gumstix.o | ||
| 581 | +OBJS+= spitz.o ide.o serial.o nand.o ecc.o | ||
| 582 | +OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o | ||
| 583 | +OBJS+= palm.o tsc210x.o | ||
| 584 | +OBJS+= mst_fpga.o mainstone.o | ||
| 514 | CPPFLAGS += -DHAS_AUDIO | 585 | CPPFLAGS += -DHAS_AUDIO |
| 515 | endif | 586 | endif |
| 516 | ifeq ($(TARGET_BASE_ARCH), sh4) | 587 | ifeq ($(TARGET_BASE_ARCH), sh4) |
| 517 | -VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o | ||
| 518 | -VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o | 588 | +OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o |
| 589 | +OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o | ||
| 519 | endif | 590 | endif |
| 520 | ifeq ($(TARGET_BASE_ARCH), m68k) | 591 | ifeq ($(TARGET_BASE_ARCH), m68k) |
| 521 | -VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o | ||
| 522 | -VL_OBJS+= m68k-semi.o dummy_m68k.o | 592 | +OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o |
| 593 | +OBJS+= m68k-semi.o dummy_m68k.o | ||
| 523 | endif | 594 | endif |
| 524 | ifdef CONFIG_GDBSTUB | 595 | ifdef CONFIG_GDBSTUB |
| 525 | -VL_OBJS+=gdbstub.o | 596 | +OBJS+=gdbstub.o |
| 526 | endif | 597 | endif |
| 527 | ifdef CONFIG_COCOA | 598 | ifdef CONFIG_COCOA |
| 528 | COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit | 599 | COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit |
| @@ -534,103 +605,44 @@ ifdef CONFIG_SLIRP | @@ -534,103 +605,44 @@ ifdef CONFIG_SLIRP | ||
| 534 | CPPFLAGS+=-I$(SRC_PATH)/slirp | 605 | CPPFLAGS+=-I$(SRC_PATH)/slirp |
| 535 | endif | 606 | endif |
| 536 | 607 | ||
| 537 | -VL_LDFLAGS=$(VL_OS_LDFLAGS) | ||
| 538 | -VL_LIBS=$(AIOLIBS) | 608 | +LIBS+=$(AIOLIBS) |
| 539 | # specific flags are needed for non soft mmu emulator | 609 | # specific flags are needed for non soft mmu emulator |
| 540 | ifdef CONFIG_STATIC | 610 | ifdef CONFIG_STATIC |
| 541 | -VL_LDFLAGS+=-static | ||
| 542 | -endif | ||
| 543 | -ifndef CONFIG_SOFTMMU | ||
| 544 | -VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld | 611 | +LDFLAGS+=-static |
| 545 | endif | 612 | endif |
| 546 | ifndef CONFIG_DARWIN | 613 | ifndef CONFIG_DARWIN |
| 547 | ifndef CONFIG_WIN32 | 614 | ifndef CONFIG_WIN32 |
| 548 | ifndef CONFIG_SOLARIS | 615 | ifndef CONFIG_SOLARIS |
| 549 | -VL_LIBS+=-lutil | 616 | +LIBS+=-lutil |
| 550 | endif | 617 | endif |
| 551 | endif | 618 | endif |
| 552 | endif | 619 | endif |
| 553 | ifdef TARGET_GPROF | 620 | ifdef TARGET_GPROF |
| 554 | -vl.o: BASE_CFLAGS+=-p | ||
| 555 | -VL_LDFLAGS+=-p | 621 | +vl.o: CFLAGS+=-p |
| 622 | +LDFLAGS+=-p | ||
| 556 | endif | 623 | endif |
| 557 | 624 | ||
| 558 | ifeq ($(ARCH),ia64) | 625 | ifeq ($(ARCH),ia64) |
| 559 | -VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld | ||
| 560 | -endif | ||
| 561 | - | ||
| 562 | -ifeq ($(ARCH),sparc64) | ||
| 563 | - VL_LDFLAGS+=-m64 | ||
| 564 | - ifneq ($(CONFIG_SOLARIS),yes) | ||
| 565 | - VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 566 | - endif | ||
| 567 | -endif | ||
| 568 | - | ||
| 569 | -ifeq ($(ARCH),x86_64) | ||
| 570 | - VL_LDFLAGS+=-m64 | ||
| 571 | - ifneq ($(CONFIG_SOLARIS),yes) | ||
| 572 | - VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | ||
| 573 | - endif | 626 | +LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld |
| 574 | endif | 627 | endif |
| 575 | 628 | ||
| 576 | ifdef CONFIG_WIN32 | 629 | ifdef CONFIG_WIN32 |
| 577 | SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole | 630 | SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole |
| 578 | endif | 631 | endif |
| 579 | 632 | ||
| 580 | -$(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a | ||
| 581 | - $(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) | ||
| 582 | - | ||
| 583 | -depend: $(SRCS) | ||
| 584 | - $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend | ||
| 585 | - | ||
| 586 | -vldepend: $(VL_OBJS:.o=.c) | ||
| 587 | - $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend | ||
| 588 | - | ||
| 589 | -# libqemu | ||
| 590 | - | ||
| 591 | -libqemu.a: $(LIBOBJS) | ||
| 592 | - rm -f $@ | ||
| 593 | - $(AR) rcs $@ $(LIBOBJS) | ||
| 594 | - | ||
| 595 | -translate.o: translate.c gen-op.h opc.h cpu.h | ||
| 596 | - | ||
| 597 | -translate-all.o: translate-all.c opc.h cpu.h | ||
| 598 | - | ||
| 599 | -translate-op.o: translate-all.c op.h opc.h cpu.h | ||
| 600 | - | ||
| 601 | -op.h: op.o $(DYNGEN) | ||
| 602 | - $(DYNGEN) -o $@ $< | ||
| 603 | - | ||
| 604 | -opc.h: op.o $(DYNGEN) | ||
| 605 | - $(DYNGEN) -c -o $@ $< | ||
| 606 | - | ||
| 607 | -gen-op.h: op.o $(DYNGEN) | ||
| 608 | - $(DYNGEN) -g -o $@ $< | ||
| 609 | - | ||
| 610 | -op.o: op.c | ||
| 611 | - $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $< | ||
| 612 | - | ||
| 613 | -# HELPER_CFLAGS is used for all the code compiled with static register | ||
| 614 | -# variables | ||
| 615 | -ifeq ($(TARGET_BASE_ARCH), i386) | ||
| 616 | -# XXX: rename helper.c to op_helper.c | ||
| 617 | -helper.o: helper.c | ||
| 618 | - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | ||
| 619 | -else | ||
| 620 | -op_helper.o: op_helper.c | ||
| 621 | - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | 633 | +# profiling code |
| 634 | +ifdef TARGET_GPROF | ||
| 635 | +LDFLAGS+=-p | ||
| 636 | +main.o: CFLAGS+=-p | ||
| 622 | endif | 637 | endif |
| 623 | 638 | ||
| 624 | -cpu-exec.o: cpu-exec.c | ||
| 625 | - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | 639 | +$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a |
| 640 | + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) | ||
| 626 | 641 | ||
| 627 | -# Note: this is a workaround. The real fix is to avoid compiling | ||
| 628 | -# cpu_signal_handler() in cpu-exec.c. | ||
| 629 | -signal.o: signal.c | ||
| 630 | - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | 642 | +endif # !CONFIG_USER_ONLY |
| 631 | 643 | ||
| 632 | %.o: %.c | 644 | %.o: %.c |
| 633 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | 645 | + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
| 634 | 646 | ||
| 635 | %.o: %.S | 647 | %.o: %.S |
| 636 | $(CC) $(CPPFLAGS) -c -o $@ $< | 648 | $(CC) $(CPPFLAGS) -c -o $@ $< |
| @@ -644,16 +656,5 @@ ifneq ($(PROGS),) | @@ -644,16 +656,5 @@ ifneq ($(PROGS),) | ||
| 644 | $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)" | 656 | $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)" |
| 645 | endif | 657 | endif |
| 646 | 658 | ||
| 647 | -ifneq ($(wildcard .depend),) | ||
| 648 | -include .depend | ||
| 649 | -endif | ||
| 650 | - | ||
| 651 | -ifeq (1, 0) | ||
| 652 | -audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \ | ||
| 653 | -fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o ac97.o gus.o adlib.o \ | ||
| 654 | -esdaudio.o audio_pt_int.o: \ | ||
| 655 | -CFLAGS := $(CFLAGS) -O0 -g -Wall -Werror -W -Wsign-compare -Wno-unused | ||
| 656 | -endif | ||
| 657 | - | ||
| 658 | # Include automatically generated dependency files | 659 | # Include automatically generated dependency files |
| 659 | -include $(wildcard *.d */*.d) | 660 | -include $(wildcard *.d */*.d) |
configure
| @@ -115,7 +115,6 @@ case $targetos in | @@ -115,7 +115,6 @@ case $targetos in | ||
| 115 | CYGWIN*) | 115 | CYGWIN*) |
| 116 | mingw32="yes" | 116 | mingw32="yes" |
| 117 | OS_CFLAGS="-mno-cygwin" | 117 | OS_CFLAGS="-mno-cygwin" |
| 118 | -VL_OS_LDFLAGS="-mno-cygwin" | ||
| 119 | if [ "$cpu" = "i386" ] ; then | 118 | if [ "$cpu" = "i386" ] ; then |
| 120 | kqemu="yes" | 119 | kqemu="yes" |
| 121 | fi | 120 | fi |
| @@ -349,7 +348,7 @@ fi | @@ -349,7 +348,7 @@ fi | ||
| 349 | # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right | 348 | # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right |
| 350 | # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) | 349 | # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) |
| 351 | # | 350 | # |
| 352 | -case $cpu in | 351 | +case "$cpu" in |
| 353 | sparc) if test -z "$sparc_cpu" ; then | 352 | sparc) if test -z "$sparc_cpu" ; then |
| 354 | ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__" | 353 | ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__" |
| 355 | ARCH_LDFLAGS="-m32" | 354 | ARCH_LDFLAGS="-m32" |
| @@ -369,19 +368,16 @@ case $cpu in | @@ -369,19 +368,16 @@ case $cpu in | ||
| 369 | s390) | 368 | s390) |
| 370 | ARCH_CFLAGS="-march=z900" | 369 | ARCH_CFLAGS="-march=z900" |
| 371 | ;; | 370 | ;; |
| 371 | + i386) | ||
| 372 | + ARCH_CFLAGS="-m32" | ||
| 373 | + ARCH_LDFLAGS="-m32" | ||
| 374 | + ;; | ||
| 375 | + x86_64) | ||
| 376 | + ARCH_CFLAGS="-m64" | ||
| 377 | + ARCH_LDFLAGS="-m64" | ||
| 378 | + ;; | ||
| 372 | esac | 379 | esac |
| 373 | 380 | ||
| 374 | -if [ "$solaris" = "yes" -a "$cpu" = "x86_64" ] ; then | ||
| 375 | - CFLAGS="${CFLAGS} -m64" | ||
| 376 | - OS_CFLAGS="${OS_CFLAGS} -m64" | ||
| 377 | - OS_LDFLAGS="${OS_LDFLAGS} -m64" | ||
| 378 | -fi | ||
| 379 | - | ||
| 380 | -if [ "$solaris" = "yes" -a "$cpu" = "i386" ] ; then | ||
| 381 | - CFLAGS="${CFLAGS} -m32" | ||
| 382 | - OS_CFLAGS="${OS_CFLAGS} -m32" | ||
| 383 | -fi | ||
| 384 | - | ||
| 385 | if test x"$show_help" = x"yes" ; then | 381 | if test x"$show_help" = x"yes" ; then |
| 386 | cat << EOF | 382 | cat << EOF |
| 387 | 383 | ||
| @@ -794,9 +790,11 @@ echo "CC=$cc" >> $config_mak | @@ -794,9 +790,11 @@ echo "CC=$cc" >> $config_mak | ||
| 794 | echo "HOST_CC=$host_cc" >> $config_mak | 790 | echo "HOST_CC=$host_cc" >> $config_mak |
| 795 | echo "AR=$ar" >> $config_mak | 791 | echo "AR=$ar" >> $config_mak |
| 796 | echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak | 792 | echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak |
| 793 | +# XXX: only use CFLAGS and LDFLAGS ? | ||
| 794 | +# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross | ||
| 795 | +# compilation of dyngen tool (useful for win32 build on Linux host) | ||
| 797 | echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak | 796 | echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak |
| 798 | echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak | 797 | echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak |
| 799 | -echo "VL_OS_LDFLAGS=$VL_OS_LDFLAGS" >> $config_mak | ||
| 800 | echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak | 798 | echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak |
| 801 | echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak | 799 | echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak |
| 802 | echo "CFLAGS=$CFLAGS" >> $config_mak | 800 | echo "CFLAGS=$CFLAGS" >> $config_mak |