github.com/endocode/docker@v1.4.2-0.20160113120958-46eb4700391e/Makefile (about) 1 .PHONY: all binary build cross default docs docs-build docs-shell shell test test-docker-py test-integration-cli test-unit validate 2 3 # get OS/Arch of docker engine 4 DOCKER_OSARCH := $(shell bash -c 'source hack/make/.detect-daemon-osarch && echo $${DOCKER_ENGINE_OSARCH:+$$DOCKER_CLIENT_OSARCH}') 5 # default for linux/amd64 and others 6 DOCKERFILE := Dockerfile 7 # switch to different Dockerfile for linux/arm 8 ifeq ($(DOCKER_OSARCH), linux/arm) 9 DOCKERFILE := Dockerfile.armhf 10 else 11 ifeq ($(DOCKER_OSARCH), linux/arm64) 12 # TODO .arm64 13 DOCKERFILE := Dockerfile.armhf 14 else 15 ifeq ($(DOCKER_OSARCH), linux/ppc64le) 16 DOCKERFILE := Dockerfile.ppc64le 17 else 18 ifeq ($(DOCKER_OSARCH), linux/s390x) 19 DOCKERFILE := Dockerfile.s390x 20 endif 21 endif 22 endif 23 endif 24 export DOCKERFILE 25 26 # env vars passed through directly to Docker's build scripts 27 # to allow things like `make DOCKER_CLIENTONLY=1 binary` easily 28 # `docs/sources/contributing/devenvironment.md ` and `project/PACKAGERS.md` have some limited documentation of some of these 29 DOCKER_ENVS := \ 30 -e BUILDFLAGS \ 31 -e DOCKER_CLIENTONLY \ 32 -e DOCKER_DEBUG \ 33 -e DOCKER_EXPERIMENTAL \ 34 -e DOCKERFILE \ 35 -e DOCKER_GRAPHDRIVER \ 36 -e DOCKER_REMAP_ROOT \ 37 -e DOCKER_STORAGE_OPTS \ 38 -e DOCKER_USERLANDPROXY \ 39 -e TESTDIRS \ 40 -e TESTFLAGS \ 41 -e TIMEOUT 42 # 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 43 44 # to allow `make BIND_DIR=. shell` or `make BIND_DIR= test` 45 # (default to no bind mount if DOCKER_HOST is set) 46 # note: BINDDIR is supported for backwards-compatibility here 47 BIND_DIR := $(if $(BINDDIR),$(BINDDIR),$(if $(DOCKER_HOST),,bundles)) 48 DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(CURDIR)/$(BIND_DIR):/go/src/github.com/docker/docker/$(BIND_DIR)") 49 50 51 GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) 52 DOCKER_IMAGE := docker-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH)) 53 DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH)) 54 55 DOCKER_FLAGS := docker run --rm -i --privileged $(DOCKER_ENVS) $(DOCKER_MOUNT) 56 57 # if this session isn't interactive, then we don't want to allocate a 58 # TTY, which would fail, but if it is interactive, we do want to attach 59 # so that the user can send e.g. ^C through. 60 INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0) 61 ifeq ($(INTERACTIVE), 1) 62 DOCKER_FLAGS += -t 63 endif 64 65 DOCKER_RUN_DOCKER := $(DOCKER_FLAGS) "$(DOCKER_IMAGE)" 66 67 default: binary 68 69 all: build 70 $(DOCKER_RUN_DOCKER) hack/make.sh 71 72 binary: build 73 $(DOCKER_RUN_DOCKER) hack/make.sh binary 74 75 build: bundles 76 docker build -t "$(DOCKER_IMAGE)" -f "$(DOCKERFILE)" . 77 78 bundles: 79 mkdir bundles 80 81 cross: build 82 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary binary cross 83 84 deb: build 85 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-deb 86 87 docs: 88 $(MAKE) -C docs docs 89 90 rpm: build 91 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-rpm 92 93 shell: build 94 $(DOCKER_RUN_DOCKER) bash 95 96 test: build 97 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary cross test-unit test-integration-cli test-docker-py 98 99 test-docker-py: build 100 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary test-docker-py 101 102 test-integration-cli: build 103 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary test-integration-cli 104 105 test-unit: build 106 $(DOCKER_RUN_DOCKER) hack/make.sh test-unit 107 108 validate: build 109 $(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-gofmt validate-pkg validate-lint validate-test validate-toml validate-vet validate-vendor