From 9d7713235cbde0824c2f3fc81e452a6443f59f7a Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 17 Aug 2020 13:09:11 -0500 Subject: [PATCH] build: Use ccache binary instead of PATH The ccache symlinks dir may differ (Arch and Debian disagree, for example), and this allows us to use ccache for mingw-w64 within the runtime container. --- Vagrantfile | 6 ------ build/makefile_base.mak | 27 +++++++++++++++++++++------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 2e127e74..15a539b7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -106,12 +106,6 @@ Vagrant.configure(2) do |config| #ensure we use only the mingw-w64 that we built apt-get remove -y '*mingw-w64*' - - #setup ccache - ln -s $(which ccache) /usr/lib/ccache/x86_64-w64-mingw32-gcc - ln -s $(which ccache) /usr/lib/ccache/x86_64-w64-mingw32-g++ - ln -s $(which ccache) /usr/lib/ccache/i686-w64-mingw32-gcc - ln -s $(which ccache) /usr/lib/ccache/i686-w64-mingw32-g++ SHELL end end diff --git a/build/makefile_base.mak b/build/makefile_base.mak index d2ecece0..ad100ab6 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -37,11 +37,26 @@ ifeq ($(SRCDIR),) endif # If CC is coming from make's defaults or nowhere, use our own default. Otherwise respect environment. +ifeq ($(ENABLE_CCACHE),1) + CCACHE_BIN := ccache +else + export CCACHE_DISABLE = 1 + DOCKER_CCACHE_FLAG = -e CCACHE_DISABLE=1 +endif + ifneq ($(filter default undefined,$(origin CC)),) - CC = gcc + CC = $(CCACHE_BIN) gcc endif ifneq ($(filter default undefined,$(origin CXX)),) - CXX = g++ + CXX = $(CCACHE_BIN) g++ +endif +ifneq ($(filter default undefined,$(origin CROSSCC)),) + CROSSCC32 = $(CCACHE_BIN) i686-w64-mingw32-gcc + CROSSCC64 = $(CCACHE_BIN) x86_64-w64-mingw32-gcc +endif +ifneq ($(filter default undefined,$(origin CROSSCXX)),) + CROSSCXX32 = $(CCACHE_BIN) i686-w64-mingw32-g++ + CROSSCXX64 = $(CCACHE_BIN) x86_64-w64-mingw32-g++ endif export CC @@ -50,8 +65,6 @@ export CXX ifeq ($(ENABLE_CCACHE),1) export PATH := /usr/lib/ccache:$(PATH) else - export CCACHE_DISABLE = 1 - DOCKER_CCACHE_FLAG = -e CCACHE_DISABLE=1 endif CC32 := gcc -m32 -mstackrealign @@ -179,6 +192,8 @@ QUOTE_VARIABLE_LIST = $(foreach a,$(1),$(call QUOTE_VARIABLE,$(a))) STRIP_QUOTED = $(call QUOTE,$(STRIP)) CC_QUOTED = $(call QUOTE,$(CC)) CXX_QUOTED = $(call QUOTE,$(CXX)) +CROSSCC32_QUOTED = $(call QUOTE,$(CROSSCC32)) +CROSSCC64_QUOTED = $(call QUOTE,$(CROSSCC64)) ## ## Target configs @@ -1071,7 +1086,7 @@ $(WINE_CONFIGURE_FILES64): $(MAKEFILE_DEP) | faudio64 gst_base64 $(WINE_OBJ64) LDFLAGS=-L$(abspath $(TOOLS_DIR64))/lib \ PKG_CONFIG_PATH=$(abspath $(TOOLS_DIR64))/lib/pkgconfig \ CC=$(CC_QUOTED) \ - CXX=$(CXX_QUOTED) \ + CROSSCC=$(CROSSCC64_QUOTED) \ CROSSDEBUG=split-dwarf # 32-bit configure @@ -1089,7 +1104,7 @@ $(WINE_CONFIGURE_FILES32): $(MAKEFILE_DEP) | faudio32 gst_base32 $(WINE_OBJ32) LDFLAGS=-L$(abspath $(TOOLS_DIR32))/lib \ PKG_CONFIG_PATH=$(abspath $(TOOLS_DIR32))/lib/pkgconfig \ CC=$(CC_QUOTED) \ - CXX=$(CXX_QUOTED) \ + CROSSCC=$(CROSSCC32_QUOTED) \ PKG_CONFIG="$(PKG_CONFIG32)" \ CROSSDEBUG=split-dwarf