Commit 6f30fa853b78203c3a03c91470b7d2d12f46955a

Authored by ths
1 parent b371dc59

Untangle the various CFLAGS/LDFLAGS flavours. Allow overriding the

optional flags at make time.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2289 c046a42c-6fe2-441c-8c8c-71466251a162
Makefile
@@ -5,19 +5,18 @@ include config-host.mak @@ -5,19 +5,18 @@ include config-host.mak
5 .PHONY: all clean distclean dvi info install install-doc tar tarbin \ 5 .PHONY: all clean distclean dvi info install install-doc tar tarbin \
6 speed test test2 html dvi info 6 speed test test2 html dvi info
7 7
8 -CFLAGS+=-Wall -O2 -g -fno-strict-aliasing -I.  
9 -ifdef CONFIG_DARWIN  
10 -CFLAGS+= -mdynamic-no-pic  
11 -endif 8 +BASE_CFLAGS=
  9 +BASE_LDFLAGS=
  10 +
  11 +BASE_CFLAGS += $(OS_CFLAGS)
12 ifeq ($(ARCH),sparc) 12 ifeq ($(ARCH),sparc)
13 -CFLAGS+=-mcpu=ultrasparc 13 +BASE_CFLAGS += -mcpu=ultrasparc
14 endif 14 endif
15 -LDFLAGS+=-g 15 +CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
16 LIBS= 16 LIBS=
17 -DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE  
18 TOOLS=qemu-img$(EXESUF) 17 TOOLS=qemu-img$(EXESUF)
19 ifdef CONFIG_STATIC 18 ifdef CONFIG_STATIC
20 -LDFLAGS+=-static 19 +BASE_LDFLAGS += -static
21 endif 20 endif
22 ifdef BUILD_DOCS 21 ifdef BUILD_DOCS
23 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 22 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
@@ -41,10 +40,10 @@ subdir-%: dyngen$(EXESUF) @@ -41,10 +40,10 @@ subdir-%: dyngen$(EXESUF)
41 recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) 40 recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
42 41
43 qemu-img$(EXESUF): qemu-img.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c 42 qemu-img$(EXESUF): qemu-img.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c
44 - $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS) 43 + $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
45 44
46 dyngen$(EXESUF): dyngen.c 45 dyngen$(EXESUF): dyngen.c
47 - $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^ 46 + $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
48 47
49 clean: 48 clean:
50 # avoid old build problems by removing potentially incorrect old files 49 # avoid old build problems by removing potentially incorrect old files
Makefile.target
@@ -12,14 +12,14 @@ TARGET_BASE_ARCH:=sparc @@ -12,14 +12,14 @@ TARGET_BASE_ARCH:=sparc
12 endif 12 endif
13 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) 13 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
14 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio 14 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
15 -DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) 15 +CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
16 ifdef CONFIG_USER_ONLY 16 ifdef CONFIG_USER_ONLY
17 VPATH+=:$(SRC_PATH)/linux-user 17 VPATH+=:$(SRC_PATH)/linux-user
18 -DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) 18 +CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
19 endif 19 endif
20 -CFLAGS=-Wall -O2 -g -fno-strict-aliasing 20 +BASE_CFLAGS=
  21 +BASE_LDFLAGS=
21 #CFLAGS+=-Werror 22 #CFLAGS+=-Werror
22 -LDFLAGS=-g  
23 LIBS= 23 LIBS=
24 HELPER_CFLAGS=$(CFLAGS) 24 HELPER_CFLAGS=$(CFLAGS)
25 DYNGEN=../dyngen$(EXESUF) 25 DYNGEN=../dyngen$(EXESUF)
@@ -62,18 +62,20 @@ endif @@ -62,18 +62,20 @@ endif
62 endif # !CONFIG_USER_ONLY 62 endif # !CONFIG_USER_ONLY
63 63
64 ifdef CONFIG_STATIC 64 ifdef CONFIG_STATIC
65 -LDFLAGS+=-static 65 +BASE_LDFLAGS+=-static
66 endif 66 endif
67 67
  68 +# We require -O2 to avoid the stack setup prologue in EXIT_TB
  69 +OP_CFLAGS = -Wall -O2 -g -fno-strict-aliasing
  70 +
