-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (48 loc) · 1.91 KB
/
Makefile
File metadata and controls
61 lines (48 loc) · 1.91 KB
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
54
55
56
57
58
59
60
61
ifeq ($(OS),Windows_NT)
SHELL=CMD.EXE
SET=set
WHICH=where.exe
DEL=del
NUL=nul
else
SET=export
WHICH=which
DEL=rm
NUL=/dev/null
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 github.com/hymkor/sqlbless.Version=$(VERSION)"
EXE=$(shell $(GO) env GOEXE)
build:
$(GO) fmt ./...
$(SET) "CGO_ENABLED=0" && $(GO) build -C "$(CURDIR)/cmd/sqlbless" -o "$(CURDIR)" $(GOOPT)
test:
$(GO) test -v ./...
_dist:
$(SET) "CGO_ENABLED=0" && $(GO) build -C "$(CURDIR)/cmd/sqlbless" -o "$(CURDIR)" $(GOOPT)
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:
$(GO) run github.com/hymkor/make-scoop-manifest@master -all *-windows-*.zip > $(NAME).json
release:
$(GO) run github.com/hymkor/latest-notes@latest | gh release create -d --notes-file - -t $(VERSION) $(VERSION) $(wildcard $(NAME)-$(VERSION)-*.zip)
bump:
$(GO) run github.com/hymkor/latest-notes@latest -suffix "-goinstall" -gosrc sqlbless release_note*.md > version.go
docs:
$(GO) run github.com/hymkor/minipage@latest -outline-in-sidebar -readme-to-index README.md > docs/index.html
$(GO) run github.com/hymkor/minipage@latest -outline-in-sidebar -readme-to-index README_ja.md > docs/index_ja.html
readme:
$(GO) run github.com/hymkor/example-into-readme@latest
$(GO) run github.com/hymkor/example-into-readme@latest -target README_ja.md
.PHONY: all test dist _dist clean manifest release docs bump