Commit 6f30fa853b78203c3a03c91470b7d2d12f46955a
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
Showing
3 changed files
with
83 additions
and
75 deletions
Makefile
... | ... | @@ -5,19 +5,18 @@ include config-host.mak |
5 | 5 | .PHONY: all clean distclean dvi info install install-doc tar tarbin \ |
6 | 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 | 12 | ifeq ($(ARCH),sparc) |
13 | -CFLAGS+=-mcpu=ultrasparc | |
13 | +BASE_CFLAGS += -mcpu=ultrasparc | |
14 | 14 | endif |
15 | -LDFLAGS+=-g | |
15 | +CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE | |
16 | 16 | LIBS= |
17 | -DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE | |
18 | 17 | TOOLS=qemu-img$(EXESUF) |
19 | 18 | ifdef CONFIG_STATIC |
20 | -LDFLAGS+=-static | |
19 | +BASE_LDFLAGS += -static | |
21 | 20 | endif |
22 | 21 | ifdef BUILD_DOCS |
23 | 22 | DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 |
... | ... | @@ -41,10 +40,10 @@ subdir-%: dyngen$(EXESUF) |
41 | 40 | recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) |
42 | 41 | |
43 | 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 | 45 | dyngen$(EXESUF): dyngen.c |
47 | - $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^ | |
46 | + $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ | |
48 | 47 | |
49 | 48 | clean: |
50 | 49 | # avoid old build problems by removing potentially incorrect old files | ... | ... |
Makefile.target
... | ... | @@ -12,14 +12,14 @@ TARGET_BASE_ARCH:=sparc |
12 | 12 | endif |
13 | 13 | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) |
14 | 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 | 16 | ifdef CONFIG_USER_ONLY |
17 | 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 | 19 | endif |
20 | -CFLAGS=-Wall -O2 -g -fno-strict-aliasing | |
20 | +BASE_CFLAGS= | |
21 | +BASE_LDFLAGS= | |
21 | 22 | #CFLAGS+=-Werror |
22 | -LDFLAGS=-g | |
23 | 23 | LIBS= |
24 | 24 | HELPER_CFLAGS=$(CFLAGS) |
25 | 25 | DYNGEN=../dyngen$(EXESUF) |
... | ... | @@ -62,18 +62,20 @@ endif |
62 | 62 | endif # !CONFIG_USER_ONLY |
63 | 63 | |
64 | 64 | ifdef CONFIG_STATIC |
65 | -LDFLAGS+=-static | |
65 | +BASE_LDFLAGS+=-static | |
66 | 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 | 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 | 74 | ifeq ($(HAVE_GCC3_OPTIONS),yes) |
72 | 75 | OP_CFLAGS+= -falign-functions=0 -fno-gcse |
73 | 76 | else |
74 | 77 | OP_CFLAGS+= -malign-functions=0 |
75 | 78 | endif |
76 | - | |
77 | 79 | ifdef TARGET_GPROF |
78 | 80 | USE_I386_LD=y |
79 | 81 | endif |
... | ... | @@ -81,76 +83,76 @@ ifdef CONFIG_STATIC |
81 | 83 | USE_I386_LD=y |
82 | 84 | endif |
83 | 85 | ifdef USE_I386_LD |
84 | -LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld | |
86 | +BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
85 | 87 | else |
86 | 88 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object |
87 | 89 | # that the kernel ELF loader considers as an executable. I think this |
88 | 90 | # is the simplest way to make it self virtualizable! |
89 | -LDFLAGS+=-Wl,-shared | |
91 | +BASE_LDFLAGS+=-Wl,-shared | |
90 | 92 | endif |
91 | 93 | endif |
92 | 94 | |
93 | 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 | 97 | endif |
97 | 98 | |
98 | 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 | 102 | endif |
103 | 103 | |
104 | 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 | 106 | endif |
108 | 107 | |
109 | 108 | ifeq ($(ARCH),sparc) |
110 | 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 | 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 | 117 | HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat |
119 | 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 | 120 | endif |
122 | 121 | endif |
123 | 122 | |
124 | 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 | 128 | endif |
130 | 129 | |
131 | 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 | 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 | 136 | endif |
139 | 137 | |
140 | 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 | 142 | endif |
145 | 143 | |
146 | 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 | 147 | endif |
150 | 148 | |
151 | 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 | 156 | endif |
155 | 157 | |
156 | 158 | ifeq ($(HAVE_GCC3_OPTIONS),yes) |
... | ... | @@ -159,13 +161,14 @@ OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls |
159 | 161 | endif |
160 | 162 | |
161 | 163 | ifeq ($(CONFIG_DARWIN),yes) |
162 | -OP_CFLAGS+= -mdynamic-no-pic | |
163 | 164 | LIBS+=-lmx |
164 | 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 | 172 | LIBS+=-lm |
170 | 173 | ifndef CONFIG_USER_ONLY |
171 | 174 | LIBS+=-lz |
... | ... | @@ -179,8 +182,8 @@ endif |
179 | 182 | |
180 | 183 | # profiling code |
181 | 184 | ifdef TARGET_GPROF |
182 | -LDFLAGS+=-p | |
183 | -main.o: CFLAGS+=-p | |
185 | +BASE_LDFLAGS+=-p | |
186 | +main.o: BASE_CFLAGS+=-p | |
184 | 187 | endif |
185 | 188 | |
186 | 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 | 214 | else |
212 | 215 | LIBOBJS+=fpu/softfloat-native.o |
213 | 216 | endif |
214 | -DEFINES+=-I$(SRC_PATH)/fpu | |
217 | +CPPFLAGS+=-I$(SRC_PATH)/fpu | |
215 | 218 | |
216 | 219 | ifeq ($(TARGET_ARCH), i386) |
217 | 220 | LIBOBJS+=helper.o helper2.o |
... | ... | @@ -288,7 +291,7 @@ endif |
288 | 291 | all: $(PROGS) |
289 | 292 | |
290 | 293 | $(QEMU_USER): $(OBJS) |
291 | - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) | |
294 | + $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ $(LIBS) | |
292 | 295 | ifeq ($(ARCH),alpha) |
293 | 296 | # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of |
294 | 297 | # the address space (31 bit so sign extending doesn't matter) |
... | ... | @@ -324,7 +327,7 @@ LIBS += -lole32 -ldxguid |
324 | 327 | endif |
325 | 328 | ifdef CONFIG_FMOD |
326 | 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 | 331 | LIBS += $(CONFIG_FMOD_LIB) |
329 | 332 | endif |
330 | 333 | ifdef CONFIG_ADLIB |
... | ... | @@ -347,14 +350,14 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) |
347 | 350 | VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o |
348 | 351 | VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o |
349 | 352 | VL_OBJS+= usb-uhci.o |
350 | -DEFINES += -DHAS_AUDIO | |
353 | +CPPFLAGS += -DHAS_AUDIO | |
351 | 354 | endif |
352 | 355 | ifeq ($(TARGET_BASE_ARCH), ppc) |
353 | 356 | VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) |
354 | 357 | VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o |
355 | 358 | VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o |
356 | 359 | VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o |
357 | -DEFINES += -DHAS_AUDIO | |
360 | +CPPFLAGS += -DHAS_AUDIO | |
358 | 361 | endif |
359 | 362 | ifeq ($(TARGET_ARCH), mips) |
360 | 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 | 398 | endif |
396 | 399 | endif |
397 | 400 | ifdef CONFIG_SLIRP |
398 | -DEFINES+=-I$(SRC_PATH)/slirp | |
401 | +CPPFLAGS+=-I$(SRC_PATH)/slirp | |
399 | 402 | SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ |
400 | 403 | slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ |
401 | 404 | tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o |
... | ... | @@ -418,7 +421,7 @@ endif |
418 | 421 | endif |
419 | 422 | endif |
420 | 423 | ifdef TARGET_GPROF |
421 | -vl.o: CFLAGS+=-p | |
424 | +vl.o: BASE_CFLAGS+=-p | |
422 | 425 | VL_LDFLAGS+=-p |
423 | 426 | endif |
424 | 427 | |
... | ... | @@ -439,22 +442,22 @@ $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a |
439 | 442 | $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) |
440 | 443 | |
441 | 444 | cocoa.o: cocoa.m |
442 | - $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< | |
445 | + $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
443 | 446 | |
444 | 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 | 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 | 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 | 456 | depend: $(SRCS) |
454 | - $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend | |
457 | + $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend | |
455 | 458 | |
456 | 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 | 462 | # libqemu |
460 | 463 | |
... | ... | @@ -478,26 +481,26 @@ gen-op.h: op.o $(DYNGEN) |
478 | 481 | $(DYNGEN) -g -o $@ $< |
479 | 482 | |
480 | 483 | op.o: op.c |
481 | - $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< | |
484 | + $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $< | |
482 | 485 | |
483 | 486 | # HELPER_CFLAGS is used for all the code compiled with static register |
484 | 487 | # variables |
485 | 488 | ifeq ($(TARGET_BASE_ARCH), i386) |
486 | 489 | # XXX: rename helper.c to op_helper.c |
487 | 490 | helper.o: helper.c |
488 | - $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< | |
491 | + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
489 | 492 | else |
490 | 493 | op_helper.o: op_helper.c |
491 | - $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< | |
494 | + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
492 | 495 | endif |
493 | 496 | |
494 | 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 | 500 | # Note: this is a workaround. The real fix is to avoid compiling |
498 | 501 | # cpu_signal_handler() in cpu-exec.c. |
499 | 502 | signal.o: signal.c |
500 | - $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< | |
503 | + $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
501 | 504 | |
502 | 505 | ifeq ($(TARGET_BASE_ARCH), i386) |
503 | 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 | 542 | $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h |
540 | 543 | |
541 | 544 | %.o: %.c |
542 | - $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< | |
545 | + $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
543 | 546 | |
544 | 547 | %.o: %.S |
545 | - $(CC) $(DEFINES) -c -o $@ $< | |
548 | + $(CC) $(CPPFLAGS) -c -o $@ $< | |
546 | 549 | |
547 | 550 | clean: |
548 | 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 | 103 | case $targetos in |
104 | 104 | CYGWIN*) |
105 | 105 | mingw32="yes" |
106 | -CFLAGS="-O2 -mno-cygwin" | |
106 | +OS_CFLAGS="-mno-cygwin" | |
107 | 107 | ;; |
108 | 108 | MINGW32*) |
109 | 109 | mingw32="yes" |
... | ... | @@ -126,6 +126,7 @@ oss="yes" |
126 | 126 | Darwin) |
127 | 127 | bsd="yes" |
128 | 128 | darwin="yes" |
129 | +OS_CFLAGS="-mdynamic-no-pic" | |
129 | 130 | ;; |
130 | 131 | SunOS) |
131 | 132 | solaris="yes" |
... | ... | @@ -243,6 +244,10 @@ for opt do |
243 | 244 | esac |
244 | 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 | 251 | if test x"$show_help" = x"yes" ; then |
247 | 252 | cat << EOF |
248 | 253 | |
... | ... | @@ -605,6 +610,7 @@ fi |
605 | 610 | echo "HOST_CC=$host_cc" >> $config_mak |
606 | 611 | echo "AR=$ar" >> $config_mak |
607 | 612 | echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak |
613 | +echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak | |
608 | 614 | echo "CFLAGS=$CFLAGS" >> $config_mak |
609 | 615 | echo "LDFLAGS=$LDFLAGS" >> $config_mak |
610 | 616 | echo "EXESUF=$EXESUF" >> $config_mak | ... | ... |