github.com/connyay/libcompose@v0.4.0/Makefile (about) 1 .PHONY: all build binary clean cross-binary help test test-unit test-integration test-acceptance validate 2 3 LIBCOMPOSE_ENVS := \ 4 -e OS_PLATFORM_ARG \ 5 -e OS_ARCH_ARG \ 6 -e DOCKER_TEST_HOST \ 7 -e TESTDIRS \ 8 -e TESTFLAGS \ 9 -e SHOWWARNING \ 10 -e TESTVERBOSE 11 12 # (default to no bind mount if DOCKER_HOST is set) 13 BIND_DIR := $(if $(DOCKER_HOST),,bundles) 14 LIBCOMPOSE_MOUNT := $(if $(BIND_DIR),-v "$(CURDIR)/$(BIND_DIR):/go/src/github.com/docker/libcompose/$(BIND_DIR)") 15 16 GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) 17 GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g") 18 LIBCOMPOSE_IMAGE := libcompose-dev$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN)) 19 20 DAEMON_VERSION := $(if $(DAEMON_VERSION),$(DAEMON_VERSION),"default") 21 TTY := $(shell [ -t 0 ] && echo "-t") 22 DOCKER_RUN_LIBCOMPOSE := docker run --rm -i $(TTY) --privileged -e DAEMON_VERSION="$(DAEMON_VERSION)" $(LIBCOMPOSE_ENVS) $(LIBCOMPOSE_MOUNT) "$(LIBCOMPOSE_IMAGE)" 23 24 default: binary 25 26 all: build ## validate all checks, build linux binary, run all tests\ncross build non-linux binaries 27 $(DOCKER_RUN_LIBCOMPOSE) ./hack/make.sh 28 29 binary: build ## build the linux binary 30 $(DOCKER_RUN_LIBCOMPOSE) ./hack/make.sh binary 31 32 cross-binary: build ## cross build the non linux binaries (windows, darwin) 33 $(DOCKER_RUN_LIBCOMPOSE) ./hack/make.sh cross-binary 34 35 test: build ## run the unit, integration and acceptance tests 36 $(DOCKER_RUN_LIBCOMPOSE) ./hack/make.sh binary test-unit test-integration test-acceptance 37 38 test-unit: build ## run the unit tests 39 $(DOCKER_RUN_LIBCOMPOSE) ./hack/make.sh test-unit 40 41 test-integration: build ## run the integration tests 42 $(DOCKER_RUN_LIBCOMPOSE) ./hack/make.sh binary test-integration 43 44 test-acceptance: build ## run the acceptance tests 45 $(DOCKER_RUN_LIBCOMPOSE) ./hack/make.sh binary test-acceptance 46 47 validate: build ## validate DCO, git conflicts marks, gofmt, golint and go vet 48 $(DOCKER_RUN_LIBCOMPOSE) ./hack/make.sh validate-dco validate-git-marks validate-gofmt validate-lint validate-vet 49 50 shell: build ## start a shell inside the build env 51 $(DOCKER_RUN_LIBCOMPOSE) bash 52 53 # Build the docker image, should be prior almost any other goals 54 build: bundles 55 docker build -t "$(LIBCOMPOSE_IMAGE)" . 56 57 bundles: 58 mkdir bundles 59 60 clean: 61 $(DOCKER_RUN_LIBCOMPOSE) ./hack/make.sh clean 62 63 help: ## this help 64 @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)