-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
53 lines (42 loc) · 1.17 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
ifeq ($(OS),Windows_NT)
SHELL=CMD.EXE
SET=set
DEL=del
NUL=nul
WHICH=where.exe
else
SET=export
DEL=rm
NUL=/dev/null
WHICH=which
endif
ifndef GO
SUPPORTGO=go1.20.14
GO:=$(shell $(WHICH) $(SUPPORTGO) 2>$(NUL) || echo go)
endif
NAME:=$(notdir $(CURDIR))
VERSION:=$(shell git describe --tags 2>$(NUL) || echo v0.0.0)
GOOPT:=-ldflags "-s -w -X main.version=$(VERSION)"
EXE:=$(shell go env GOEXE)
all:
$(GO) fmt ./...
$(SET) "CGO_ENABLED=0" && $(GO) build $(GOOPT)
test:
$(GO) test -v
.\$(NAME) test.lua
_dist:
$(SET) "CGO_ENABLED=0" && $(GO) build $(GOOPT)
zip -9 $(NAME)-$(VERSION)-$(GOOS)-$(GOARCH).zip $(NAME)$(EXE)
dist:
$(SET) "GOOS=windows" && $(SET) "GOARCH=386" && $(MAKE) _dist
$(SET) "GOOS=windows" && $(SET) "GOARCH=amd64" && $(MAKE) _dist
clean:
$(DEL) *.zip $(NAME)$(EXE)
manifest:
make-scoop-manifest *-windows-*.zip > expect-lua.json
release:
gh release create -d --notes "" -t $(VERSION) $(VERSION) $(wildcard $(NAME)-$(VERSION)-*.zip)
$(SUPPORTGO):
go install golang.org/dl/$(SUPPORTGO)@latest
$(SUPPORTGO) download
.PHONY: all test dist _dist clean manifest release