From: Marc-André Lureau Date: Fri, 5 Aug 2016 08:23:46 +0000 (+0400) Subject: build-sys: fix building with make CFLAGS=.. argument X-Git-Tag: v2.7.0-rc3~22^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9c87304b76d1d61687d585516abb4c6e0ae809e;p=thirdparty%2Fqemu.git build-sys: fix building with make CFLAGS=.. argument When calling make with a CFLAGS=.. argument, the -g/-O filter is not applied, which may result with build failure with ASAN for example. It could be solved with an 'override' directive on CFLAGS, but that would actually prevent setting different CFLAGS manually. Instead, filter the CFLAGS argument from the top-level Makefile (so you could still call make with a different CFLAGS argument on a rom/Makefile manually) Signed-off-by: Marc-André Lureau Reviewed-by: Paolo Bonzini Message-Id: <20160805082421.21994-2-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- diff --git a/Makefile b/Makefile index 0d7647f796a..50b4b3afb96 100644 --- a/Makefile +++ b/Makefile @@ -225,8 +225,9 @@ dtc/%: $(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY)) ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS)) +# Only keep -O and -g cflags romsubdir-%: - $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",) + $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",) ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS)) diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile index 24e175e0eb7..6bab4900733 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile @@ -24,8 +24,6 @@ QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -no-integrated-as) QEMU_CFLAGS += -m32 -include $(SRC_PATH)/pc-bios/optionrom/code16gcc.h endif -# Drop gcov and glib flags -CFLAGS := $(filter -O% -g%, $(CFLAGS)) QEMU_INCLUDES += -I$(SRC_PATH) Wa = -Wa,