Skip to content

Commit

Permalink
Rename CPPFLAGS to QEMU_CFLAGS
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
Message-Id:
  • Loading branch information
Juan Quintela authored and Anthony Liguori committed Aug 10, 2009
1 parent edc0edf commit a558ee1
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 77 deletions.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ endif

VPATH=$(SRC_PATH):$(SRC_PATH)/hw

CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
CPPFLAGS += -U_FORTIFY_SOURCE
QEMU_CFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
QEMU_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
QEMU_CFLAGS += -U_FORTIFY_SOURCE
LIBS+=-lz

ifdef BUILD_DOCS
Expand Down Expand Up @@ -105,7 +105,7 @@ ifdef CONFIG_COREAUDIO
AUDIO_PT = y
endif
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
ifdef CONFIG_ESD
AUDIO_PT = y
Expand Down Expand Up @@ -142,7 +142,7 @@ obj-$(CONFIG_COCOA) += cocoa.o
obj-$(CONFIG_IOTHREAD) += qemu-thread.o

ifdef CONFIG_SLIRP
CPPFLAGS+=-I$(SRC_PATH)/slirp
QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
endif

slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
Expand All @@ -156,7 +156,7 @@ LIBS+=$(VDE_LIBS)
obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.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)

cocoa.o: cocoa.m
Expand All @@ -167,15 +167,15 @@ 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 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

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: CFLAGS += $(VNC_TLS_CFLAGS)
vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)

vnc-tls.o: vnc-tls.c vnc.h

Expand All @@ -185,7 +185,7 @@ vnc-auth-sasl.o: vnc-auth-sasl.c vnc.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)

Expand Down
6 changes: 3 additions & 3 deletions Makefile.hw
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ include $(SRC_PATH)/rules.mak

VPATH=$(SRC_PATH):$(SRC_PATH)/hw

CPPFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@
CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
CPPFLAGS+=-I$(SRC_PATH)/fpu
QEMU_CFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@
QEMU_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
QEMU_CFLAGS+=-I$(SRC_PATH)/fpu

obj-y =
obj-y += virtio.o virtio-pci.o
Expand Down
64 changes: 32 additions & 32 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include $(SRC_PATH)/rules.mak

TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
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
# user emulator name
Expand All @@ -26,7 +26,7 @@ HELPER_CFLAGS+=-fomit-frame-pointer
endif

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

ifeq ($(ARCH),sparc)
Expand All @@ -37,26 +37,26 @@ endif

ifeq ($(ARCH),alpha)
# Ensure there's only a single GP
CFLAGS+=-msmall-data
QEMU_CFLAGS+=-msmall-data
endif

ifeq ($(ARCH),ia64)
CFLAGS+=-mno-sdata
QEMU_CFLAGS+=-mno-sdata
endif

CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
CPPFLAGS+=-U_FORTIFY_SOURCE
QEMU_CFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
QEMU_CFLAGS+=-U_FORTIFY_SOURCE
LIBS+=-lm
ifdef CONFIG_SOLARIS
ifdef CONFIG_NEEDS_LIBSUNMATH
LIBS+=-lsunmath
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

kvm.o: CFLAGS+=$(KVM_CFLAGS)
kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
kvm.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
kvm-all.o: QEMU_CFLAGS+=$(KVM_CFLAGS)

all: $(PROGS)
# Dummy command so that make thinks it has done something
Expand All @@ -68,16 +68,16 @@ libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o
libobj-$(CONFIG_KQEMU) += kqemu.o
# TCG code generator
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)
CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
QEMU_CFLAGS+=-I$(SRC_PATH)/tcg/sparc
endif
ifdef CONFIG_SOFTFLOAT
libobj-y += fpu/softfloat.o
else
libobj-y += fpu/softfloat-native.o
endif
CPPFLAGS+=-I$(SRC_PATH)/fpu
QEMU_CFLAGS+=-I$(SRC_PATH)/fpu
libobj-y += op_helper.o helper.o

ifeq ($(TARGET_BASE_ARCH), arm)
Expand Down Expand Up @@ -151,22 +151,22 @@ tcg/tcg.o: cpu.h