68 ifeq ($(ARCH),i386) 71 ifeq ($(ARCH),i386)
69 -HELPER_CFLAGS:=$(CFLAGS) -fomit-frame-pointer  
70 -OP_CFLAGS:=$(CFLAGS) -mpreferred-stack-boundary=2 -fomit-frame-pointer 72 +HELPER_CFLAGS+=-fomit-frame-pointer
  73 +OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
71 ifeq ($(HAVE_GCC3_OPTIONS),yes) 74 ifeq ($(HAVE_GCC3_OPTIONS),yes)
72 OP_CFLAGS+= -falign-functions=0 -fno-gcse 75 OP_CFLAGS+= -falign-functions=0 -fno-gcse
73 else 76 else
74 OP_CFLAGS+= -malign-functions=0 77 OP_CFLAGS+= -malign-functions=0
75 endif 78 endif
76 -  
77 ifdef TARGET_GPROF 79 ifdef TARGET_GPROF
78 USE_I386_LD=y 80 USE_I386_LD=y
79 endif 81 endif
@@ -81,76 +83,76 @@ ifdef CONFIG_STATIC @@ -81,76 +83,76 @@ ifdef CONFIG_STATIC
81 USE_I386_LD=y 83 USE_I386_LD=y
82 endif 84 endif
83 ifdef USE_I386_LD 85 ifdef USE_I386_LD
84 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld 86 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
85 else 87 else
86 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object 88 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
87 # that the kernel ELF loader considers as an executable. I think this 89 # that the kernel ELF loader considers as an executable. I think this
88 # is the simplest way to make it self virtualizable! 90 # is the simplest way to make it self virtualizable!
89 -LDFLAGS+=-Wl,-shared 91 +BASE_LDFLAGS+=-Wl,-shared
90 endif 92 endif
91 endif 93 endif
92 94
93 ifeq ($(ARCH),x86_64) 95 ifeq ($(ARCH),x86_64)
94 -OP_CFLAGS=$(CFLAGS) -falign-functions=0  
95 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld 96 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
96 endif 97 endif
97 98
98 ifeq ($(ARCH),ppc) 99 ifeq ($(ARCH),ppc)
99 -CFLAGS+= -D__powerpc__  
100 -OP_CFLAGS=$(CFLAGS)  
101 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld 100 +CPPFLAGS+= -D__powerpc__
  101 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
102 endif 102 endif
103 103
104 ifeq ($(ARCH),s390) 104 ifeq ($(ARCH),s390)
105 -OP_CFLAGS=$(CFLAGS)  
106 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld 105 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
107 endif 106 endif
108 107
109 ifeq ($(ARCH),sparc) 108 ifeq ($(ARCH),sparc)
110 ifeq ($(CONFIG_SOLARIS),yes) 109 ifeq ($(CONFIG_SOLARIS),yes)
111 -CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3  
112 -LDFLAGS+=-m32  
113 -OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0 110 +BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
  111 +BASE_LDFLAGS+=-m32
  112 +OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
114 else 113 else
115 -CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6  
116 -LDFLAGS+=-m32  
117 -OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 114 +BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
  115 +BASE_LDFLAGS+=-m32
  116 +OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
118 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat 117 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
119 # -static is used to avoid g1/g3 usage by the dynamic linker 118 # -static is used to avoid g1/g3 usage by the dynamic linker
120 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static 119 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
121 endif 120 endif
122 endif 121 endif
123 122
124 ifeq ($(ARCH),sparc64) 123 ifeq ($(ARCH),sparc64)
125 -CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7  
126 -LDFLAGS+=-m64  
127 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld  
128 -OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 124 +BASE_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
  125 +BASE_LDFLAGS+=-m64
  126 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
  127 +OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
129 endif 128 endif
130 129
131 ifeq ($(ARCH),alpha) 130 ifeq ($(ARCH),alpha)
132 -# -msmall-data is not used because we want two-instruction relocations  
133 -# for the constant constructions  
134 -OP_CFLAGS=-Wall -O2 -g 131 +# -msmall-data is not used for OP_CFLAGS because we want two-instruction
  132 +# relocations for the constant constructions
