Skip to content

Commit

Permalink
chore: add Makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Shiwei Zhang <[email protected]>
  • Loading branch information
shizhMSFT committed Jun 12, 2024
1 parent fec5136 commit fd800c7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
DOCKER_PLUGINS = docker-ratify
GO_BUILD_FLAGS =

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'

.PHONY: all
all: build

.PHONY: FORCE
FORCE:

bin/%: cmd/% FORCE
go build $(GO_BUILD_FLAGS) -o $@ ./$<

.PHONY: build
build: $(addprefix bin/,$(DOCKER_PLUGINS)) ## builds binaries

.PHONY: install
install: $(addprefix install-,$(DOCKER_PLUGINS)) ## installs the docker plugins

.PHONY: install-docker-%
install-docker-%: bin/docker-%
cp $< ~/.docker/cli-plugins/

.PHONY: check-line-endings
check-line-endings: ## check line endings
! find . -name "*.go" -type f -exec file "{}" ";" | grep CRLF

.PHONY: fix-line-endings
fix-line-endings: ## fix line endings
find . -type f -name "*.go" -exec sed -i -e "s/\r//g" {} +

0 comments on commit fd800c7

Please sign in to comment.