From ecca62efa8109b26108296853637179f875f3354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 19 Apr 2021 14:43:01 +0200 Subject: [PATCH] build: Create CCACHE_DIR if it doesn't exist and mount it. Instead of the HOME dir, and only when ENABLE_CCACHE is set. --- build/makefile_base.mak | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build/makefile_base.mak b/build/makefile_base.mak index 2993fd27..7afaba31 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -49,14 +49,14 @@ CCACHE_ENV := $(patsubst %,-e %,$(shell env|cut -d= -f1|grep '^CCACHE_')) ifeq ($(ENABLE_CCACHE),1) CCACHE_BIN := ccache export CCACHE_DIR := $(if $(CCACHE_DIR),$(CCACHE_DIR),$(HOME)/.ccache) - DOCKER_OPTS := $(CCACHE_ENV) -e CCACHE_DIR=$(CCACHE_DIR) $(DOCKER_OPTS) + DOCKER_OPTS := -v $(CCACHE_DIR):$(CCACHE_DIR) $(CCACHE_ENV) -e CCACHE_DIR=$(CCACHE_DIR) $(DOCKER_OPTS) else export CCACHE_DISABLE := 1 DOCKER_OPTS := $(CCACHE_ENV) -e CCACHE_DISABLE=1 $(DOCKER_OPTS) endif DOCKER_BASE = docker run --rm -e HOME -e USER -e USERID=$(shell id -u) -u $(shell id -u):$(shell id -g) \ - -v $(HOME):$(HOME) -v $(SRC):$(SRC) -v $(OBJ):$(OBJ) -w $(OBJ) -e MAKEFLAGS \ + -v $(SRC):$(SRC) -v $(OBJ):$(OBJ) -w $(OBJ) -e MAKEFLAGS \ $(DOCKER_OPTS) $(STEAMRT_IMAGE) STEAMRT_NAME ?= soldier @@ -90,6 +90,9 @@ all32 $(MAKECMDGOALS64): ifeq ($(CONTAINER),) J := $(shell nproc) +ifeq ($(ENABLE_CCACHE),1) +container-build: $(shell mkdir -p $(CCACHE_DIR)) +endif container-build: private SHELL := $(CONTAINER_SHELL) container-build: +$(MAKE) -j$(J) $(filter -j%,$(MAKEFLAGS)) -f $(firstword $(MAKEFILE_LIST)) $(MFLAGS) $(MAKEOVERRIDES) CONTAINER=1 $(CONTAINERGOALS)