1 Star 0 Fork 34

梁锐/git-repo-clean

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 2.78 KB
一键复制 编辑 原始数据 按行查看 历史
TARGET := git-repo-clean
VERSION := 1.4.3
GO_VERSION := $(subst go version go,,$(shell go version))
BUILD_VERSION := $(shell git describe --tags --always)
GO_LDFLAGS := -X 'main.GoVersion=$(GO_VERSION)' -X 'main.BuildVersion=$(BUILD_VERSION)'
GOFLAGS := -ldflags "$(GO_LDFLAGS)"
.PHONY: all
all:
go build -o bin/${TARGET} $(GOFLAGS)
.PHONY: release
release: Linux MacOS Windows
Linux: Linux-64 Linux-32
Linux-64:
mkdir -p releases/$(VERSION)/Linux-64/
cp -r docs releases/$(VERSION)/Linux-64/
cp LICENSE releases/$(VERSION)/Linux-64/
cp README.md releases/$(VERSION)/Linux-64/
$(call RELEASE_BUILD,linux,amd64)
cp ./releases/git-repo-clean releases/$(VERSION)/Linux-64/
tar -cf releases/git-repo-clean-$(VERSION)-Linux-64.tar releases/$(VERSION)/Linux-64/
rm releases/git-repo-clean
rm -rf releases/$(VERSION)
Linux-32:
mkdir -p releases/$(VERSION)/Linux-32/
cp -r docs releases/$(VERSION)/Linux-32/
cp LICENSE releases/$(VERSION)/Linux-32/
cp README.md releases/$(VERSION)/Linux-32/
$(call RELEASE_BUILD,linux,386)
cp ./releases/git-repo-clean releases/$(VERSION)/Linux-32/
tar -cf releases/git-repo-clean-$(VERSION)-Linux-32.tar releases/$(VERSION)/Linux-32/
rm releases/git-repo-clean
rm -rf releases/$(VERSION)
MacOS: macOS-64
macOS-64:
mkdir -p releases/$(VERSION)/macOS-64/
cp -r docs releases/$(VERSION)/macOS-64/
cp LICENSE releases/$(VERSION)/macOS-64/
cp README.md releases/$(VERSION)/macOS-64/
$(call RELEASE_BUILD,darwin,amd64)
cp ./releases/git-repo-clean releases/$(VERSION)/macOS-64/
tar -cf releases/git-repo-clean-$(VERSION)-macOS-64.tar releases/$(VERSION)/macOS-64/
rm releases/git-repo-clean
rm -rf releases/$(VERSION)
Windows: Windows-64 Windows-32
Windows-64:
mkdir -p releases/$(VERSION)/Windows-64/
cp -r docs releases/$(VERSION)/Windows-64/
cp LICENSE releases/$(VERSION)/Windows-64/
cp README.md releases/$(VERSION)/Windows-64/
$(call RELEASE_BUILD,windows,amd64,.exe)
cp ./releases/git-repo-clean.exe releases/$(VERSION)/Windows-64/
zip -r releases/git-repo-clean-$(VERSION)-Windows-64.zip releases/$(VERSION)/Windows-64/
rm releases/git-repo-clean.exe
rm -rf releases/$(VERSION)
Windows-32:
mkdir -p releases/$(VERSION)/Windows-32/
cp -r docs releases/$(VERSION)/Windows-32/
cp LICENSE releases/$(VERSION)/Windows-32/
cp README.md releases/$(VERSION)/Windows-32/
$(call RELEASE_BUILD,windows,386,.exe)
cp ./releases/git-repo-clean.exe releases/$(VERSION)/Windows-32/
zip -r releases/git-repo-clean-$(VERSION)-Windows-32.zip releases/$(VERSION)/Windows-32/
rm releases/git-repo-clean.exe
rm -rf releases/$(VERSION)
RELEASE_BUILD = GOOS=$(1) GOARCH=$(2) \
go build \
$(GOFLAGS) \
-o ./releases/git-repo-clean$(3)
.PHONY: clean
clean:
rm -f bin/git-repo-clean
rm -rf releases/*
.PHONY: install
install:
cp bin/git-repo-clean $(shell git --exec-path)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/liangrui202110098112/git-repo-clean.git
git@gitee.com:liangrui202110098112/git-repo-clean.git
liangrui202110098112
git-repo-clean
git-repo-clean
main

搜索帮助