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