-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
36 lines (29 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
NAME=tcolors
VERSION=$(shell cat VERSION)
LDFLAGS="-w -X main.version=$(VERSION) -X main.build=$(shell git log -1 --format=%cd.%h --date=short|tr -d -)"
clean:
rm -rvf _build/ _release/ arch-release/
deps:
go mod download
image:
docker build -t tcolors -f Dockerfile .
build: deps
CGO_ENABLED=0 go build -ldflags $(LDFLAGS) -o $(NAME)
build-all: deps
mkdir -p _build
GOOS=darwin GOARCH=amd64 go build -ldflags $(LDFLAGS) -o _build/$(NAME)-$(VERSION)-darwin-amd64
GOOS=linux GOARCH=amd64 go build -ldflags $(LDFLAGS) -o _build/$(NAME)-$(VERSION)-linux-amd64
GOOS=linux GOARCH=arm go build -ldflags $(LDFLAGS) -o _build/$(NAME)-$(VERSION)-linux-arm
GOOS=freebsd GOARCH=amd64 go build -ldflags $(LDFLAGS) -o _build/$(NAME)-$(VERSION)-freebsd-amd64
release:
mkdir _release
cp _build/* _release/
cd _release; sha256sum --quiet --check sha256sums.txt && \
gh release create v$(VERSION) -d -t v$(VERSION) *
arch-release:
mkdir -p arch-release
cd arch-release && \
git clone ssh://aur@aur.archlinux.org/tcolors.git; \
sed -i "s/^pkgver=.*/pkgver=$(VERSION)/" tcolors/PKGBUILD
cd arch-release/tcolors/ && \
mksrcinfo