github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/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 KEEPBUNDLE \
    35  	-e DOCKER_BUILD_GOGC \
    36  	-e DOCKER_BUILD_PKGS \
    37  	-e DOCKER_CLIENTONLY \
    38  	-e DOCKER_DEBUG \
    39  	-e DOCKER_EXPERIMENTAL \
    40  	-e DOCKERFILE \
    41  	-e DOCKER_GRAPHDRIVER \
    42  	-e DOCKER_INCREMENTAL_BINARY \
    43  	-e DOCKER_REMAP_ROOT \
    44  	-e DOCKER_STORAGE_OPTS \
    45  	-e DOCKER_USERLANDPROXY \
    46  	-e TESTDIRS \
    47  	-e TESTFLAGS \
    48  	-e TIMEOUT
    49  # 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
    50  
    51  # to allow `make BIND_DIR=. shell` or `make BIND_DIR= test`
    52  # (default to no bind mount if DOCKER_HOST is set)
    53  # note: BINDDIR is supported for backwards-compatibility here
    54  BIND_DIR := $(if $(BINDDIR),$(BINDDIR),$(if $(DOCKER_HOST),,bundles))
    55  DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(CURDIR)/$(BIND_DIR):/go/src/github.com/docker/docker/$(BIND_DIR)")
    56  
    57  # This allows the test suite to be able to run without worrying about the underlying fs used by the container running the daemon (e.g. aufs-on-aufs), so long as the host running the container is running a supported fs.
    58  # The volume will be cleaned up when the container is removed due to `--rm`.
    59  # Note that `BIND_DIR` will already be set to `bundles` if `DOCKER_HOST` is not set (see above BIND_DIR line), in such case this will do nothing since `DOCKER_MOUNT` will already be set.
    60  DOCKER_MOUNT := $(if $(DOCKER_MOUNT),$(DOCKER_MOUNT),-v "/go/src/github.com/docker/docker/bundles")
    61  
    62  GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
    63  DOCKER_IMAGE := docker-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
    64  DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH))
    65  
    66  DOCKER_FLAGS := docker run --rm -i --privileged $(DOCKER_ENVS) $(DOCKER_MOUNT)
    67  
    68  # if this session isn't interactive, then we don't want to allocate a
    69  # TTY, which would fail, but if it is interactive, we do want to attach
    70  # so that the user can send e.g. ^C through.
    71  INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0)
    72  ifeq ($(INTERACTIVE), 1)
    73  	DOCKER_FLAGS += -t
    74  endif
    75  
    76  DOCKER_RUN_DOCKER := $(DOCKER_FLAGS) "$(DOCKER_IMAGE)"
    77  
    78  default: binary
    79  
    80  all: build
    81  	$(DOCKER_RUN_DOCKER) hack/make.sh
    82  
    83  binary: build
    84  	$(DOCKER_RUN_DOCKER) hack/make.sh binary
    85  
    86  build: bundles
    87  ifeq ($(DOCKER_OSARCH), linux/arm)
    88  	# A few libnetwork integration tests require that the kernel be
    89  	# configured with "dummy" network interface and has the module
    90  	# loaded. However, the dummy module is not available by default
    91  	# on arm images. This ensures that it's built and loaded.
    92  	echo "Syncing kernel modules"
    93  	oc-sync-kernel-modules
    94  	depmod
    95  	modprobe dummy
    96  endif
    97  	docker build ${DOCKER_BUILD_ARGS} -t "$(DOCKER_IMAGE)" -f "$(DOCKERFILE)" .
    98  
    99  bundles:
   100  	mkdir bundles
   101  
   102  cross: build
   103  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary binary cross
   104  	
   105  	
   106  win: build
   107  	$(DOCKER_RUN_DOCKER) hack/make.sh win
   108  
   109  
   110  deb: build
   111  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-deb
   112  
   113  docs:
   114  	$(MAKE) -C docs docs
   115  
   116  gccgo: build
   117  	$(DOCKER_RUN_DOCKER) hack/make.sh gccgo
   118  
   119  rpm: build
   120  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-rpm
   121  
   122  shell: build
   123  	$(DOCKER_RUN_DOCKER) bash
   124  
   125  test: build
   126  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary cross test-unit test-integration-cli test-docker-py
   127  
   128  test-docker-py: build
   129  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary test-docker-py
   130  
   131  test-integration-cli: build
   132  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary test-integration-cli
   133  
   134  test-unit: build
   135  	$(DOCKER_RUN_DOCKER) hack/make.sh test-unit
   136  
   137  validate: build
   138  	$(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-default-seccomp validate-gofmt validate-pkg validate-lint validate-test validate-toml validate-vet validate-vendor