Merge pull request #106 from dnephin/improve-makefile

Remove @ from Makefiles
This commit is contained in:
Daniel Nephin 2017-05-19 16:03:04 -04:00 committed by GitHub
commit 883d28cfce
2 changed files with 24 additions and 27 deletions

View File

@ -1,49 +1,47 @@
# #
# github.com/docker/cli # github.com/docker/cli
# #
all: binary all: binary
# remove build artifacts # remove build artifacts
.PHONY: clean .PHONY: clean
clean: clean:
@rm -rf ./build/* cli/winresources/rsrc_* rm -rf ./build/* cli/winresources/rsrc_*
# run go test # run go test
# the "-tags daemon" part is temporary # the "-tags daemon" part is temporary
.PHONY: test .PHONY: test
test: test:
@go test -tags daemon -v $(shell go list ./... | grep -v /vendor/) go test -tags daemon -v $(shell go list ./... | grep -v /vendor/)
.PHONY: lint .PHONY: lint
lint: lint:
@gometalinter --config gometalinter.json ./... gometalinter --config gometalinter.json ./...
.PHONY: binary .PHONY: binary
binary: binary:
@./scripts/build/binary @echo "WARNING: binary creates a Linux executable. Use cross for macOS or Windows."
./scripts/build/binary
# build the CLI for multiple architectures
.PHONY: cross .PHONY: cross
cross: cross:
@./scripts/build/cross ./scripts/build/cross
.PHONY: dynbinary .PHONY: dynbinary
dynbinary: dynbinary:
@./scripts/build/dynbinary ./scripts/build/dynbinary
.PHONY: watch .PHONY: watch
watch: watch:
@./scripts/test/watch ./scripts/test/watch
# download dependencies (vendor/) listed in vendor.conf # Check vendor matches vendor.conf
.PHONY: vendor
vendor: vendor.conf vendor: vendor.conf
@vndr 2> /dev/null vndr 2> /dev/null
@scripts/validate/check-git-diff vendor scripts/validate/check-git-diff vendor
cli/compose/schema/bindata.go: cli/compose/schema/data/*.json cli/compose/schema/bindata.go: cli/compose/schema/data/*.json
go generate github.com/docker/cli/cli/compose/schema go generate github.com/docker/cli/cli/compose/schema
compose-jsonschema: cli/compose/schema/bindata.go compose-jsonschema: cli/compose/schema/bindata.go
@scripts/validate/check-git-diff cli/compose/schema/bindata.go scripts/validate/check-git-diff cli/compose/schema/bindata.go

View File

@ -12,60 +12,59 @@ MOUNTS = -v `pwd`:/go/src/github.com/docker/cli
# build docker image (dockerfiles/Dockerfile.build) # build docker image (dockerfiles/Dockerfile.build)
.PHONY: build_docker_image .PHONY: build_docker_image
build_docker_image: build_docker_image:
@docker build -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.dev . docker build -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.dev .
# build docker image having the linting tools (dockerfiles/Dockerfile.lint) # build docker image having the linting tools (dockerfiles/Dockerfile.lint)
.PHONY: build_linter_image .PHONY: build_linter_image
build_linter_image: build_linter_image:
@docker build -t $(LINTER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.lint . docker build -t $(LINTER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.lint .
.PHONY: build_cross_image .PHONY: build_cross_image
build_cross_image: build_cross_image:
@docker build -t $(CROSS_IMAGE_NAME) -f ./dockerfiles/Dockerfile.cross . docker build -t $(CROSS_IMAGE_NAME) -f ./dockerfiles/Dockerfile.cross .
# build executable using a container # build executable using a container
binary: build_docker_image binary: build_docker_image
@echo "WARNING: this will drop a Linux executable on your host (not a macOS or Windows one)" docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary
build: binary build: binary
# clean build artifacts using a container # clean build artifacts using a container
.PHONY: clean .PHONY: clean
clean: build_docker_image clean: build_docker_image
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean
# run go test # run go test
.PHONY: test .PHONY: test
test: build_docker_image test: build_docker_image
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make test docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make test
# build the CLI for multiple architectures using a container # build the CLI for multiple architectures using a container
.PHONY: cross .PHONY: cross
cross: build_cross_image cross: build_cross_image
@docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
.PHONY: watch .PHONY: watch
watch: build_docker_image watch: build_docker_image
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make watch docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make watch
# start container in interactive mode for in-container development # start container in interactive mode for in-container development
.PHONY: dev .PHONY: dev
dev: build_docker_image dev: build_docker_image
@docker run -ti $(MOUNTS) -v /var/run/docker.sock:/var/run/docker.sock $(DEV_DOCKER_IMAGE_NAME) ash docker run -ti $(MOUNTS) -v /var/run/docker.sock:/var/run/docker.sock $(DEV_DOCKER_IMAGE_NAME) ash
shell: dev shell: dev
# run linters in a container # run linters in a container
.PHONY: lint .PHONY: lint
lint: build_linter_image lint: build_linter_image
@docker run -ti $(MOUNTS) $(LINTER_IMAGE_NAME) docker run -ti $(MOUNTS) $(LINTER_IMAGE_NAME)
# download dependencies (vendor/) listed in vendor.conf, using a container # download dependencies (vendor/) listed in vendor.conf, using a container
.PHONY: vendor .PHONY: vendor
vendor: build_docker_image vendor.conf vendor: build_docker_image vendor.conf
@docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor
dynbinary: build_cross_image dynbinary: build_cross_image
@docker run -ti --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary docker run -ti --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary