diff options
author | Nico Huber <nico.h@gmx.de> | 2018-11-04 17:44:14 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-11-16 10:06:02 +0000 |
commit | 9b731b5c08635580a8b8ade237bb62f4f4e6ac24 (patch) | |
tree | 8cbd5b36240c14b38b2477fc599d77699cfe7727 /util | |
parent | 3693294112a717aeb3f14db80f9e753dd376ca58 (diff) |
util/docker: Use common .ccache for local builds
Bind a volume for .ccache to the `docker-run-local` targets. By default
the current user's $(HOME)/.ccache will be used, it can be overridden
via the DOCKER_CCACHE variable.
Also rearrange some docker parameters to keep the target readable.
Change-Id: I7d0bdb3861ac56361cacfa74aaf8b45c4f135e5c
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/29457
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/docker/Makefile | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/util/docker/Makefile b/util/docker/Makefile index 32714fcae5..eb43c985ed 100644 --- a/util/docker/Makefile +++ b/util/docker/Makefile @@ -31,6 +31,9 @@ export COREBOOT_CONTAINER_VERSION?=$(crossgcc_version) # Commit id to build from export DOCKER_COMMIT?=$(shell git log -n 1 --pretty=%h) +# .ccache dir to use +export DOCKER_CCACHE?=$(HOME)/.ccache + # SDK architecture export COREBOOT_CROSSGCC_PARAM?=all_without_gdb @@ -95,11 +98,17 @@ docker-cleanall: $(DOCKER) rmi $$($(DOCKER) images | grep -v "REPOSITORY" | tr -s ' ' | cut -f3 -d ' '); \ fi -docker-run-local: test-docker - $(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \ +$(DOCKER_CCACHE): + @mkdir -p $@ + +docker-run-local: test-docker $(DOCKER_CCACHE) + $(DOCKER) run -it --rm \ + --volume $(DOCKER_CCACHE):/home/coreboot/.ccache \ + --volume $(top):/home/coreboot/coreboot \ + --env HOME=/home/coreboot \ --user $(UID):$(GID) \ - --rm coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \ - /bin/bash -c "cd /home/coreboot/coreboot && $(DOCKER_RUN_LOCAL)" + coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \ + /bin/bash -c 'cd $${HOME}/coreboot && $(DOCKER_RUN_LOCAL)' docker-build-coreboot: docker-run-local docker-build-coreboot: override DOCKER_RUN_LOCAL := \ |