135 # Ensure there's only a single GP 133 # Ensure there's only a single GP
136 -CFLAGS += -msmall-data  
137 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld 134 +BASE_CFLAGS+=-msmall-data
  135 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
138 endif 136 endif
139 137
140 ifeq ($(ARCH),ia64) 138 ifeq ($(ARCH),ia64)
141 -CFLAGS += -mno-sdata  
142 -OP_CFLAGS=$(CFLAGS)  
143 -LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld 139 +BASE_CFLAGS+=-mno-sdata
  140 +OP_CFLAGS+=-mno-sdata
  141 +BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
144 endif 142 endif
145 143
146 ifeq ($(ARCH),arm) 144 ifeq ($(ARCH),arm)
147 -OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer  
148 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld 145 +OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
  146 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
149 endif 147 endif
150 148
151 ifeq ($(ARCH),m68k) 149 ifeq ($(ARCH),m68k)
152 -OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer  
153 -LDFLAGS+=-Wl,-T,m68k.ld 150 +OP_CFLAGS+=-fomit-frame-pointer
  151 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
  152 +endif
  153 +
  154 +ifeq ($(ARCH),mips)
  155 +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
154 endif 156 endif
155 157
156 ifeq ($(HAVE_GCC3_OPTIONS),yes) 158 ifeq ($(HAVE_GCC3_OPTIONS),yes)
@@ -159,13 +161,14 @@ OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls @@ -159,13 +161,14 @@ OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
159 endif 161 endif
160 162
161 ifeq ($(CONFIG_DARWIN),yes) 163 ifeq ($(CONFIG_DARWIN),yes)
162 -OP_CFLAGS+= -mdynamic-no-pic  
163 LIBS+=-lmx 164 LIBS+=-lmx
164 endif 165 endif
165 166
  167 +OP_CFLAGS+=$(OS_CFLAGS)
  168 +
166 ######################################################### 169 #########################################################
167 170
168 -DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 171 +CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
169 LIBS+=-lm 172 LIBS+=-lm
170 ifndef CONFIG_USER_ONLY 173 ifndef CONFIG_USER_ONLY
171 LIBS+=-lz 174 LIBS+=-lz
@@ -179,8 +182,8 @@ endif @@ -179,8 +182,8 @@ endif
179 182
180 # profiling code 183 # profiling code
181 ifdef TARGET_GPROF 184 ifdef TARGET_GPROF
182 -LDFLAGS+=-p  
183 -main.o: CFLAGS+=-p 185 +BASE_LDFLAGS+=-p
  186 +main.o: BASE_CFLAGS+=-p
