[PATCH kvm-unit-tests] build: don't reevaluate cc-option shell command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <pfeiner@xxxxxxxxxx>
---
 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)
 
-- 
2.7.0.rc3.207.g0ac5344

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux