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