184 endif 187 endif
185 188
186 OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \ 189 OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
@@ -211,7 +214,7 @@ LIBOBJS+=fpu/softfloat.o @@ -211,7 +214,7 @@ LIBOBJS+=fpu/softfloat.o
211 else 214 else
212 LIBOBJS+=fpu/softfloat-native.o 215 LIBOBJS+=fpu/softfloat-native.o
213 endif 216 endif
214 -DEFINES+=-I$(SRC_PATH)/fpu 217 +CPPFLAGS+=-I$(SRC_PATH)/fpu
215 218
216 ifeq ($(TARGET_ARCH), i386) 219 ifeq ($(TARGET_ARCH), i386)
217 LIBOBJS+=helper.o helper2.o 220 LIBOBJS+=helper.o helper2.o
@@ -288,7 +291,7 @@ endif @@ -288,7 +291,7 @@ endif
288 all: $(PROGS) 291 all: $(PROGS)
289 292
290 $(QEMU_USER): $(OBJS) 293 $(QEMU_USER): $(OBJS)
291 - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) 294 + $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ $(LIBS)
292 ifeq ($(ARCH),alpha) 295 ifeq ($(ARCH),alpha)
293 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of 296 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
294 # the address space (31 bit so sign extending doesn't matter) 297 # the address space (31 bit so sign extending doesn't matter)
@@ -324,7 +327,7 @@ LIBS += -lole32 -ldxguid @@ -324,7 +327,7 @@ LIBS += -lole32 -ldxguid
324 endif 327 endif
325 ifdef CONFIG_FMOD 328 ifdef CONFIG_FMOD
326 AUDIODRV += fmodaudio.o 329 AUDIODRV += fmodaudio.o
327 -audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES) 330 +audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
328 LIBS += $(CONFIG_FMOD_LIB) 331 LIBS += $(CONFIG_FMOD_LIB)
329 endif 332 endif
330 ifdef CONFIG_ADLIB 333 ifdef CONFIG_ADLIB
@@ -347,14 +350,14 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) @@ -347,14 +350,14 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
347 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o 350 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
348 VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o 351 VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
349 VL_OBJS+= usb-uhci.o 352 VL_OBJS+= usb-uhci.o
350 -DEFINES += -DHAS_AUDIO 353 +CPPFLAGS += -DHAS_AUDIO
351 endif 354 endif
352 ifeq ($(TARGET_BASE_ARCH), ppc) 355 ifeq ($(TARGET_BASE_ARCH), ppc)
353 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) 356 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
354 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o 357 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
355 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o 358 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
356 VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o 359 VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
357 -DEFINES += -DHAS_AUDIO 360 +CPPFLAGS += -DHAS_AUDIO
358 endif 361 endif
359 ifeq ($(TARGET_ARCH), mips) 362 ifeq ($(TARGET_ARCH), mips)
360 VL_OBJS+= mips_r4k.o mips_timer.o dma.o vga.o serial.o i8254.o i8259.o ide.o 363 VL_OBJS+= mips_r4k.o mips_timer.o dma.o vga.o serial.o i8254.o i8259.o ide.o
@@ -395,7 +398,7 @@ COCOA_LIBS+=-framework CoreAudio @@ -395,7 +398,7 @@ COCOA_LIBS+=-framework CoreAudio
395 endif 398 endif
396 endif 399 endif
397 ifdef CONFIG_SLIRP 400 ifdef CONFIG_SLIRP
398 -DEFINES+=-I$(SRC_PATH)/slirp 401 +CPPFLAGS+=-I$(SRC_PATH)/slirp
399 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ 402 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
400 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ 403 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
401 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o 404 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
@@ -418,7 +421,7 @@ endif @@ -418,7 +421,7 @@ endif
418 endif 421 endif
419 endif 422 endif
420 ifdef TARGET_GPROF 423 ifdef TARGET_GPROF
421 -vl.o: CFLAGS+=-p 424 +vl.o: BASE_CFLAGS+=-p
422 VL_LDFLAGS+=-p 425 VL_LDFLAGS+=-p
423 endif 426 endif
424 427
@@ -439,22 +442,22 @@ $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a @@ -439,22 +442,22 @@ $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
439 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) 442 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
440 443
441 cocoa.o: cocoa.m 444 cocoa.o: cocoa.m
442 - $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< 445 + $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
443 446
444 sdl.o: sdl.c keymaps.c sdl_keysym.h 447 sdl.o: sdl.c keymaps.c sdl_keysym.h
445 - $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< 448 + $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
446 449
447 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h 450 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
448 - $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< 451 + $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
449 452
450 sdlaudio.o: sdlaudio.c 453 sdlaudio.o: sdlaudio.c
451 - $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< 454 + $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
452 455
453 depend: $(SRCS) 456 depend: $(SRCS)
454 - $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend 457 + $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
455 458
456 vldepend: $(VL_OBJS:.o=.c) 459 vldepend: $(VL_OBJS:.o=.c)
457 - $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend 460 + $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
458 461
459 # libqemu 462 # libqemu
460 463
@@ -478,26 +481,26 @@ gen-op.h: op.o $(DYNGEN) @@ -478,26 +481,26 @@ gen-op.h: op.o $(DYNGEN)
478 $(DYNGEN) -g -o $@ $< 481 $(DYNGEN) -g -o $@ $<
479 482
480 op.o: op.c 483 op.o: op.c
481 - $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< 484 + $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
482 485
483 # HELPER_CFLAGS is used for all the code compiled with static register 486 # HELPER_CFLAGS is used for all the code compiled with static register
484 # variables 487 # variables
485 ifeq ($(TARGET_BASE_ARCH), i386) 488 ifeq ($(TARGET_BASE_ARCH), i386)
486 # XXX: rename helper.c to op_helper.c 489 # XXX: rename helper.c to op_helper.c
487 helper.o: helper.c 490 helper.o: helper.c
488 - $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< 491 + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
489 else 492 else
490 op_helper.o: op_helper.c 493 op_helper.o: op_helper.c
491 - $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< 494 + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
492 endif 495 endif
493 496
494 cpu-exec.o: cpu-exec.c 497 cpu-exec.o: cpu-exec.c
495 - $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< 498 + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
496 499
497 # Note: this is a workaround. The real fix is to avoid compiling 500 # Note: this is a workaround. The real fix is to avoid compiling
498 # cpu_signal_handler() in cpu-exec.c. 501 # cpu_signal_handler() in cpu-exec.c.
499 signal.o: signal.c 502 signal.o: signal.c
500 - $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< 503 + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
501 504
502 ifeq ($(TARGET_BASE_ARCH), i386) 505 ifeq ($(TARGET_BASE_ARCH), i386)
503 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h 506 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
@@ -539,10 +542,10 @@ endif @@ -539,10 +542,10 @@ endif
539 $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h 542 $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
540 543
541 %.o: %.c 544 %.o: %.c
542 - $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< 545 + $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
543 546
544 %.o: %.S 547 %.o: %.S
545 - $(CC) $(DEFINES) -c -o $@ $< 548 + $(CC) $(CPPFLAGS) -c -o $@ $<
546 549
547 clean: 550 clean:
548 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o 551 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
configure
@@ -103,7 +103,7 @@ targetos=`uname -s` @@ -103,7 +103,7 @@ targetos=`uname -s`
103 case $targetos in 103 case $targetos in
104 CYGWIN*) 104 CYGWIN*)
105 mingw32="yes" 105 mingw32="yes"
106 -CFLAGS="-O2 -mno-cygwin" 106 +OS_CFLAGS="-mno-cygwin"
107 ;; 107 ;;
108 MINGW32*) 108 MINGW32*)
109 mingw32="yes" 109 mingw32="yes"
@@ -126,6 +126,7 @@ oss=&quot;yes&quot; @@ -126,6 +126,7 @@ oss=&quot;yes&quot;
126 Darwin) 126 Darwin)
127 bsd="yes" 127 bsd="yes"
128 darwin="yes" 128 darwin="yes"
  129 +OS_CFLAGS="-mdynamic-no-pic"
