Rename CPPFLAGS to QEMU_CFLAGS

Now we have to variables: QEMU_CFLAGS: flags without which we can't compile
CFLAGS: "-g -O2"

We can now run:

make CFLAGS="-fbar" foo.o
make CFLAGS="" foo.o
make CFLAGS="-O3" foo.o

And it all should work.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-Id:
This commit is contained in:
Juan Quintela 2009-08-03 14:46:21 +02:00 committed by Anthony Liguori
parent edc0edf0c6
commit a558ee1776
6 changed files with 80 additions and 77 deletions

View File

@ -16,9 +16,9 @@ endif
VPATH=$(SRC_PATH):$(SRC_PATH)/hw VPATH=$(SRC_PATH):$(SRC_PATH)/hw
CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@ QEMU_CFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE QEMU_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
CPPFLAGS += -U_FORTIFY_SOURCE QEMU_CFLAGS += -U_FORTIFY_SOURCE
LIBS+=-lz LIBS+=-lz
ifdef BUILD_DOCS ifdef BUILD_DOCS
@ -105,7 +105,7 @@ ifdef CONFIG_COREAUDIO
AUDIO_PT = y AUDIO_PT = y
endif endif
ifdef CONFIG_FMOD ifdef CONFIG_FMOD
audio/audio.o audio/fmodaudio.o: CPPFLAGS := $(FMOD_CFLAGS) $(CPPFLAGS) audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS := $(FMOD_CFLAGS) $(QEMU_CFLAGS)
endif endif
ifdef CONFIG_ESD ifdef CONFIG_ESD
AUDIO_PT = y AUDIO_PT = y
@ -142,7 +142,7 @@ obj-$(CONFIG_COCOA) += cocoa.o
obj-$(CONFIG_IOTHREAD) += qemu-thread.o obj-$(CONFIG_IOTHREAD) += qemu-thread.o
ifdef CONFIG_SLIRP ifdef CONFIG_SLIRP
CPPFLAGS+=-I$(SRC_PATH)/slirp QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
endif endif
slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
@ -156,7 +156,7 @@ LIBS+=$(VDE_LIBS)
obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
CPPFLAGS+=$(CURL_CFLAGS) QEMU_CFLAGS+=$(CURL_CFLAGS)
LIBS+=$(CURL_LIBS) LIBS+=$(CURL_LIBS)
cocoa.o: cocoa.m cocoa.o: cocoa.m
@ -167,7 +167,7 @@ sdl_zoom.o: sdl_zoom.c sdl_zoom.h sdl_zoom_template.h
sdl.o: sdl.c keymaps.h sdl_keysym.h sdl_zoom.h sdl.o: sdl.c keymaps.h sdl_keysym.h sdl_zoom.h
sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: CFLAGS += $(SDL_CFLAGS) sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
acl.o: acl.h acl.c acl.o: acl.h acl.c
@ -175,7 +175,7 @@ vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
vnc.o: CFLAGS += $(VNC_TLS_CFLAGS) vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
vnc-tls.o: vnc-tls.c vnc.h vnc-tls.o: vnc-tls.c vnc.h
@ -185,7 +185,7 @@ vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
curses.o: curses.c keymaps.h curses_keys.h curses.o: curses.c keymaps.h curses_keys.h
bt-host.o: CFLAGS += $(BLUEZ_CFLAGS) bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
libqemu_common.a: $(obj-y) libqemu_common.a: $(obj-y)

View File

@ -8,9 +8,9 @@ include $(SRC_PATH)/rules.mak
VPATH=$(SRC_PATH):$(SRC_PATH)/hw VPATH=$(SRC_PATH):$(SRC_PATH)/hw
CPPFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@ QEMU_CFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@
CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE QEMU_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
CPPFLAGS+=-I$(SRC_PATH)/fpu QEMU_CFLAGS+=-I$(SRC_PATH)/fpu
obj-y = obj-y =
obj-y += virtio.o virtio-pci.o obj-y += virtio.o virtio-pci.o

View File

