From patchwork Sat Mar 12 00:21:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Feiner X-Patchwork-Id: 8570561 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0D44F9F38C for ; Sat, 12 Mar 2016 00:21:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 392942035D for ; Sat, 12 Mar 2016 00:21:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 512EA2034C for ; Sat, 12 Mar 2016 00:21:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751756AbcCLAVO (ORCPT ); Fri, 11 Mar 2016 19:21:14 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:34269 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751286AbcCLAVM (ORCPT ); Fri, 11 Mar 2016 19:21:12 -0500 Received: by mail-pa0-f49.google.com with SMTP id fe3so95175274pab.1 for ; Fri, 11 Mar 2016 16:21:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=vvqcO7jrxtBdUB4rq85jrYGIV2NwHCQVLJTH+E/6C0A=; b=CyMv/o5ctyAoRlw98EMXvHxQRQnTF2A59j1Hfu/XV2IUtQdS79X6OnRZsoOGofOQhn KFHHU5LTqmKFTIkCkuqydQkDBwh7F1JnaLzXnNx+EVBqVGLLhwJpvrAOaTMj64xr4APf MKmFW9/5temOjBDDVRlIyupE79WP1z/5MUZXiyvtROFN6zoc3spR8Wxjj1cKzxnyE3YQ F9z5yDUH7evnWQq6Rux3ZHskKpOv/xZnYREPf490We07I6tnfcd83JrAoqI+KJfzwMez etlW9UwyWQf1OzkQOjIXWbJPt7ANKa6OYsElELrnBbsUvAs9lyVSM7L4i6/A8Nt2X+qX 5B9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vvqcO7jrxtBdUB4rq85jrYGIV2NwHCQVLJTH+E/6C0A=; b=FuEcoh85hPAexTlJEF5erOR/abUHe/0Snm3ATN2D5sc2rbVKcHlYhhAB2SW4e4rzCC QUvhoPtY6p5wWm1mUcKsriVvGZwaw8rCEduq6zUL2+jzUOLdIp7CJLAuz7dUMXhB5X71 aRhMXaQraXqK0xjSnvRYplnPvJe7LWfClcEkl1UYLpepuOjsTZojwcwBMSHQKJ9GCbGo EFp/Nh61HOkbh3ir72ytKmLqfVloSuoSP06baM8NOk46s1efm4HTXVAVW8vIVd+fYoaG H5rut/Jb61wAnYTS8BIgMU3tXZEKCxXllAVwtutMXb7l2hS42VC+D1SQPsP25+NiDrSD /6LA== X-Gm-Message-State: AD7BkJLikIIDOH5CFDkwJ1NvkY73KkjqkSFMVCKbyQ2O7/5V1uwXLKo4pxvd7IB87K87fyv6 X-Received: by 10.66.102.106 with SMTP id fn10mr20290541pab.60.1457742071971; Fri, 11 Mar 2016 16:21:11 -0800 (PST) Received: from localhost ([2620:0:1009:3:39f4:7212:898c:5563]) by smtp.gmail.com with ESMTPSA id qh8sm15475864pac.40.2016.03.11.16.21.11 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 11 Mar 2016 16:21:11 -0800 (PST) From: Peter Feiner To: drjones@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org Cc: pfeiner@google.com Subject: [PATCH kvm-unit-tests] build: don't reevaluate cc-option shell command Date: Fri, 11 Mar 2016 16:21:10 -0800 Message-Id: X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)