Browse code

Add some minor reorganization to the Makefile preamble

The gist here is a reemphasizing of the explicitly "user mutable" bits by putting them first (and hopefully improving readability a little bit in the process).

Signed-off-by: Andrew Page <admwiggin@gmail.com>

Tianon Gravi authored on 2014/11/14 08:04:13
Showing 1 changed files
... ...
@@ -1,23 +1,39 @@
1 1
 .PHONY: all binary build cross default docs docs-build docs-shell shell test test-unit test-integration test-integration-cli validate
2 2
 
3
+# env vars passed through directly to Docker's build scripts
4
+# to allow things like `make DOCKER_CLIENTONLY=1 binary` easily
5
+# `docs/sources/contributing/devenvironment.md ` and `project/PACKAGERS.md` have some limited documentation of some of these
6
+DOCKER_ENVS := \
7
+	-e BUILDFLAGS \
8
+	-e DOCKER_CLIENTONLY \
9
+	-e DOCKER_EXECDRIVER \
10
+	-e DOCKER_GRAPHDRIVER \
11
+	-e TESTDIRS \
12
+	-e TESTFLAGS \
13
+	-e TIMEOUT
14
+# note: we _cannot_ add "-e DOCKER_BUILDTAGS" here because even if it's unset in the shell, that would shadow the "ENV DOCKER_BUILDTAGS" set in our Dockerfile, which is very important for our official builds
15
+
3 16
 # to allow `make BINDDIR=. shell` or `make BINDDIR= test`
4 17
 # (default to no bind mount if DOCKER_HOST is set)
5 18
 BINDDIR := $(if $(DOCKER_HOST),,bundles)
19
+DOCKER_MOUNT := $(if $(BINDDIR),-v "$(CURDIR)/$(BINDDIR):/go/src/github.com/docker/docker/$(BINDDIR)")
20
+
21
+# to allow `make DOCSDIR=docs docs-shell` (to create a bind mount in docs)
22
+DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR))
23
+
6 24
 # to allow `make DOCSPORT=9000 docs`
7 25
 DOCSPORT := 8000
8 26
 
9 27
 GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
10
-GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
11 28
 DOCKER_IMAGE := docker$(if $(GIT_BRANCH),:$(GIT_BRANCH))
12 29
 DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH))
13
-DOCKER_MOUNT := $(if $(BINDDIR),-v "$(CURDIR)/$(BINDDIR):/go/src/github.com/docker/docker/$(BINDDIR)")
14 30
 
15
-DOCKER_ENVS := -e TIMEOUT -e BUILDFLAGS -e TESTFLAGS \
16
-  -e TESTDIRS -e DOCKER_GRAPHDRIVER -e DOCKER_EXECDRIVER \
17
-  -e DOCKER_CLIENTONLY
18 31
 DOCKER_RUN_DOCKER := docker run --rm -it --privileged $(DOCKER_ENVS) $(DOCKER_MOUNT) "$(DOCKER_IMAGE)"
19
-# to allow `make DOCSDIR=docs docs-shell`
20
-DOCKER_RUN_DOCS := docker run --rm -it $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR)) -e AWS_S3_BUCKET
32
+
33
+DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET
34
+
35
+# for some docs workarounds (see below in "docs-build" target)
36
+GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
21 37
 
22 38
 default: binary
23 39