From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH kvm-unit-tests] build: don't reevaluate cc-option shell command Date: Mon, 14 Mar 2016 15:03:44 +0100 Message-ID: <56E6C4C0.2060106@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit To: Peter Feiner , drjones@redhat.com, kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40550 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755440AbcCNODs (ORCPT ); Mon, 14 Mar 2016 10:03:48 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 12/03/2016 01:21, Peter Feiner wrote: > Make was reevaluating the shell commands in CFLAGS for every recipe > because CFLAGS was defined as a recursively-expanded variable. Doing a > simple expansion before putting the command output in CFLAGS prevents > this reevaluation. > > The difference this change makes for the x86 build is stark: > > BEFORE: > make -j 6.17s user 5.74s system 167% cpu 7.117 total > make 6.52s user 5.70s system 89% cpu 13.664 total > > AFTER: > make -j 4.03s user 1.47s system 1036% cpu 0.530 total > make 3.69s user 2.16s system 92% cpu 6.310 total > > Signed-off-by: Peter Feiner > --- > Makefile | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/Makefile b/Makefile > index 09999c6..2a2d942 100644 > --- a/Makefile > +++ b/Makefile > @@ -42,9 +42,13 @@ cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ > > CFLAGS += -g > CFLAGS += $(autodepend-flags) -Wall -Werror > -CFLAGS += $(call cc-option, -fomit-frame-pointer, "") > -CFLAGS += $(call cc-option, -fno-stack-protector, "") > -CFLAGS += $(call cc-option, -fno-stack-protector-all, "") > + > +fomit_frame_pointer := $(call cc-option, -fomit-frame-pointer, "") > +fnostack_protector := $(call cc-option, -fno-stack-protector, "") > +fnostack_protector_all := $(call cc-option, -fno-stack-protector-all, "") > +CFLAGS += $(fomit_frame_pointer) > +CFLAGS += $(fno_stack_protector) > +CFLAGS += $(fno_stack_protector_all) > > CXXFLAGS += $(CFLAGS) > > Thanks, looks good. Paolo