Skip to content

Commit

Permalink
Merge pull request #9651 from cladmi/pr/make/docker/add_gitcache_support
Browse files Browse the repository at this point in the history
docker: Use system GIT_CACHE_DIR if available
  • Loading branch information
jia200x authored Oct 23, 2018
2 parents 3068fb8 + c603247 commit d386c97
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RIOTPKG ?= $(RIOTBASE)/pkg
RIOTTOOLS ?= $(RIOTBASE)/dist/tools
RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd)
GITCACHE ?= $(RIOTTOOLS)/git/git-cache
GIT_CACHE_DIR ?= $(HOME)/.gitcache
APPDIR ?= $(CURDIR)
BINDIRBASE ?= $(APPDIR)/bin
BINDIR ?= $(BINDIRBASE)/$(BOARD)
Expand Down
7 changes: 7 additions & 0 deletions makefiles/docker.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ DOCKER_OVERRIDE_CMDLINE := $(strip $(DOCKER_OVERRIDE_CMDLINE))
# Overwrite if you want to use `docker` with sudo
DOCKER ?= docker

# Mounted volumes and exported environment variables

# Add GIT_CACHE_DIR if the directory exists
DOCKER_VOLUMES_AND_ENV += $(if $(wildcard $(GIT_CACHE_DIR)),-v $(GIT_CACHE_DIR):$(DOCKER_BUILD_ROOT)/gitcache)
DOCKER_VOLUMES_AND_ENV += $(if $(wildcard $(GIT_CACHE_DIR)),-e GIT_CACHE_DIR=$(DOCKER_BUILD_ROOT)/gitcache)

# This will execute `make $(DOCKER_MAKECMDGOALS)` inside a Docker container.
# We do not push the regular $(MAKECMDGOALS) to the container's make command in
# order to only perform building inside the container and defer executing any
Expand All @@ -105,6 +111,7 @@ DOCKER ?= docker
-e 'RIOTBOARD=$(DOCKER_BUILD_ROOT)/riotboard' \
-e 'RIOTMAKE=$(DOCKER_BUILD_ROOT)/riotmake' \
-e 'RIOTPROJECT=$(DOCKER_BUILD_ROOT)/riotproject' \
$(DOCKER_VOLUMES_AND_ENV) \
$(DOCKER_ENVIRONMENT_CMDLINE) \
-w '$(DOCKER_BUILD_ROOT)/riotproject/$(BUILDRELPATH)' \
'$(DOCKER_IMAGE)' make $(DOCKER_MAKECMDGOALS) $(DOCKER_OVERRIDE_CMDLINE)
1 change: 1 addition & 0 deletions makefiles/vars.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export UNDEF # Object files that the linker must include in the
export WERROR # Treat all compiler warnings as errors if set to 1 (see -Werror flag in GCC manual)

export GITCACHE # path to git-cache executable
export GIT_CACHE_DIR # path to git-cache cache directory
export FLASHER # The command to call on "make flash".
export FFLAGS # The parameters to supply to FLASHER.
export FLASH_ADDR # Define an offset to flash code into ROM memory.
Expand Down

0 comments on commit d386c97

Please sign in to comment.