# HELPER_CFLAGS is used for all the code compiled with static register
# 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

ifdef CONFIG_LINUX_USER

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
ifdef TARGET_GPROF
LDFLAGS+=-p
CFLAGS+=-p
QEMU_CFLAGS+=-p
endif

obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
Expand All @@ -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
# cpu_signal_handler() in cpu-exec.c.
signal.o: CFLAGS += $(HELPER_CFLAGS)
signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)

ARLIBS=../libqemu_user.a libqemu.a
endif #CONFIG_LINUX_USER
Expand All @@ -203,7 +203,7 @@ endif #CONFIG_LINUX_USER
ifdef CONFIG_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
LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
Expand All @@ -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
# cpu_signal_handler() in cpu-exec.c.
signal.o: CFLAGS += $(HELPER_CFLAGS)
signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)

ARLIBS=libqemu.a

Expand All @@ -227,15 +227,15 @@ endif #CONFIG_DARWIN_USER
ifdef CONFIG_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 \
gdbstub.o gdbstub-xml.o ioport-user.o
obj-y += uaccess.o

# Note: this is a workaround. The real fix is to avoid compiling
# cpu_signal_handler() in cpu-exec.c.
signal.o: CFLAGS += $(HELPER_CFLAGS)
signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)

ARLIBS=libqemu.a ../libqemu_user.a

Expand Down Expand Up @@ -281,16 +281,16 @@ sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
sound-obj-$(CONFIG_CS4231A) += cs4231a.o

ifdef CONFIG_ADLIB
adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
adlib.o fmopl.o: QEMU_CFLAGS := ${QEMU_CFLAGS} -DBUILD_Y8950=0
endif

ifdef CONFIG_VNC_TLS
CPPFLAGS += $(VNC_TLS_CFLAGS)
QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
LIBS += $(VNC_TLS_LIBS)
endif

ifdef CONFIG_VNC_SASL
CPPFLAGS += $(VNC_SASL_CFLAGS)
QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
LIBS += $(VNC_SASL_LIBS)
endif

Expand Down Expand Up @@ -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

ifeq ($(TARGET_BASE_ARCH), i386)
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
endif

# shared objects
Expand All @@ -347,7 +347,7 @@ obj-ppc-y += ppce500_pci.o ppce500_mpc8544ds.o
obj-ppc-$(CONFIG_KVM) += kvm_ppc.o

ifeq ($(TARGET_BASE_ARCH), ppc)
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
endif

obj-ppc-$(CONFIG_FDT) += device_tree.o
Expand All @@ -363,7 +363,7 @@ obj-mips-y += pflash_cfi01.o
obj-mips-y += vmware_vga.o

ifeq ($(TARGET_BASE_ARCH), mips)
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
endif

obj-microblaze-y = petalogix_s3adsp1800_mmu.o
Expand Down Expand Up @@ -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

ifeq ($(TARGET_BASE_ARCH), arm)
CPPFLAGS += -DHAS_AUDIO
QEMU_CFLAGS += -DHAS_AUDIO
endif

obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
Expand All @@ -441,7 +441,7 @@ COCOA_LIBS+=-framework CoreAudio
endif
endif
ifdef CONFIG_SLIRP
CPPFLAGS+=-I$(SRC_PATH)/slirp
QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
endif

# specific flags are needed for non soft mmu emulator
Expand All @@ -455,7 +455,7 @@ endif
endif
endif
ifdef TARGET_GPROF
vl.o: CFLAGS+=-p
vl.o: QEMU_CFLAGS+=-p
LDFLAGS+=-p
endif

Expand All @@ -470,10 +470,10 @@ endif
# profiling code
ifdef TARGET_GPROF
LDFLAGS+=-p
main.o: CFLAGS+=-p
main.o: QEMU_CFLAGS+=-p
endif

vl.o: CFLAGS+=$(SDL_CFLAGS)
vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)

vl.o: qemu-options.h

Expand Down
Loading

0 comments on commit a558ee1

Please sign in to comment.