-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
50 lines (40 loc) · 1.26 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
ifeq ($(OS),Windows_NT)
SHELL=CMD.EXE
SET=set
DEL=del
NUL=nul
else
SET=export
DEL=rm
NUL=/dev/null
endif
NAME:=$(notdir $(CURDIR))
VERSION:=$(shell git describe --tags 2>$(NUL) || echo v0.0.0)
GOOPT:=-ldflags "-s -w -X github.com/hymkor/sqlbless.Version=$(VERSION)"
EXE=$(shell go env GOEXE)
all:
go fmt ./...
$(SET) "CGO_ENABLED=0" && go build $(GOOPT) && go build -C "$(CURDIR)/cmd/sqlbless" -o "$(CURDIR)/$(NAME)$(EXE)" $(GOOPT)
test:
ifeq ($(OS),Windows_NT)
pwsh "test/test-sqlite3.ps1"
pwsh "test/test.ps1"
endif
go test -v
_dist:
$(MAKE) all
zip -9 $(NAME)-$(VERSION)-$(GOOS)-$(GOARCH).zip $(NAME)$(EXE)
dist:
$(SET) "GOOS=linux" && $(SET) "GOARCH=386" && $(MAKE) _dist
$(SET) "GOOS=linux" && $(SET) "GOARCH=amd64" && $(MAKE) _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 > $(NAME).json
release:
gh release create -d --notes "" -t $(VERSION) $(VERSION) $(wildcard $(NAME)-$(VERSION)-*.zip)
get :
cd "$(CURDIR)/cmd/sqlbless" && go get -u && go mod tidy
.PHONY: all test dist _dist clean manifest release