@ -3,7 +3,7 @@ include $(SRC_PATH)/rules.mak
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H QEMU_CFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
ifdef CONFIG_USER_ONLY ifdef CONFIG_USER_ONLY
# user emulator name # user emulator name
@ -26,7 +26,7 @@ HELPER_CFLAGS+=-fomit-frame-pointer
endif endif
ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc) ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
translate.o: CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-unit-at-a-time,) translate.o: QEMU_CFLAGS := $(QEMU_CFLAGS) $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)
endif endif
ifeq ($(ARCH),sparc) ifeq ($(ARCH),sparc)
@ -37,26 +37,26 @@ endif
ifeq ($(ARCH),alpha) ifeq ($(ARCH),alpha)
# Ensure there's only a single GP # Ensure there's only a single GP
CFLAGS+=-msmall-data QEMU_CFLAGS+=-msmall-data
endif endif
ifeq ($(ARCH),ia64) ifeq ($(ARCH),ia64)
CFLAGS+=-mno-sdata QEMU_CFLAGS+=-mno-sdata
endif endif
CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE QEMU_CFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
CPPFLAGS+=-U_FORTIFY_SOURCE QEMU_CFLAGS+=-U_FORTIFY_SOURCE
LIBS+=-lm LIBS+=-lm
ifdef CONFIG_SOLARIS ifdef CONFIG_SOLARIS
ifdef CONFIG_NEEDS_LIBSUNMATH ifdef CONFIG_NEEDS_LIBSUNMATH
LIBS+=-lsunmath LIBS+=-lsunmath
LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
CFLAGS+=-I/opt/SUNWspro/prod/include/cc QEMU_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
endif endif
endif endif
kvm.o: CFLAGS+=$(KVM_CFLAGS) kvm.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
kvm-all.o: CFLAGS+=$(KVM_CFLAGS) kvm-all.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
all: $(PROGS) all: $(PROGS)
# Dummy command so that make thinks it has done something # Dummy command so that make thinks it has done something
@ -68,16 +68,16 @@ libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o
libobj-$(CONFIG_KQEMU) += kqemu.o libobj-$(CONFIG_KQEMU) += kqemu.o
# TCG code generator # TCG code generator
libobj-y += tcg/tcg.o tcg/tcg-runtime.o libobj-y += tcg/tcg.o tcg/tcg-runtime.o
CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) QEMU_CFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
ifeq ($(ARCH),sparc64) ifeq ($(ARCH),sparc64)
CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc QEMU_CFLAGS+=-I$(SRC_PATH)/tcg/sparc
endif endif
ifdef CONFIG_SOFTFLOAT ifdef CONFIG_SOFTFLOAT
libobj-y += fpu/softfloat.o libobj-y += fpu/softfloat.o
else else
libobj-y += fpu/softfloat-native.o libobj-y += fpu/softfloat-native.o
endif endif
CPPFLAGS+=-I$(SRC_PATH)/fpu QEMU_CFLAGS+=-I$(SRC_PATH)/fpu
libobj-y += op_helper.o helper.o libobj-y += op_helper.o helper.o
ifeq ($(TARGET_BASE_ARCH), arm) ifeq ($(TARGET_BASE_ARCH), arm)
@ -151,9 +151,9 @@ tcg/tcg.o: cpu.h
# HELPER_CFLAGS is used for all the code compiled with static register # HELPER_CFLAGS is used for all the code compiled with static register
# variables # variables
op_helper.o: CFLAGS += $(HELPER_CFLAGS) op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
cpu-exec.o: CFLAGS += $(HELPER_CFLAGS) cpu-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
######################################################### #########################################################
# Linux user emulator target # Linux user emulator target
@ -161,12 +161,12 @@ cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
ifdef CONFIG_LINUX_USER ifdef CONFIG_LINUX_USER
VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
# profiling code # profiling code
ifdef TARGET_GPROF ifdef TARGET_GPROF
LDFLAGS+=-p LDFLAGS+=-p
CFLAGS+=-p QEMU_CFLAGS+=-p
endif endif
obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \ obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
@ -192,7 +192,7 @@ obj-m68k-y += m68k-sim.o m68k-semi.o
# Note: this is a workaround. The real fix is to avoid compiling # Note: this is a workaround. The real fix is to avoid compiling
# cpu_signal_handler() in cpu-exec.c. # cpu_signal_handler() in cpu-exec.c.
signal.o: CFLAGS += $(HELPER_CFLAGS) signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
ARLIBS=../libqemu_user.a libqemu.a ARLIBS=../libqemu_user.a libqemu.a
endif #CONFIG_LINUX_USER endif #CONFIG_LINUX_USER
@ -203,7 +203,7 @@ endif #CONFIG_LINUX_USER
ifdef CONFIG_DARWIN_USER ifdef CONFIG_DARWIN_USER
VPATH+=:$(SRC_PATH)/darwin-user VPATH+=:$(SRC_PATH)/darwin-user
CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) QEMU_CFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
# Leave some space for the regular program loading zone # Leave some space for the regular program loading zone
LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
@ -215,7 +215,7 @@ obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
# Note: this is a workaround. The real fix is to avoid compiling # Note: this is a workaround. The real fix is to avoid compiling
# cpu_signal_handler() in cpu-exec.c. # cpu_signal_handler() in cpu-exec.c.
signal.o: CFLAGS += $(HELPER_CFLAGS) signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
ARLIBS=libqemu.a ARLIBS=libqemu.a
@ -227,7 +227,7 @@ endif #CONFIG_DARWIN_USER
ifdef CONFIG_BSD_USER ifdef CONFIG_BSD_USER
VPATH+=:$(SRC_PATH)/bsd-user VPATH+=:$(SRC_PATH)/bsd-user
CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \ obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
gdbstub.o gdbstub-xml.o ioport-user.o gdbstub.o gdbstub-xml.o ioport-user.o
@ -235,7 +235,7 @@ obj-y += uaccess.o
# Note: this is a workaround. The real fix is to avoid compiling # Note: this is a workaround. The real fix is to avoid compiling
# cpu_signal_handler() in cpu-exec.c. # cpu_signal_handler() in cpu-exec.c.
signal.o: CFLAGS += $(HELPER_CFLAGS) signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
ARLIBS=libqemu.a ../libqemu_user.a ARLIBS=libqemu.a ../libqemu_user.a
@ -281,16 +281,16 @@ sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
sound-obj-$(CONFIG_CS4231A) += cs4231a.o sound-obj-$(CONFIG_CS4231A) += cs4231a.o
ifdef CONFIG_ADLIB ifdef CONFIG_ADLIB
adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0 adlib.o fmopl.o: QEMU_CFLAGS := ${QEMU_CFLAGS} -DBUILD_Y8950=0
endif endif
ifdef CONFIG_VNC_TLS ifdef CONFIG_VNC_TLS
CPPFLAGS += $(VNC_TLS_CFLAGS) QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
LIBS += $(VNC_TLS_LIBS) LIBS += $(VNC_TLS_LIBS)
endif endif
ifdef CONFIG_VNC_SASL ifdef CONFIG_VNC_SASL
CPPFLAGS += $(VNC_SASL_CFLAGS) QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
LIBS += $(VNC_SASL_LIBS) LIBS += $(VNC_SASL_LIBS)
endif endif
@ -325,7 +325,7 @@ obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o
ifeq ($(TARGET_BASE_ARCH), i386) ifeq ($(TARGET_BASE_ARCH), i386)
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
endif endif
# shared objects # shared objects
@ -347,7 +347,7 @@ obj-ppc-y += ppce500_pci.o ppce500_mpc8544ds.o
obj-ppc-$(CONFIG_KVM) += kvm_ppc.o obj-ppc-$(CONFIG_KVM) += kvm_ppc.o
ifeq ($(TARGET_BASE_ARCH), ppc) ifeq ($(TARGET_BASE_ARCH), ppc)
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
endif endif
obj-ppc-$(CONFIG_FDT) += device_tree.o obj-ppc-$(CONFIG_FDT) += device_tree.o
@ -363,7 +363,7 @@ obj-mips-y += pflash_cfi01.o
obj-mips-y += vmware_vga.o obj-mips-y += vmware_vga.o
ifeq ($(TARGET_BASE_ARCH), mips) ifeq ($(TARGET_BASE_ARCH), mips)
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
endif endif
obj-microblaze-y = petalogix_s3adsp1800_mmu.o obj-microblaze-y = petalogix_s3adsp1800_mmu.o
@ -424,7 +424,7 @@ obj-arm-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
obj-arm-y += syborg_virtio.o obj-arm-y += syborg_virtio.o
ifeq ($(TARGET_BASE_ARCH), arm) ifeq ($(TARGET_BASE_ARCH), arm)
CPPFLAGS += -DHAS_AUDIO QEMU_CFLAGS += -DHAS_AUDIO
endif endif
obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
@ -441,7 +441,7 @@ COCOA_LIBS+=-framework CoreAudio
endif endif
endif endif
ifdef CONFIG_SLIRP ifdef CONFIG_SLIRP
CPPFLAGS+=-I$(SRC_PATH)/slirp QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
endif endif
# specific flags are needed for non soft mmu emulator # specific flags are needed for non soft mmu emulator
@ -455,7 +455,7 @@ endif
endif endif
endif endif
ifdef TARGET_GPROF ifdef TARGET_GPROF
vl.o: CFLAGS+=-p vl.o: QEMU_CFLAGS+=-p
LDFLAGS+=-p LDFLAGS+=-p
endif endif
@ -470,10 +470,10 @@ endif
# profiling code # profiling code
ifdef TARGET_GPROF ifdef TARGET_GPROF
LDFLAGS+=-p LDFLAGS+=-p
main.o: CFLAGS+=-p main.o: QEMU_CFLAGS+=-p
endif endif
vl.o: CFLAGS+=$(SDL_CFLAGS) vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
vl.o: qemu-options.h vl.o: qemu-options.h