129 ;; 130 ;;
130 SunOS) 131 SunOS)
131 solaris="yes" 132 solaris="yes"
@@ -243,6 +244,10 @@ for opt do @@ -243,6 +244,10 @@ for opt do
243 esac 244 esac
244 done 245 done
245 246
  247 +# default flags for all hosts
  248 +CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
  249 +LDFLAGS="$LDFLAGS -g"
  250 +
246 if test x"$show_help" = x"yes" ; then 251 if test x"$show_help" = x"yes" ; then
247 cat << EOF 252 cat << EOF
248 253
@@ -605,6 +610,7 @@ fi @@ -605,6 +610,7 @@ fi
605 echo "HOST_CC=$host_cc" >> $config_mak 610 echo "HOST_CC=$host_cc" >> $config_mak
606 echo "AR=$ar" >> $config_mak 611 echo "AR=$ar" >> $config_mak
607 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak 612 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
  613 +echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
608 echo "CFLAGS=$CFLAGS" >> $config_mak 614 echo "CFLAGS=$CFLAGS" >> $config_mak
609 echo "LDFLAGS=$LDFLAGS" >> $config_mak 615 echo "LDFLAGS=$LDFLAGS" >> $config_mak
610 echo "EXESUF=$EXESUF" >> $config_mak 616 echo "EXESUF=$EXESUF" >> $config_mak