-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
56 lines (39 loc) · 1.33 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
54
55
56
VERSION := $(shell git describe --always --tags --dirty)
ldflags := "-X sqyrrl/server.Version=${VERSION}"
build_args := -a -v -ldflags ${ldflags}
build_path = build/sqyrrl-${VERSION}
export GOARCH := $(shell go env GOARCH)
CGO_ENABLED := 1
.PHONY: build build-linux build-darwin build-windows check clean coverage install lint test-install test
all: build
build: build-linux build-darwin build-windows
build-linux: export GOOS = linux
build-linux:
mkdir -p ${build_path}
go build ${build_args} -o ${build_path}/sqyrrl-${GOOS}-${GOARCH} ./main.go
build-darwin: export GOOS = darwin
build-darwin:
mkdir -p ${build_path}
go build ${build_args} -o ${build_path}/sqyrrl-${GOOS}-${GOARCH} ./main.go
build-windows: export GOOS = windows
build-windows:
mkdir -p ${build_path}
go build ${build_args} -o ${build_path}/sqyrrl-${GOOS}-${GOARCH}.exe ./main.go
install:
go install ${build_args}
lint:
golangci-lint run ./...
check: test
test-install:
go install github.com/onsi/ginkgo/v2/ginkgo
test: test-install
ginkgo -r --race
coverage: test-install
ginkgo -r --cover -coverprofile=coverage.out
dist: build
cp README.md COPYING ${build_path}
tar -C ./build -cvj -f ./build/sqyrrl-${VERSION}.tar.bz2 sqyrrl-${VERSION}
shasum -a 256 ./build/sqyrrl-${VERSION}.tar.bz2 > ./build/sqyrrl-${VERSION}.tar.bz2.sha256
clean:
go clean
$(RM) -r ./build