From patchwork Sun Sep 20 18:41:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 520015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 86F0F140784 for ; Mon, 21 Sep 2015 04:43:13 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 66ABC32C8E; Sun, 20 Sep 2015 18:43:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kyqadFFDScLN; Sun, 20 Sep 2015 18:43:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 28165321BE; Sun, 20 Sep 2015 18:42:48 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id C3B0D1CEE12 for ; Sun, 20 Sep 2015 18:42:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C13738B776 for ; Sun, 20 Sep 2015 18:42:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VrgK8Bv-TjOC for ; Sun, 20 Sep 2015 18:42:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exchange.essensium.com (220.77.144.195.ipv4.evonet.be [195.144.77.220]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 2E8F88B74E for ; Sun, 20 Sep 2015 18:42:39 +0000 (UTC) Received: from localhost.localdomain (10.3.7.11) by beleexch01.local.ess-mail.com (10.3.7.8) with Microsoft SMTP Server (TLS) id 15.0.847.32; Sun, 20 Sep 2015 20:42:07 +0200 From: "Arnout Vandecappelle (Essensium/Mind)" To: Date: Sun, 20 Sep 2015 20:41:30 +0200 Message-ID: <1442774504-22799-5-git-send-email-arnout@mind.be> X-Mailer: git-send-email 2.5.3 In-Reply-To: <1442774504-22799-1-git-send-email-arnout@mind.be> References: <1442774504-22799-1-git-send-email-arnout@mind.be> MIME-Version: 1.0 X-Originating-IP: [10.3.7.11] X-ClientProxiedBy: beleexch01.local.ess-mail.com (10.3.7.8) To beleexch01.local.ess-mail.com (10.3.7.8) Subject: [Buildroot] [PATCH 04/18] infra: move ccache handling to the toolchain wrapper X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Since we always have a toolchain wrapper now, we can move the ccache call to the toolchain wrapper. The hostcc ccache handling obviously stays. The global addition of ccache to TARGET_CC/CXX is removed, but many individual packages and infras still add it. This means we have a chain like this: ccache -> toolchain-wrapper -> ccache -> gcc However, this is fairly harmless: for cache misses, the inner ccache just adds overhead and for cache hits, the inner ccache is never called. Later patches will remove these redundant ccache calls. As a side effect, perl now supports ccache as well. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Cc: Danomi Manchego Cc: Károly Kasza Reviewed-by: Romain Naour --- package/Makefile.in | 5 ----- toolchain/toolchain-wrapper.c | 5 ++++- toolchain/toolchain-wrapper.mk | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package/Makefile.in b/package/Makefile.in index 545694f..4b1ce7f 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -189,11 +189,6 @@ TARGET_OBJDUMP = $(TARGET_CROSS)objdump TARGET_CC_NOCCACHE := $(TARGET_CC) TARGET_CXX_NOCCACHE := $(TARGET_CXX) -ifeq ($(BR2_CCACHE),y) -TARGET_CC := $(CCACHE) $(TARGET_CC) -TARGET_CXX := $(CCACHE) $(TARGET_CXX) -endif - ifeq ($(BR2_STRIP_strip),y) STRIP_STRIP_DEBUG := --strip-debug STRIP_STRIP_UNNEEDED := --strip-unneeded diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c index f3ff04f..4774692 100644 --- a/toolchain/toolchain-wrapper.c +++ b/toolchain/toolchain-wrapper.c @@ -40,6 +40,9 @@ static char sysroot[PATH_MAX]; #define EXCLUSIVE_ARGS 3 static char *predef_args[] = { +#ifdef BR_CCACHE + BR_CCACHE, +#endif path, "--sysroot", sysroot, #ifdef BR_ABI @@ -251,7 +254,7 @@ int main(int argc, char **argv) } } - if (execv(path, args)) + if (execv(args[0], args)) perror(path); free(args); diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk index 8e8a445..ab8215d 100644 --- a/toolchain/toolchain-wrapper.mk +++ b/toolchain/toolchain-wrapper.mk @@ -17,6 +17,10 @@ TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' # toolchain wrapper. TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)' +ifeq ($(BR2_CCACHE),y) +TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE='"$(CCACHE)"' +endif + # For simplicity, build directly into the install location define TOOLCHAIN_BUILD_WRAPPER $(Q)mkdir -p $(HOST_DIR)/usr/bin