Files
goodlink/Makefile
kony 4a3e35e1dc u
2024-12-19 21:57:07 +08:00

35 lines
832 B
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
NAME=goodlink
BINDIR=bin
# 获取源码最近一次 git commit log包含 commit sha 值,以及 commit message
GitCommitLog=$(shell git log --pretty=oneline -n 1)
BuildTime=$(shell date +'%Y-%m-%d %H:%M:%S')
GOBUILD=GO111MODULE=on \
GOPROXY="https://goproxy.cn,direct" \
go build -trimpath -ldflags \
'-X "gogo.GitCommitLog=$(GitCommitLog)" \
-X "gogo.GitStatus=$(GitStatus)" \
-X "gogo.BuildTime=$(BuildTime)" \
-w -s -buildid='
PLATFORM_LIST = \
linux-arm64 \
linux-amd64 \
windows-amd64
all: clean $(PLATFORM_LIST) strip
linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
linux-arm64:
GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
windows-amd64:
GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
strip:
upx $(BINDIR)/*
clean:
rm -rf $(BINDIR)