57
configure vendored
View File

@ -18,13 +18,13 @@ TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
trap "rm -f $TMPC $TMPO $TMPE ; exit" 0 2 3 15 trap "rm -f $TMPC $TMPO $TMPE ; exit" 0 2 3 15
compile_object() { compile_object() {
$cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null $cc $QEMU_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
} }
compile_prog() { compile_prog() {
local_cflags="$1" local_cflags="$1"
local_ldflags="$2" local_ldflags="$2"
$cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
} }
# default parameters # default parameters
@ -55,7 +55,7 @@ for opt do
;; ;;
--cpu=*) cpu="$optarg" --cpu=*) cpu="$optarg"
;; ;;
--extra-cflags=*) CFLAGS="$optarg $CFLAGS" --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
;; ;;
--extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
;; ;;
@ -224,7 +224,7 @@ fi
case $targetos in case $targetos in
CYGWIN*) CYGWIN*)
mingw32="yes" mingw32="yes"
CFLAGS="-mno-cygwin $CFLAGS" QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
audio_possible_drivers="sdl" audio_possible_drivers="sdl"
;; ;;
MINGW32*) MINGW32*)
@ -277,10 +277,10 @@ Darwin)
[ "$is_x86_64" = "1" ] && cpu=x86_64 [ "$is_x86_64" = "1" ] && cpu=x86_64
fi fi
if [ "$cpu" = "x86_64" ] ; then if [ "$cpu" = "x86_64" ] ; then
CFLAGS="-arch x86_64 $CFLAGS" QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
LDFLAGS="-arch x86_64 $LDFLAGS" LDFLAGS="-arch x86_64 $LDFLAGS"
else else
CFLAGS="-mdynamic-no-pic $CFLAGS" QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
fi fi
darwin_user="yes" darwin_user="yes"
cocoa="yes" cocoa="yes"
@ -320,7 +320,7 @@ SunOS)
audio_drv_list="oss" audio_drv_list="oss"
fi fi
audio_possible_drivers="oss sdl" audio_possible_drivers="oss sdl"
CFLAGS="-std=gnu99 $CFLAGS" QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
LIBS="-lsocket -lnsl -lresolv $LIBS" LIBS="-lsocket -lnsl -lresolv $LIBS"
;; ;;
AIX) AIX)
@ -354,7 +354,7 @@ if test "$mingw32" = "yes" ; then
kqemu="yes" kqemu="yes"
fi fi
EXESUF=".exe" EXESUF=".exe"
CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $CFLAGS" QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
fi fi
@ -515,44 +515,44 @@ done
# #
# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
# CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
# #
host_guest_base="no" host_guest_base="no"
case "$cpu" in case "$cpu" in
sparc) case $sparc_cpu in sparc) case $sparc_cpu in
v7|v8) v7|v8)
CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $CFLAGS" QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
;; ;;
v8plus|v8plusa) v8plus|v8plusa)
CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS" QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
;; ;;
*) # sparc_cpu not defined in the command line *) # sparc_cpu not defined in the command line
CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $CFLAGS" QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
esac esac
LDFLAGS="-m32 $LDFLAGS" LDFLAGS="-m32 $LDFLAGS"
CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $CFLAGS" QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
if test "$solaris" = "no" ; then if test "$solaris" = "no" ; then
CFLAGS="-ffixed-g1 -ffixed-g6 $CFLAGS" QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
fi fi
;; ;;
sparc64) sparc64)
CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $CFLAGS" QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
LDFLAGS="-m64 $LDFLAGS" LDFLAGS="-m64 $LDFLAGS"
CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $CFLAGS" QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
if test "$solaris" != "no" ; then if test "$solaris" != "no" ; then
CFLAGS="-ffixed-g1 $CFLAGS" QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
fi fi
;; ;;
s390) s390)
CFLAGS="-march=z900 $CFLAGS" QEMU_CFLAGS="-march=z900 $QEMU_CFLAGS"
;; ;;
i386) i386)
CFLAGS="-m32 $CFLAGS" QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
LDFLAGS="-m32 $LDFLAGS" LDFLAGS="-m32 $LDFLAGS"
host_guest_base="yes" host_guest_base="yes"
;; ;;
x86_64) x86_64)
CFLAGS="-m64 $CFLAGS" QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
LDFLAGS="-m64 $LDFLAGS" LDFLAGS="-m64 $LDFLAGS"
host_guest_base="yes" host_guest_base="yes"
;; ;;
@ -588,7 +588,7 @@ echo " --source-path=PATH path of source code [$source_path]"
echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
echo " --cc=CC use C compiler CC [$cc]" echo " --cc=CC use C compiler CC [$cc]"
echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
echo " --extra-cflags=CFLAGS append extra C compiler flags CFLAGS" echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
echo " --make=MAKE use specified make [$make]" echo " --make=MAKE use specified make [$make]"
echo " --install=INSTALL use specified install [$install]" echo " --install=INSTALL use specified install [$install]"
@ -1131,7 +1131,7 @@ EOF
kvm="no"; kvm="no";
if [ -x "`which awk 2>/dev/null`" ] && \ if [ -x "`which awk 2>/dev/null`" ] && \
[ -x "`which grep 2>/dev/null`" ]; then [ -x "`which grep 2>/dev/null`" ]; then
kvmerr=`LANG=C $cc $CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \ kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
| grep "error: " \ | grep "error: " \
| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
if test "$kvmerr" != "" ; then if test "$kvmerr" != "" ; then
@ -1382,11 +1382,12 @@ fi
# After here, no more $cc or $ld runs # After here, no more $cc or $ld runs
# default flags for all hosts # default flags for all hosts
CFLAGS="-g -fno-strict-aliasing $CFLAGS" QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
CFLAGS="-g $CFLAGS"
if test "$debug" = "no" ; then if test "$debug" = "no" ; then
CFLAGS="-O2 $CFLAGS" CFLAGS="-O2 $CFLAGS"
fi fi
CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls $CFLAGS" QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
LDFLAGS="-g $LDFLAGS" LDFLAGS="-g $LDFLAGS"
# Consult white-list to determine whether to enable werror # Consult white-list to determine whether to enable werror
@ -1402,7 +1403,7 @@ if test -z "$werror" ; then
fi fi
if test "$werror" = "yes" ; then if test "$werror" = "yes" ; then
CFLAGS="-Werror $CFLAGS" QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
fi fi
if test "$solaris" = "no" ; then if test "$solaris" = "no" ; then
@ -1440,6 +1441,7 @@ echo "Source path $source_path"
echo "C compiler $cc" echo "C compiler $cc"
echo "Host C compiler $host_cc" echo "Host C compiler $host_cc"
echo "CFLAGS $CFLAGS" echo "CFLAGS $CFLAGS"
echo "QEMU_CFLAGS $QEMU_CFLAGS"
echo "LDFLAGS $LDFLAGS" echo "LDFLAGS $LDFLAGS"
echo "make $make" echo "make $make"
echo "install $install" echo "install $install"
@ -1740,12 +1742,13 @@ echo "HOST_CC=$host_cc" >> $config_host_mak
if test "$sparse" = "yes" ; then if test "$sparse" = "yes" ; then
echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
fi fi
echo "AR=$ar" >> $config_host_mak echo "AR=$ar" >> $config_host_mak
echo "OBJCOPY=$objcopy" >> $config_host_mak echo "OBJCOPY=$objcopy" >> $config_host_mak
echo "LD=$ld" >> $config_host_mak echo "LD=$ld" >> $config_host_mak
echo "CFLAGS=$CFLAGS" >> $config_host_mak echo "CFLAGS=$CFLAGS" >> $config_host_mak
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
echo "ARLIBS_END=$arlibs_end" >> $config_host_mak echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
@ -2116,5 +2119,5 @@ for hwlib in 32 64; do
rm -f $d/Makefile rm -f $d/Makefile
ln -s $source_path/Makefile.hw $d/Makefile ln -s $source_path/Makefile.hw $d/Makefile
echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
done done

View File

@ -7,9 +7,9 @@ include $(SRC_PATH)/rules.mak
VPATH=$(SRC_PATH)/pc-bios/optionrom VPATH=$(SRC_PATH)/pc-bios/optionrom
CPPFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
CPPFLAGS += -I$(SRC_PATH) CFLAGS += -I$(SRC_PATH)
CPPFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"") CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"")
build-all: multiboot.bin build-all: multiboot.bin

View File

@ -1,12 +1,12 @@
%.o: %.c %.o: %.c
$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@") $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@")
%.o: %.S %.o: %.S
$(call quiet-command,$(CC) $(CPPFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@") $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@")
%.o: %.m %.o: %.m
$(call quiet-command,$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@")
LINK = $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS)," LINK $(TARGET_DIR)$@") LINK = $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS)," LINK $(TARGET_DIR)$@")